本文整理汇总了PHP中Forum::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Forum::get方法的具体用法?PHP Forum::get怎么用?PHP Forum::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Forum
的用法示例。
在下文中一共展示了Forum::get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Forums
/**
* Get the forums. Actually its a bit more complex than that
* we need to group by the Forum Categories.
*
* @return ArrayList
*/
function Forums()
{
$categoryText = isset($_REQUEST['Category']) ? Convert::raw2xml($_REQUEST['Category']) : null;
$holder = $this;
if ($this->getShowInCategories()) {
return ForumCategory::get()->filter('ForumHolderID', $this->ID)->filterByCallback(function ($category) use($categoryText, $holder) {
// Don't include if we've specified a Category, and it doesn't match this one
if ($categoryText !== null && $category->Title != $categoryText) {
return false;
}
// Get a list of forums that live under this holder & category
$category->CategoryForums = Forum::get()->filter(array('CategoryID' => $category->ID, 'ParentID' => $holder->ID, 'ShowInMenus' => 1))->filterByCallback(function ($forum) {
return $forum->canView();
});
return $category->CategoryForums->exists();
});
} else {
return Forum::get()->filter(array('ParentID' => $this->ID, 'ShowInMenus' => 1))->filterByCallback(function ($forum) {
return $forum->canView();
});
}
}
示例2: AdminFormFeatures
/**
* Forum Admin Features form.
* Handles the dropdown to select the new forum category and the checkbox for stickyness
*
* @return Form
*/
function AdminFormFeatures()
{
if (!$this->canModerate()) {
return;
}
$id = isset($this->urlParams['ID']) ? $this->urlParams['ID'] : false;
$fields = new FieldList(new CheckboxField('IsSticky', _t('Forum.ISSTICKYTHREAD', 'Is this a Sticky Thread?')), new CheckboxField('IsGlobalSticky', _t('Forum.ISGLOBALSTICKY', 'Is this a Global Sticky (shown on all forums)')), new CheckboxField('IsReadOnly', _t('Forum.ISREADONLYTHREAD', 'Is this a Read only Thread?')), new HiddenField("ID", "Thread"));
if (($forums = Forum::get()) && $forums->exists()) {
$fields->push(new DropdownField("ForumID", _t('Forum.CHANGETHREADFORUM', "Change Thread Forum"), $forums->map('ID', 'Title', 'Select New Category:')), '', null, 'Select New Location:');
}
$actions = new FieldList(new FormAction('doAdminFormFeatures', _t('Forum.SAVE', 'Save')));
$form = new Form($this, 'AdminFormFeatures', $fields, $actions);
// need this id wrapper since the form method is called on save as
// well and needs to return a valid form object
if ($id) {
$thread = ForumThread::get()->byID($id);
$form->loadDataFrom($thread);
}
return $form;
}