當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。