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


PHP condition_info::is_available方法代码示例

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


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

示例1: obtain_dynamic_data

    /**
     * If dynamic data for this course-module is not yet available, gets it.
     *
     * This function is automatically called when requesting any course_modinfo property
     * that can be modified by modules (have a set_xxx method).
     *
     * Dynamic data is data which does not come directly from the cache but is calculated at
     * runtime based on the current user. Primarily this concerns whether the user can access
     * the module or not.
     *
     * As part of this function, the module's _cm_info_dynamic function from its lib.php will
     * be called (if it exists).
     * @return void
     */
    private function obtain_dynamic_data() {
        global $CFG;
        $userid = $this->modinfo->get_user_id();
        if ($this->state >= self::STATE_BUILDING_DYNAMIC || $userid == -1) {
            return;
        }
        $this->state = self::STATE_BUILDING_DYNAMIC;

        if (!empty($CFG->enableavailability)) {
            require_once($CFG->libdir. '/conditionlib.php');
            // Get availability information
            $ci = new condition_info($this);
            // Note that the modinfo currently available only includes minimal details (basic data)
            // but we know that this function does not need anything more than basic data.
            $this->available = $ci->is_available($this->availableinfo, true,
                    $userid, $this->modinfo);

            // Check parent section
            $parentsection = $this->modinfo->get_section_info($this->sectionnum);
            if (!$parentsection->available) {
                // Do not store info from section here, as that is already
                // presented from the section (if appropriate) - just change
                // the flag
                $this->available = false;
            }
        } else {
            $this->available = true;
        }

        // Update visible state for current user
        $this->update_user_visible();

        // Let module make dynamic changes at this point
        $this->call_mod_function('cm_info_dynamic');
        $this->state = self::STATE_DYNAMIC;
    }
开发者ID:rwijaya,项目名称:moodle,代码行数:50,代码来源:modinfolib.php

示例2: coursemodule_visible_for_user

/**
 * Determine whether a course module is visible within a course,
 * this is different from instance_is_visible() - faster and visibility for user
 *
 * @global object
 * @global object
 * @uses DEBUG_DEVELOPER
 * @uses CONTEXT_MODULE
 * @uses CONDITION_MISSING_EXTRATABLE
 * @param object $cm object
 * @param int $userid empty means current user
 * @return bool Success
 */
function coursemodule_visible_for_user($cm, $userid = 0)
{
    global $USER, $CFG;
    if (empty($cm->id)) {
        debugging("Incorrect course module parameter!", DEBUG_DEVELOPER);
        return false;
    }
    if (empty($userid)) {
        $userid = $USER->id;
    }
    if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id), $userid)) {
        return false;
    }
    if ($CFG->enableavailability) {
        require_once $CFG->libdir . '/conditionlib.php';
        $ci = new condition_info($cm, CONDITION_MISSING_EXTRATABLE);
        if (!$ci->is_available($cm->availableinfo, false, $userid) and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id), $userid)) {
            return false;
        }
    }
    return groups_course_module_visible($cm, $userid);
}
开发者ID:rosenclever,项目名称:moodle,代码行数:35,代码来源:datalib.php

示例3: array


