Added pager to the badge settings screen

This commit is contained in:
Zachary Doll 2013-12-11 13:59:22 -06:00
parent ff410bcd7b
commit 4ac36b036e
4 changed files with 14 additions and 2 deletions

View File

@ -43,7 +43,8 @@ class BadgeController extends DashboardController {
$this->Title(T('Yaga.ManageBadges')); $this->Title(T('Yaga.ManageBadges'));
// Get list of badges from the model and pass to the view // Get list of badges from the model and pass to the view
$this->SetData('Badges', $this->BadgeModel->Get()); list($Offset, $Limit) = OffsetLimit($Page, PagerModule::$DefaultPageSize);
$this->SetData('Badges', $this->BadgeModel->GetLimit($Limit, $Offset));
$this->SetData('Rules', RulesController::GetRules()); $this->SetData('Rules', RulesController::GetRules());
$this->Render(); $this->Render();

View File

@ -41,6 +41,16 @@ class BadgeModel extends Gdn_Model {
} }
return self::$_Badges; return self::$_Badges;
} }
public function GetLimit($Limit = FALSE, $Offset = FALSE) {
return $this->SQL
->Select()
->From('Badge')
->OrderBy('BadgeID')
->Limit($Limit, $Offset)
->Get()
->Result();
}
/** /**
* Total number of badges in the system * Total number of badges in the system

View File

@ -18,7 +18,7 @@ Yet Another Gamification Application
** Also show the reaction record ** Also show the reaction record
** Also refactor that method, really messy right now ** Also refactor that method, really messy right now
* Rule tooltip help * Rule tooltip help
* Add pager to badge settings screen * ~~Add pager to badge settings screen~~
* Create/find reusable badge images * Create/find reusable badge images
* Mention who gave you the badge on the badge detail page * Mention who gave you the badge on the badge detail page
* Refactor reaction CSS * Refactor reaction CSS

View File

@ -48,3 +48,4 @@ echo Wrap(Anchor(T('Yaga.AddBadge'), 'yaga/badge/add', array('class' => 'SmallBu
?> ?>
</tbody> </tbody>
</table> </table>
<?php PagerModule::Write(array('Sender' => $this));