diff --git a/controllers/class.configurecontroller.php b/controllers/class.configurecontroller.php index 18f7b00..3f2b4ae 100644 --- a/controllers/class.configurecontroller.php +++ b/controllers/class.configurecontroller.php @@ -50,7 +50,9 @@ class ConfigureController extends DashboardController { $ConfigModule->Initialize(array( 'Yaga.Reactions.Enabled' => array('LabelCode' => 'Use Reactions', 'Control' => 'Checkbox'), 'Yaga.Badges.Enabled' => array('LabelCode' => 'Use Badges', 'Control' => 'Checkbox'), - 'Yaga.Ranks.Enabled' => array('LabelCode' => 'Use Ranks', 'Control' => 'Checkbox') + 'Yaga.Ranks.Enabled' => array('LabelCode' => 'Use Ranks', 'Control' => 'Checkbox'), + 'Yaga.LeaderBoard.Enabled' => array('LabelCode' => 'Show leaderboard on activity page', 'Control' => 'Checkbox'), + 'Yaga.LeaderBoard.Limit' => array('LabelCode' => 'Maximum number of leaders to show', 'Control' => 'Textbox', 'Options' => array('Size' => 45, 'class' => 'SmallInput')) )); $this->AddSideMenu('configure'); $this->SetData('Title', 'Gamification Settings'); diff --git a/modules/class.leaderboardmodule.php b/modules/class.leaderboardmodule.php index 331280a..00d5ac6 100755 --- a/modules/class.leaderboardmodule.php +++ b/modules/class.leaderboardmodule.php @@ -25,7 +25,7 @@ class LeaderBoardModule extends Gdn_Module { ->Where('up.TimeSlot', gmdate('Y-m-d', Gdn_Statistics::TimeSlotStamp($SlotType))) ->Where('up.Source', 'Total') ->OrderBy('up.Points', 'desc') - ->Limit(10, 0) + ->Limit(C('Yaga.LeaderBoard.Limit', 10), 0) ->Get() ->Result(); diff --git a/settings/class.hooks.php b/settings/class.hooks.php index a3faf88..74fafcf 100755 --- a/settings/class.hooks.php +++ b/settings/class.hooks.php @@ -7,8 +7,6 @@ */ class YagaHooks implements Gdn_IPlugin { - static $_ReactionModel = NULL; - /** * Add the settings page links * @@ -48,11 +46,12 @@ class YagaHooks implements Gdn_IPlugin { echo Wrap(T('Yaga.Reactions', 'Reactions'), 'h2', array('class' => 'H')); // insert the reaction totals in the profile - $Actions = $this->_ReactionModel->GetActions(); + $ReactionModel = Yaga::ReactionModel(); + $Actions = $ReactionModel->GetActions(); $String = ''; foreach($Actions as $Action) { $Selected = ($ActionID == $Action->ActionID) ? ' Selected' : ''; - $Count = $this->_ReactionModel->GetUserReactionCount($User->UserID, $Action->ActionID); + $Count = $ReactionModel->GetUserReactionCount($User->UserID, $Action->ActionID); $TempString = Wrap(Wrap(Gdn_Format::BigNumber($Count), 'span', array('title' => $Count)), 'span', array('class' => 'Yaga_ReactionCount CountTotal')); $TempString .= Wrap($Action->Name, 'span', array('class' => 'Yaga_ReactionName CountLabel')); @@ -70,13 +69,14 @@ class YagaHooks implements Gdn_IPlugin { public function UserInfoModule_OnBasicInfo_Handler($Sender) { $UserID = $Sender->User->UserID; $BadgeCount = Yaga::BadgeModel()->GetUserBadgeAwardCount($UserID); - echo '