本文整理汇总了PHP中CategoryModel::filterCategoryPermissions方法的典型用法代码示例。如果您正苦于以下问题:PHP CategoryModel::filterCategoryPermissions方法的具体用法?PHP CategoryModel::filterCategoryPermissions怎么用?PHP CategoryModel::filterCategoryPermissions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CategoryModel
的用法示例。
在下文中一共展示了CategoryModel::filterCategoryPermissions方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
public function getData($Limit = false)
{
if ($Limit === false) {
$Limit = C('Plugins.DiscussionEvent.MaxDiscussionEvents');
}
$DiscussionEventModel = new DiscussionEventModel();
// Check for individual categories:
$Where = array();
if ($this->CategoryID) {
$Where['d.CategoryID'] = CategoryModel::filterCategoryPermissions(array($this->CategoryID));
} else {
$DiscussionEventModel->Watching = true;
}
$this->setData('DiscussionEvents', $DiscussionEventModel->getByDiscussionEventRange(0, $Limit, false, false, $Where));
}
示例2: getData
/**
* Get the data for the module.
*
* @param int|bool $limit Override the number of discussions to display.
*/
public function getData($limit = false)
{
if (!$limit) {
$limit = $this->Limit;
}
$discussionModel = new DiscussionModel();
$categoryIDs = $this->getCategoryIDs();
$where = array('Announce' => 'all');
if ($categoryIDs) {
$where['d.CategoryID'] = CategoryModel::filterCategoryPermissions($categoryIDs);
} else {
$discussionModel->Watching = true;
}
$this->setData('Discussions', $discussionModel->get(0, $limit, $where));
}
示例3: index
/**
* Default all discussions view: chronological by most recent comment.
*
* @since 2.0.0
* @access public
*
* @param int $Page Multiplied by PerPage option to determine offset.
*/
public function index($Page = false)
{
// Figure out which discussions layout to choose (Defined on "Homepage" settings page).
$Layout = c('Vanilla.Discussions.Layout');
switch ($Layout) {
case 'table':
if ($this->SyndicationMethod == SYNDICATION_NONE) {
$this->View = 'table';
}
break;
default:
// $this->View = 'index';
break;
}
Gdn_Theme::section('DiscussionList');
// Check for the feed keyword.
if ($Page === 'feed' && $this->SyndicationMethod != SYNDICATION_NONE) {
$Page = 'p1';
}
// Determine offset from $Page
list($Offset, $Limit) = offsetLimit($Page, c('Vanilla.Discussions.PerPage', 30), true);
$Page = PageNumber($Offset, $Limit);
// Allow page manipulation
$this->EventArguments['Page'] =& $Page;
$this->EventArguments['Offset'] =& $Offset;
$this->EventArguments['Limit'] =& $Limit;
$this->fireEvent('AfterPageCalculation');
// Set canonical URL
$this->canonicalUrl(url(ConcatSep('/', 'discussions', PageNumber($Offset, $Limit, true, false)), true));
// We want to limit the number of pages on large databases because requesting a super-high page can kill the db.
$MaxPages = c('Vanilla.Discussions.MaxPages');
if ($MaxPages && $Page > $MaxPages) {
throw notFoundException();
}
// Setup head.
if (!$this->data('Title')) {
$Title = c('Garden.HomepageTitle');
$DefaultControllerRoute = val('Destination', Gdn::router()->GetRoute('DefaultController'));
if ($Title && $DefaultControllerRoute == 'discussions') {
$this->title($Title, '');
} else {
$this->title(t('Recent Discussions'));
}
}
if (!$this->Description()) {
$this->Description(c('Garden.Description', null));
}
if ($this->Head) {
$this->Head->AddRss(url('/discussions/feed.rss', true), $this->Head->title());
}
// Add modules
$this->addModule('DiscussionFilterModule');
$this->addModule('NewDiscussionModule');
$this->addModule('CategoriesModule');
$this->addModule('BookmarkedModule');
$this->setData('Breadcrumbs', array(array('Name' => t('Recent Discussions'), 'Url' => '/discussions')));
// Set criteria & get discussions data
$this->setData('Category', false, true);
$DiscussionModel = new DiscussionModel();
// Check for individual categories.
$categoryIDs = $this->getCategoryIDs();
$where = array();
if ($categoryIDs) {
$where['d.CategoryID'] = CategoryModel::filterCategoryPermissions($categoryIDs);
} else {
$DiscussionModel->Watching = true;
}
// Get Discussion Count
$CountDiscussions = $DiscussionModel->getCount($where);
if ($MaxPages) {
$CountDiscussions = min($MaxPages * $Limit, $CountDiscussions);
}
$this->setData('CountDiscussions', $CountDiscussions);
// Get Announcements
$this->AnnounceData = $Offset == 0 ? $DiscussionModel->GetAnnouncements($where) : false;
$this->setData('Announcements', $this->AnnounceData !== false ? $this->AnnounceData : array(), true);
// Get Discussions
$this->DiscussionData = $DiscussionModel->getWhere($where, $Offset, $Limit);
$this->setData('Discussions', $this->DiscussionData, true);
$this->setJson('Loading', $Offset . ' to ' . $Limit);
// Build a pager
$PagerFactory = new Gdn_PagerFactory();
$this->EventArguments['PagerType'] = 'Pager';
$this->fireEvent('BeforeBuildPager');
if (!$this->data('_PagerUrl')) {
$this->setData('_PagerUrl', 'discussions/{Page}');
}
$this->Pager = $PagerFactory->GetPager($this->EventArguments['PagerType'], $this);
$this->Pager->ClientID = 'Pager';
$this->Pager->configure($Offset, $Limit, $this->data('CountDiscussions'), $this->data('_PagerUrl'));
PagerModule::Current($this->Pager);
$this->setData('_Page', $Page);
//.........这里部分代码省略.........