//.........这里部分代码省略.........
        if (empty($mod->name)) {
            // something is wrong here
            continue;
        }
        // reconstruct minimalistic $cm
        $cm = new object();
        $cm->id = $mod->cm;
        $cm->instance = $mod->id;
        $cm->course = $course->id;
        $cm->modname = $mod->mod;
        $cm->name = urldecode($mod->name);
        $cm->visible = $mod->visible;
        $cm->sectionnum = $mod->section;
        $cm->groupmode = $mod->groupmode;
        $cm->groupingid = $mod->groupingid;
        $cm->groupmembersonly = $mod->groupmembersonly;
        $cm->indent = $mod->indent;
        $cm->completion = $mod->completion;
        $cm->extra = isset($mod->extra) ? urldecode($mod->extra) : '';
        $cm->icon = isset($mod->icon) ? $mod->icon : '';
        $cm->uservisible = true;
        if (!empty($CFG->enableavailability)) {
            // We must have completion information from modinfo. If it's not
            // there, cache needs rebuilding
            if (!isset($mod->availablefrom)) {
                debugging('enableavailability option was changed; rebuilding ' . 'cache for course ' . $course->id);
                rebuild_course_cache($course->id, true);
                // Re-enter this routine to do it all properly
                return get_fast_modinfo($course, $userid);
            }
            $cm->availablefrom = $mod->availablefrom;
            $cm->availableuntil = $mod->availableuntil;
            $cm->showavailability = $mod->showavailability;
            $cm->conditionscompletion = $mod->conditionscompletion;
            $cm->conditionsgrade = $mod->conditionsgrade;
        }
        // preload long names plurals and also check module is installed properly
        if (!isset($modlurals[$cm->modname])) {
            if (!file_exists("{$CFG->dirroot}/mod/{$cm->modname}/lib.php")) {
                continue;
            }
            $modlurals[$cm->modname] = get_string('modulenameplural', $cm->modname);
        }
        $cm->modplural = $modlurals[$cm->modname];
        $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
        if (!empty($CFG->enableavailability)) {
            // Unfortunately the next call really wants to call
            // get_fast_modinfo, but that would be recursive, so we fake up a
            // modinfo for it already
            if (empty($minimalmodinfo)) {
                $minimalmodinfo = new stdClass();
                $minimalmodinfo->cms = array();
                foreach ($info as $mod) {
                    $minimalcm = new stdClass();
                    $minimalcm->id = $mod->cm;
                    $minimalcm->name = urldecode($mod->name);
                    $minimalmodinfo->cms[$minimalcm->id] = $minimalcm;
                }
            }
            // Get availability information
            $ci = new condition_info($cm);
            $cm->available = $ci->is_available($cm->availableinfo, true, $userid, $minimalmodinfo);
        } else {
            $cm->available = true;
        }
        if ((!$cm->visible or !$cm->available) and !has_capability('moodle/course:viewhiddenactivities', $modcontext, $userid)) {
            $cm->uservisible = false;
        } else {
            if (!empty($CFG->enablegroupings) and !empty($cm->groupmembersonly) and !has_capability('moodle/site:accessallgroups', $modcontext, $userid)) {
                if (is_null($modinfo->groups)) {
                    $modinfo->groups = groups_get_user_groups($course->id, $userid);
                }
                if (empty($modinfo->groups[$cm->groupingid])) {
                    $cm->uservisible = false;
                }
            }
        }
        if (!isset($modinfo->instances[$cm->modname])) {
            $modinfo->instances[$cm->modname] = array();
        }
        $modinfo->instances[$cm->modname][$cm->instance] =& $cm;
        $modinfo->cms[$cm->id] =& $cm;
        // reconstruct sections
        if (!isset($modinfo->sections[$cm->sectionnum])) {
            $modinfo->sections[$cm->sectionnum] = array();
        }
        $modinfo->sections[$cm->sectionnum][] = $cm->id;
        unset($cm);
    }
    unset($cache[$course->id]);
    // prevent potential reference problems when switching users
    $cache[$course->id] = $modinfo;
    // Ensure cache does not use too much RAM
    if (count($cache) > MAX_MODINFO_CACHE_SIZE) {
        reset($cache);
        $key = key($cache);
        unset($cache[$key]);
    }
    return $cache[$course->id];
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:101,代码来源:moodlelib.php

