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


PHP forum::can_manage_discussions方法代码示例

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


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

示例1: print_view_page

 /**
  * Displays the view page (usually showing a list of discussions).
  * @param forum $forum Forum
  * @param int $groupid Group ID
  */
 public function print_view_page($forum, $groupid)
 {
     global $SESSION;
     $forumid = $forum->get_id();
     $baseurl = 'view.php?' . $forum->get_link_params(forum::PARAM_PLAIN);
     if (isset($SESSION->forumng_discussionlist[$forumid]) && property_exists($SESSION->forumng_discussionlist[$forumid], 'groupid') && $SESSION->forumng_discussionlist[$forumid]->groupid != $groupid) {
         unset($SESSION->forumng_discussionlist[$forumid]->page);
         unset($SESSION->forumng_discussionlist[$forumid]->groupid);
     }
     //Remember the sort order and page number in session variables
     //Unset the page session variable when the sort links are clicked
     // or groupid has been changed (using the group dropdown box)
     $sortorder = optional_param('sort', '', PARAM_ALPHA);
     if (!$sortorder) {
         if (isset($SESSION->forumng_discussionlist[$forumid]->sort)) {
             $sortorder = $SESSION->forumng_discussionlist[$forumid]->sort;
         } else {
             $sortorder = 'd';
         }
     } else {
         if (optional_param('sortlink', '', PARAM_ALPHA)) {
             $SESSION->forumng_discussionlist[$forumid]->sort = $sortorder;
             unset($SESSION->forumng_discussionlist[$forumid]->page);
         }
     }
     $page = optional_param('page', 0, PARAM_INT);
     if (!$page) {
         if (isset($SESSION->forumng_discussionlist[$forumid]->page)) {
             $page = $SESSION->forumng_discussionlist[$forumid]->page;
         } else {
             $page = 1;
         }
     } else {
         $SESSION->forumng_discussionlist[$forumid]->page = $page;
         $SESSION->forumng_discussionlist[$forumid]->groupid = $groupid;
     }
     $baseurl .= '&page=' . $page;
     $sortchar = substr($sortorder, 0, 1);
     if (strlen($sortorder) == 2) {
         $sortreverse = substr($sortorder, 1, 1) == 'r' ? true : false;
     } else {
         $sortreverse = false;
     }
     $baseurl .= '&sort=' . $sortchar;
     $baseurl .= $sortreverse ? 'r' : '';
     $sort = forum::get_sort_code($sortchar);
     $list = $forum->get_discussion_list($groupid, $forum->can_view_hidden(), $forum->can_manage_discussions(), $page, $sort, $sortreverse);
     $sticky = $list->get_sticky_discussions();
     $normal = $list->get_normal_discussions();
     // Remove discussions from list if the forumtype thinks we can't see
     // them
     foreach ($sticky as $key => $value) {
         if (!$this->can_view_discussion($value)) {
             unset($sticky[$key]);
         }
     }
     foreach ($normal as $key => $value) {
         if (!$this->can_view_discussion($value)) {
             unset($normal[$key]);
         }
     }
     // Intro
     print $forum->display_intro();
     // Draft posts
     $drafts = $forum->get_drafts();
     if (count($drafts) > 0) {
         print $forum->display_draft_list_start();
         foreach ($drafts as $draft) {
             print $draft->display_draft_list_item($forum, $draft == end($drafts));
         }
         print $forum->display_draft_list_end();
     }
     //print info about the start and end dtates of the forum from the form setting;
     $stringend = has_capability('mod/forumng:ignorepostlimits', $forum->get_context()) ? 'capable' : '';
     $startdate = $forum->get_postingfrom();
     $enddate = $forum->get_postinguntil();
     // Before start date
     if (time() < $startdate) {
         $message = get_string('beforestartdate' . $stringend, 'forumng', forum_utils::display_date($startdate));
         print "<div class='forumng-show-dates'>{$message}</div>";
     } else {
         if (time() < $enddate) {
             $message = get_string('beforeenddate' . $stringend, 'forumng', forum_utils::display_date($enddate));
             print "<div class='forumng-show-dates'>{$message}</div>";
         }
     }
     // After end date
     if ($enddate && time() >= $enddate) {
         $message = get_string('afterenddate' . $stringend, 'forumng', forum_utils::display_date($enddate));
         print "<div class='forumng-show-dates'>{$message}</div>";
     }
     // Post button - temporarily disabled when in all-groups mode
     print $groupid == NULL ? '' : $forum->display_post_button($groupid);
     print $list->display_paging_bar($baseurl);
     if (count($sticky) + count($normal) > 0) {
//.........这里部分代码省略.........
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:general_forum_type.php

示例2: should_display

 /**
  * Checks whether this feature should be displayed for the given user
  * in current forum.
  * By default, this checks the discussions's can_manage function and that
  * the discussion isn't deleted.
  * @param forum $forum Forum object
  * @param int $groupid Group id
  * @return bool True if this should display
  */
 public function should_display($forum)
 {
     return $forum->can_manage_discussions();
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:13,代码来源:discussion_list_feature.php


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