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


PHP forum::get_course_forums方法代码示例

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


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

示例1: array

 $table->head = array($strforum, $strdescription, $strdiscussionsunread);
 $table->align = array('left', 'left', 'center');
 if ($useweeks || $usesections) {
     array_unshift($table->head, $useweeks ? $strweek : $strsection);
     array_unshift($table->align, 'left');
 }
 if ($canmaybesubscribe) {
     $table->head[] = $strsubscribed;
     $table->align[] = 'center';
 }
 if ($showrss = ($canmaybesubscribe || $course->id == SITEID) && !empty($CFG->enablerssfeeds) && !empty($CFG->forumng_enablerssfeeds)) {
     $table->head[] = $strfeeds;
     $table->align[] = 'center';
 }
 // Construct forums array
 $forums = forum::get_course_forums($course, 0, forum::UNREAD_DISCUSSIONS, array(), true);
 // Display all forums
 $currentsection = 0;
 $cansubscribesomething = false;
 $canunsubscribesomething = false;
 foreach ($forums as $forum) {
     $cm = $forum->get_course_module();
     // Skip forum if it's not visible or you can't read discussions there
     if (!$cm->uservisible || !has_capability('mod/forumng:viewdiscussion', $forum->get_context())) {
         continue;
     }
     // Additional OU access restrictions
     if (class_exists('ouflags')) {
         list($accessible, $visible, $message) = is_module_student_accessible($cm, $course);
         if (!$accessible) {
             continue;
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:index.php

示例2: get_string

                     if ($requestingsubscribe_group && $groupid) {
                         $forum->subscribe(0, $groupid);
                         $confirmtext = get_string('subscribe_confirm_group', 'forumng');
                     } else {
                         print_error('error_invalidsubscriptionrequest', 'forumng');
                     }
                 }
             }
         }
     }
 }
 // Handle whole course
 if ($courseid) {
     $course = get_record('course', 'id', $courseid);
     require_login($course);
     $forums = forum::get_course_forums($course, 0, forum::UNREAD_NONE, array(), true);
     foreach ($forums as $forum) {
         if (!$forum->can_change_subscription()) {
             continue;
         }
         $subscription_info = $forum->get_subscription_info();
         $discussionidcount = count($subscription_info->discussionids);
         if ($subscription_info->wholeforum) {
             //subscribed to the entire forum
             $subscribed = forum::FULLY_SUBSCRIBED;
         } else {
             if ($discussionidcount == 0) {
                 $subscribed = forum::NOT_SUBSCRIBED;
             } else {
                 $subscribed = forum::PARTIALLY_SUBSCRIBED;
             }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:31,代码来源:subscribe.php

示例3: forumng_print_overview

/**
 * Create html fragment for display on myMoodle page, forums changed since
 * user last visited
 *
 * @param $courses list of courses to output information from
 * @param $htmlarray returned results appended html to display
 */
function forumng_print_overview($courses, &$htmlarray)
{
    global $USER, $CFG;
    require_once $CFG->dirroot . '/mod/forumng/forum.php';
    if (empty($courses) || !is_array($courses) || count($courses) == 0) {
        return array();
    }
    $strnumunread = get_string('discussionsunread', 'forumng');
    $strforum = get_string('modulename', 'forumng');
    foreach ($courses as $course) {
        $str = "";
        $forums = forum::get_course_forums($course, $USER->id, forum::UNREAD_DISCUSSIONS);
        if (!empty($forums)) {
            foreach ($forums as $forum) {
                // note like all mymoodle, there's no check current user can see each forum
                // ok for openlearn & vital but might need addressing if VLE ever use it
                if ($forum->has_unread_discussions()) {
                    // only listing unread, not new & unread for performance
                    $str .= '<div class="overview forumng"><div class="name">' . $strforum . ':' . ' <a title="' . $strforum . '" href="' . $forum->get_url(forum::PARAM_HTML) . '">' . $forum->get_name() . '</a></div>';
                    $str .= '<div class="info">' . $forum->get_num_unread_discussions() . ' ' . $strnumunread . '</div></div>';
                }
            }
        }
        if (!empty($str)) {
            if (!array_key_exists($course->id, $htmlarray)) {
                $htmlarray[$course->id] = array();
            }
            if (!array_key_exists('forumng', $htmlarray[$course->id])) {
                $htmlarray[$course->id]['forumng'] = '';
                // initialize, avoid warnings
            }
            $htmlarray[$course->id]['forumng'] .= $str;
        }
    }
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:42,代码来源:lib.php


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