示例4: obtain_dynamic_data

 /**
  * If dynamic data for this course-module is not yet available, gets it.
  *
  * This function is automatically called when constructing course_modinfo, so users don't
  * need to call it.
  *
  * Dynamic data is data which does not come directly from the cache but is calculated at
  * runtime based on the current user. Primarily this concerns whether the user can access
  * the module or not.
  *
  * As part of this function, the module's _cm_info_dynamic function from its lib.php will
  * be called (if it exists).
  * @return void
  */
 public function obtain_dynamic_data()
 {
     global $CFG;
     if ($this->state >= self::STATE_DYNAMIC) {
         return;
     }
     $userid = $this->modinfo->get_user_id();
     if (!empty($CFG->enableavailability)) {
         // Get availability information
         $ci = new condition_info($this);
         // Note that the modinfo currently available only includes minimal details (basic data)
         // so passing it to this function is a bit dangerous as it would cause infinite
         // recursion if it tried to get dynamic data, however we know that this function only
         // uses basic data.
         $this->available = $ci->is_available($this->availableinfo, true, $userid, $this->modinfo);
     } else {
         $this->available = true;
     }
     // Update visible state for current user
     $this->update_user_visible();
     // Let module make dynamic changes at this point
     $this->call_mod_function('cm_info_dynamic');
     $this->state = self::STATE_DYNAMIC;
 }
开发者ID:nigeldaley,项目名称:moodle,代码行数:38,代码来源:modinfolib.php

