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


PHP Forum::get方法代码示例

本文整理汇总了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();
         });
     }
 }
开发者ID:helpfulrobot,项目名称:silverstripe-forum,代码行数:28,代码来源:ForumHolder.php

示例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;
 }
开发者ID:helpfulrobot,项目名称:silverstripe-forum,代码行数:26,代码来源:Forum.php


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