当前位置: 首页>>代码示例>>PHP>>正文


PHP DiscussionModel::getByUser方法代码示例

本文整理汇总了PHP中DiscussionModel::getByUser方法的典型用法代码示例。如果您正苦于以下问题:PHP DiscussionModel::getByUser方法的具体用法?PHP DiscussionModel::getByUser怎么用?PHP DiscussionModel::getByUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DiscussionModel的用法示例。


在下文中一共展示了DiscussionModel::getByUser方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: profileController_discussions_create

 /**
  * Creates virtual 'Discussions' method in ProfileController.
  *
  * @since 2.0.0
  * @package Vanilla
  *
  * @param ProfileController $Sender ProfileController.
  */
 public function profileController_discussions_create($Sender, $UserReference = '', $Username = '', $Page = '', $UserID = '')
 {
     $Sender->editMode(false);
     // Tell the ProfileController what tab to load
     $Sender->getUserInfo($UserReference, $Username, $UserID);
     $Sender->_setBreadcrumbs(t('Discussions'), userUrl($Sender->User, '', 'discussions'));
     $Sender->setTabView('Discussions', 'Profile', 'Discussions', 'Vanilla');
     $Sender->CountCommentsPerPage = c('Vanilla.Comments.PerPage', 30);
     list($Offset, $Limit) = offsetLimit($Page, c('Vanilla.Discussions.PerPage', 30));
     $DiscussionModel = new DiscussionModel();
     $Discussions = $DiscussionModel->getByUser($Sender->User->UserID, $Limit, $Offset, false, Gdn::session()->UserID);
     $CountDiscussions = $Offset + $DiscussionModel->LastDiscussionCount + 1;
     $Sender->DiscussionData = $Sender->setData('Discussions', $Discussions);
     // Build a pager
     $PagerFactory = new Gdn_PagerFactory();
     $Sender->Pager = $PagerFactory->getPager('MorePager', $Sender);
     $Sender->Pager->MoreCode = 'More Discussions';
     $Sender->Pager->LessCode = 'Newer Discussions';
     $Sender->Pager->ClientID = 'Pager';
     $Sender->Pager->configure($Offset, $Limit, $CountDiscussions, userUrl($Sender->User, '', 'discussions') . '?page={Page}');
     // Deliver JSON data if necessary
     if ($Sender->deliveryType() != DELIVERY_TYPE_ALL && $Offset > 0) {
         $Sender->setJson('LessRow', $Sender->Pager->toString('less'));
         $Sender->setJson('MoreRow', $Sender->Pager->toString('more'));
         $Sender->View = 'discussions';
     }
     // Set the HandlerType back to normal on the profilecontroller so that it fetches it's own views
     $Sender->HandlerType = HANDLER_TYPE_NORMAL;
     // Do not show discussion options
     $Sender->ShowOptions = false;
     if ($Sender->Head) {
         // These pages offer only duplicate content to search engines and are a bit slow.
         $Sender->Head->addTag('meta', array('name' => 'robots', 'content' => 'noindex,noarchive'));
     }
     // Render the ProfileController
     $Sender->render();
 }
开发者ID:vanilla,项目名称:vanilla,代码行数:45,代码来源:class.hooks.php


注:本文中的DiscussionModel::getByUser方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。