示例5: test_is_available

 /**
  * Tests the is_available function for modules. This does not test all the
  * conditions and stuff, because it only needs to check that the system
  * connects through to the real availability API. Also tests
  * get_full_information function.
  */
 public function test_is_available()
 {
     // Create course.
     $generator = $this->getDataGenerator();
     $course = $generator->create_course();
     // Create activity with no restrictions and one with date restriction.
     $page1 = $generator->get_plugin_generator('mod_page')->create_instance(array('course' => $course));
     $time = time() + 100;
     $avail = '{"op":"|","show":true,"c":[{"type":"date","d":">=","t":' . $time . '}]}';
     $page2 = $generator->get_plugin_generator('mod_page')->create_instance(array('course' => $course, 'availability' => $avail));
     // No conditions.
     $ci = new condition_info((object) array('id' => $page1->cmid), CONDITION_MISSING_EVERYTHING);
     $this->assertDebuggingCalled();
     $this->assertTrue($ci->is_available($text, false, 0));
     $this->assertDebuggingCalled();
     $this->assertEquals('', $text);
     // Date condition.
     $ci = new condition_info((object) array('id' => $page2->cmid), CONDITION_MISSING_EVERYTHING);
     $this->assertDebuggingCalled();
     $this->assertFalse($ci->is_available($text));
     $this->assertDebuggingCalled();
     $expectedtime = userdate($time, get_string('strftimedate', 'langconfig'));
     $this->assertContains($expectedtime, $text);
     // Full information display.
     $text = $ci->get_full_information();
     $this->assertDebuggingCalled();
     $expectedtime = userdate($time, get_string('strftimedate', 'langconfig'));
     $this->assertContains($expectedtime, $text);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:35,代码来源:conditionlib_test.php

示例6: array

 function test_is_available()
 {
     global $DB, $USER;
     $courseid = $this->make_course();
     // No conditions
     $cmid = $this->make_course_module($courseid);
     $ci = new condition_info((object) array('id' => $cmid), CONDITION_MISSING_EVERYTHING);
     $this->assertTrue($ci->is_available($text, false, 0));
     $this->assertEqual('', $text);
     // Time (from)
     $time = time() + 100;
     $cmid = $this->make_course_module($courseid, array('availablefrom' => $time));
     $ci = new condition_info((object) array('id' => $cmid), CONDITION_MISSING_EVERYTHING);
     $this->assertFalse($ci->is_available($text));
     $this->assert(new PatternExpectation('/' . preg_quote(userdate($time, get_string('strftimedate', 'langconfig'))) . '/'), $text);
     $time = time() - 100;
     $cmid = $this->make_course_module($courseid, array('availablefrom' => $time));
     $ci = new condition_info((object) array('id' => $cmid), CONDITION_MISSING_EVERYTHING);
     $this->assertTrue($ci->is_available($text));
     $this->assertEqual('', $text);
     $this->assert(new PatternExpectation('/' . preg_quote(userdate($time, get_string('strftimedate', 'langconfig'))) . '/'), $ci->get_full_information());
     // Time (until)
     $cmid = $this->make_course_module($courseid, array('availableuntil' => time() - 100));
     $ci = new condition_info((object) array('id' => $cmid), CONDITION_MISSING_EVERYTHING);
     $this->assertFalse($ci->is_available($text));
     $this->assertEqual('', $text);
     // Completion
     $oldid = $cmid;
     $cmid = $this->make_course_module($courseid);
     $this->make_section($courseid, array($oldid, $cmid));
     $oldcm = $DB->get_record('course_modules', array('id' => $oldid));
     $oldcm->completion = COMPLETION_TRACKING_MANUAL;
     $DB->update_record('course_modules', $oldcm);
     $ci = new condition_info((object) array('id' => $cmid), CONDITION_MISSING_EVERYTHING);
     $ci->add_completion_condition($oldid, COMPLETION_COMPLETE);
     $this->assertFalse($ci->is_available($text, false));
     $this->assertEqual(get_string('requires_completion_1', 'condition', 'xxx'), $text);
     $completion = new completion_info($DB->get_record('course', array('id' => $courseid)));
     $completion->update_state($oldcm, COMPLETION_COMPLETE);
     completion_info::wipe_session_cache();
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text));
     $this->assertFalse($ci->is_available($text, false, $USER->id + 1));
     completion_info::wipe_session_cache();
     condition_info::wipe_session_cache();
     $completion = new completion_info($DB->get_record('course', array('id' => $courseid)));
     $completion->update_state($oldcm, COMPLETION_INCOMPLETE);
     $this->assertFalse($ci->is_available($text));
     $ci->wipe_conditions();
     $ci->add_completion_condition($oldid, COMPLETION_INCOMPLETE);
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text));
     $this->assertTrue($ci->is_available($text, false, $USER->id + 1));
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text, true));
     // Grade
     $ci->wipe_conditions();
     // Add a fake grade item
     $gradeitemid = $DB->insert_record('grade_items', (object) array('courseid' => $courseid, 'itemname' => 'frog'));
     // Add a condition on a value existing...
     $ci->add_grade_condition($gradeitemid, null, null, true);
     $this->assertFalse($ci->is_available($text));
     $this->assertEqual(get_string('requires_grade_any', 'condition', 'frog'), $text);
     // Fake it existing
     $DB->insert_record('grade_grades', (object) array('itemid' => $gradeitemid, 'userid' => $USER->id, 'finalgrade' => 3.78));
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text));
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text, true));
     // Now require that user gets more than 3.78001
     $ci->wipe_conditions();
     $ci->add_grade_condition($gradeitemid, 3.78001, null, true);
     condition_info::wipe_session_cache();
     $this->assertFalse($ci->is_available($text));
     $this->assertEqual(get_string('requires_grade_min', 'condition', 'frog'), $text);
     // ...just on 3.78...
     $ci->wipe_conditions();
     $ci->add_grade_condition($gradeitemid, 3.78, null, true);
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text));
     // ...less than 3.78
     $ci->wipe_conditions();
     $ci->add_grade_condition($gradeitemid, null, 3.78, true);
     condition_info::wipe_session_cache();
     $this->assertFalse($ci->is_available($text));
     $this->assertEqual(get_string('requires_grade_max', 'condition', 'frog'), $text);
     // ...less than 3.78001
     $ci->wipe_conditions();
     $ci->add_grade_condition($gradeitemid, null, 3.78001, true);
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text));
     // ...in a range that includes it
     $ci->wipe_conditions();
     $ci->add_grade_condition($gradeitemid, 3, 4, true);
     condition_info::wipe_session_cache();
     $this->assertTrue($ci->is_available($text));
     // ...in a range that doesn't include it
     $ci->wipe_conditions();
     $ci->add_grade_condition($gradeitemid, 4, 5, true);
     condition_info::wipe_session_cache();
//.........这里部分代码省略.........
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:101,代码来源:testconditionlib.php

示例7: require_login


