public function DiscussionsController_Participated_Create(&$Sender, $Args) { $Sender->Permission('Garden.SignIn.Allow'); $Page = GetValue(0, $Args); $Limit = GetValue(1, $Args); list($Offset, $Limit) = OffsetLimit($Page, Gdn::Config('Vanilla.Discussions.PerPage', 30)); // Get Discussions $DiscussionModel = new DiscussionModel(); $Sender->DiscussionData = $DiscussionModel->GetParticipated(Gdn::Session()->UserID, $Offset, $Limit); $Sender->SetData('Discussions', $Sender->DiscussionData); $CountDiscussions = $DiscussionModel->GetCountParticipated(Gdn::Session()->UserID); $Sender->SetData('CountDiscussions', $CountDiscussions); // Build a pager $PagerFactory = new Gdn_PagerFactory(); $Sender->EventArguments['PagerType'] = 'Pager'; $Sender->FireEvent('BeforeBuildPager'); $Sender->Pager = $PagerFactory->GetPager($Sender->EventArguments['PagerType'], $Sender); $Sender->Pager->ClientID = 'Pager'; $Sender->Pager->Configure($Offset, $Limit, $CountDiscussions, 'discussions/participated/%1$s'); $Sender->FireEvent('AfterBuildPager'); // Deliver JSON data if necessary if ($Sender->DeliveryType() != DELIVERY_TYPE_ALL) { $Sender->SetJson('LessRow', $Sender->Pager->ToString('less')); $Sender->SetJson('MoreRow', $Sender->Pager->ToString('more')); $Sender->View = 'discussions'; } // Add modules $Sender->AddModule('NewDiscussionModule'); $Sender->AddModule('CategoriesModule'); $BookmarkedModule = new BookmarkedModule($Sender); $BookmarkedModule->GetData(); $Sender->AddModule($BookmarkedModule); $Sender->Render($this->GetView('participated.php')); }
protected function GetCountParticipated() { if (is_null($this->CountParticipated)) { $DiscussionModel = new DiscussionModel(); try { $this->CountParticipated = $DiscussionModel->GetCountParticipated(NULL); } catch (Exception $e) { $this->CountParticipated = FALSE; } } return $this->CountParticipated; }