diff --git a/controllers/class.badgecontroller.php b/controllers/class.badgecontroller.php index 772efe2..d602237 100644 --- a/controllers/class.badgecontroller.php +++ b/controllers/class.badgecontroller.php @@ -43,7 +43,8 @@ class BadgeController extends DashboardController { $this->Title(T('Yaga.ManageBadges')); // 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->Render(); diff --git a/models/class.badgemodel.php b/models/class.badgemodel.php index a8ae77d..3e16a35 100644 --- a/models/class.badgemodel.php +++ b/models/class.badgemodel.php @@ -41,6 +41,16 @@ class BadgeModel extends Gdn_Model { } 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 diff --git a/readme.md b/readme.md index 8a2a9f8..f813a8e 100644 --- a/readme.md +++ b/readme.md @@ -18,7 +18,7 @@ Yet Another Gamification Application ** Also show the reaction record ** Also refactor that method, really messy right now * Rule tooltip help -* Add pager to badge settings screen +* ~~Add pager to badge settings screen~~ * Create/find reusable badge images * Mention who gave you the badge on the badge detail page * Refactor reaction CSS diff --git a/views/badge/settings.php b/views/badge/settings.php index 123be50..289e811 100644 --- a/views/badge/settings.php +++ b/views/badge/settings.php @@ -48,3 +48,4 @@ echo Wrap(Anchor(T('Yaga.AddBadge'), 'yaga/badge/add', array('class' => 'SmallBu ?> + $this));