//.........这里部分代码省略.........
        }
    }
    /// groupmembersonly access control
    if (!empty($CFG->enablegroupings) and $cm and $cm->groupmembersonly and !has_capability('moodle/site:accessallgroups', get_context_instance(CONTEXT_MODULE, $cm->id))) {
        if (isguestuser() or !groups_has_membership($cm)) {
            print_error('groupmembersonlyerror', 'group', $CFG->wwwroot . '/course/view.php?id=' . $cm->course);
        }
    }
    // Fetch the course context, and prefetch its child contexts
    if (!isset($COURSE->context)) {
        if (!($COURSE->context = get_context_instance(CONTEXT_COURSE, $COURSE->id))) {
            print_error('nocontext');
        }
    }
    if (!empty($cm) && !isset($cm->context)) {
        if (!($cm->context = get_context_instance(CONTEXT_MODULE, $cm->id))) {
            print_error('nocontext');
        }
    }
    // Conditional activity access control
    if (!empty($CFG->enableavailability) and $cm) {
        // We cache conditional access in session
        if (!isset($SESSION->conditionaccessok)) {
            $SESSION->conditionaccessok = array();
        }
        // If you have been allowed into the module once then you are allowed
        // in for rest of session, no need to do conditional checks
        if (!array_key_exists($cm->id, $SESSION->conditionaccessok)) {
            // Get condition info (does a query for the availability table)
            require_once $CFG->libdir . '/conditionlib.php';
            $ci = new condition_info($cm, CONDITION_MISSING_EXTRATABLE);
            // Check condition for user (this will do a query if the availability
            // information depends on grade or completion information)
            if ($ci->is_available($junk) || has_capability('moodle/course:viewhiddenactivities', $cm->context)) {
                $SESSION->conditionaccessok[$cm->id] = true;
            } else {
                print_error('activityiscurrentlyhidden');
            }
        }
    }
    if ($COURSE->id == SITEID) {
        /// Eliminate hidden site activities straight away
        if (!empty($cm) && !$cm->visible && !has_capability('moodle/course:viewhiddenactivities', $cm->context)) {
            redirect($CFG->wwwroot, get_string('activityiscurrentlyhidden'));
        }
        user_accesstime_log($COURSE->id);
        /// Access granted, update lastaccess times
        return;
    } else {
        /// Check if the user can be in a particular course
        if (empty($USER->access['rsw'][$COURSE->context->path])) {
            //
            // MDL-13900 - If the course or the parent category are hidden
            // and the user hasn't the 'course:viewhiddencourses' capability, prevent access
            //
            if (!($COURSE->visible && course_parent_visible($COURSE)) && !has_capability('moodle/course:viewhiddencourses', $COURSE->context)) {
                print_header_simple();
                notice(get_string('coursehidden'), $CFG->wwwroot . '/');
            }
        }
        /// Non-guests who don't currently have access, check if they can be allowed in as a guest
        if ($USER->username != 'guest' and !has_capability('moodle/course:view', $COURSE->context)) {
            if ($COURSE->guest == 1) {
                // Temporarily assign them guest role for this context, if it fails later user is asked to enrol
                $USER->access = load_temp_role($COURSE->context, $CFG->guestroleid, $USER->access);
            }
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:67,代码来源:moodlelib.php

示例8: can_be_subscribed

 /**
  * Checks whether a user can be subscribed to the forum, regardless of
  * subscription option. Includes a variety of other checks. [These are
  * supposed to be the same as checks done when building the list of people
  * for email.]
  * @param int $userid User ID or 0 for current
  * @return bool True if user can be subscribed
  */
 private function can_be_subscribed($userid = 0)
 {
     global $USER;
     $userid = mod_forumng_utils::get_real_userid($userid);
     $cm = $this->get_course_module();
     $course = $this->get_course();
     $context = $this->get_context();
     // Guests cannot subscribe
     if (!isloggedin() || isguestuser($userid)) {
         return false;
     }
     // Get from cache if possible
     if (!isset($this->cache->can_be_subscribed)) {
         $this->cache->can_be_subscribed = array();
     }
     if (array_key_exists($userid, $this->cache->can_be_subscribed)) {
         return $this->cache->can_be_subscribed[$userid];
     }
     // This is not a loop, just so I can use break
     do {
         // Check user can see forum
         if (!has_capability('mod/forumng:viewdiscussion', $context, $userid)) {
             $result = false;
             break;
         }
         // For current user, can take shortcut
         if ($userid == $USER->id) {
             if (empty($cm->uservisible)) {
                 $uservisible = false;
             } else {
                 $uservisible = true;
             }
             if (!$uservisible) {
                 $result = false;
                 break;
             }
         } else {
             $visible = $cm->visible;
             // Note: It is pretty terrible that this code is placed here.
             // Shouldn't there be a function in cm_info to do this? :(
             // Unfortunately I didn't think of that when redesigning
             // cm_info, it can only work for current user.
             $conditioninfo = new condition_info($cm);
             $visible = $visible && $conditioninfo->is_available($crap, false, $userid);
             if (!$visible && !has_capability('moodle/site:viewhiddenactivities', $context, $userid)) {
                 $result = false;
                 break;
             }
             if ($cm->groupmembersonly && !has_capability('moodle/site:accessallgroups', $context, $userid)) {
                 // If the forum is restricted to group members only, then
                 // limit it to people within groups on the course - or
                 // groups in the grouping, if one is selected
                 $groupobjs = groups_get_all_groups($course->id, $userid, $cm->groupingid, 'g.id');
                 if (!$groupobjs || count($groupobjs) == 0) {
                     $result = false;
                     break;
                 }
             }
         }
         $result = true;
         break;
     } while (false);
     $this->cache->can_be_subscribed[$userid] = $result;
     return $result;
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:73,代码来源:mod_forumng.php

示例9: get_fast_modinfo

 /**
  * Created to accomodate forumng on shared activities
  * where the shared activites course does not hold cm information
  * in the course table's modinfo field
  * @param $course
  * @param $cmid
  * @return $modinfo
  */
 private function get_fast_modinfo($course, $cmid)
 {
     global $CFG;
     if (class_exists('ouflags')) {
         require_once $CFG->dirroot . '/course/format/sharedactv/sharedactv.php';
         if (sharedactv_is_magic_course($course)) {
             // get_fast_modinfo will only ever return a minimal object, so build own
             $modinfo = new object();
             $modinfo->courseid = $course->id;
             $modinfo->userid = 0;
             $modinfo->sections = array();
             $modinfo->instances = array();
             $modinfo->groups = null;
             if (!($cm = get_coursemodule_from_id('forumng', $cmid, $course->id))) {
                 throw new forum_exception('Could not find the forum course module.');
             }
             if (!empty($CFG->enableavailability)) {
                 $cm->conditionscompletion = array();
                 $cm->conditionsgrade = array();
                 // Unfortunately the next call really wants to call
                 // get_fast_modinfo, but that would be recursive, so we fake up a
                 // modinfo for it already
                 if (empty($minimalmodinfo)) {
                     $minimalmodinfo = new stdClass();
                     $minimalmodinfo->cms = array();
                     $minimalcm = new stdClass();
                     $minimalcm->id = $cmid;
                     $minimalcm->name = 'forumng';
                     $minimalmodinfo->cms[$cmid] = $minimalcm;
                 }
                 // Get availability information
                 $ci = new condition_info($cm);
                 $cm->available = $ci->is_available($cm->availableinfo, true, 0, $minimalmodinfo);
             } else {
                 $cm->available = true;
             }
             $cm->uservisible = true;
             $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
             if ((!$cm->visible or !$cm->available) and !has_capability('moodle/course:viewhiddenactivities', $modcontext, 0)) {
                 $cm->uservisible = false;
             } else {
                 if (!empty($CFG->enablegroupings) and !empty($cm->groupmembersonly) and !has_capability('moodle/site:accessallgroups', $modcontext, 0)) {
                     if (is_null($modinfo->groups)) {
                         $modinfo->groups = groups_get_user_groups($course->id, 0);
                     }
                     if (empty($modinfo->groups[$cm->groupingid])) {
                         $cm->uservisible = false;
                     }
                 }
             }
             $modinfo->cms = array($cmid => $cm);
         } else {
             $modinfo = get_fast_modinfo($course);
         }
     } else {
         $modinfo = get_fast_modinfo($course);
     }
     return $modinfo;
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:67,代码来源:forum.php


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