當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DiscussionModel::GetParticipated方法代碼示例

本文整理匯總了PHP中DiscussionModel::GetParticipated方法的典型用法代碼示例。如果您正苦於以下問題:PHP DiscussionModel::GetParticipated方法的具體用法?PHP DiscussionModel::GetParticipated怎麽用?PHP DiscussionModel::GetParticipated使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DiscussionModel的用法示例。


在下文中一共展示了DiscussionModel::GetParticipated方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: DiscussionsController_Participated_Create

 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'));
 }
開發者ID:seedbank,項目名稱:old-repo,代碼行數:34,代碼來源:class.participated.plugin.php

示例2: DiscussionsController_Participated_Create

 /**
  * Create paginated list of discussions user has participated in.
  */
 public function DiscussionsController_Participated_Create($Sender, $Args = array())
 {
     $Sender->Permission('Garden.SignIn.Allow');
     Gdn_Theme::Section('DiscussionList');
     $Page = GetValue(0, $Args);
     $Limit = GetValue(1, $Args);
     // Set criteria & get discussions data
     list($Offset, $Limit) = OffsetLimit($Page, C('Vanilla.Discussions.PerPage', 30));
     $DiscussionModel = new DiscussionModel();
     $Sender->DiscussionData = $DiscussionModel->GetParticipated(Gdn::Session()->UserID, $Offset, $Limit);
     $Sender->SetData('Discussions', $Sender->DiscussionData);
     //Set view
     $Sender->View = 'index';
     if (C('Vanilla.Discussions.Layout') === 'table') {
         $Sender->View = 'table';
     }
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->EventArguments['PagerType'] = 'Pager';
     $Sender->FireEvent('BeforeBuildParticipatedPager');
     $Sender->Pager = $PagerFactory->GetPager($Sender->EventArguments['PagerType'], $Sender);
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->Configure($Offset, $Limit, FALSE, 'discussions/participated/{Page}');
     $Sender->SetData('CountDiscussions', false);
     // force prev/next pager
     $Sender->FireEvent('AfterBuildParticipatedPager');
     // 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';
     }
     $Sender->SetData('_PagerUrl', 'discussions/participated/{Page}');
     $Sender->SetData('_Page', $Page);
     $Sender->SetData('_Limit', $Limit);
     // Add modules
     $Sender->AddModule('NewDiscussionModule');
     $Sender->AddModule('DiscussionFilterModule');
     $Sender->AddModule('CategoriesModule');
     $Sender->AddModule('BookmarkedModule');
     $Sender->Title(T('Participated Discussions'));
     $Sender->SetData('Breadcrumbs', array(array('Name' => T('Participated Discussions'), 'Url' => '/discussions/participated')));
     $Sender->Render();
 }
開發者ID:SatiricMan,項目名稱:addons,代碼行數:47,代碼來源:class.participated.plugin.php


注:本文中的DiscussionModel::GetParticipated方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。