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


PHP condition_info::fill_availability_conditions方法代码示例

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


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

示例1: get_array_of_activities

/**
 * For a given course, returns an array of course activity objects
 * Each item in the array contains he following properties:
 */
function get_array_of_activities($courseid)
{
    //  cm - course module id
    //  mod - name of the module (eg forum)
    //  section - the number of the section (eg week or topic)
    //  name - the name of the instance
    //  visible - is the instance visible or not
    //  groupingid - grouping id
    //  groupmembersonly - is this instance visible to group members only
    //  extra - contains extra string to include in any link
    global $CFG, $DB;
    if (!empty($CFG->enableavailability)) {
        require_once $CFG->libdir . '/conditionlib.php';
    }
    $course = $DB->get_record('course', array('id' => $courseid));
    if (empty($course)) {
        throw new moodle_exception('courseidnotfound');
    }
    $mod = array();
    $rawmods = get_course_mods($courseid);
    if (empty($rawmods)) {
        return $mod;
        // always return array
    }
    if ($sections = $DB->get_records("course_sections", array("course" => $courseid), "section ASC")) {
        foreach ($sections as $section) {
            if (!empty($section->sequence)) {
                $sequence = explode(",", $section->sequence);
                foreach ($sequence as $seq) {
                    if (empty($rawmods[$seq])) {
                        continue;
                    }
                    $mod[$seq]->id = $rawmods[$seq]->instance;
                    $mod[$seq]->cm = $rawmods[$seq]->id;
                    $mod[$seq]->mod = $rawmods[$seq]->modname;
                    $mod[$seq]->section = $section->section;
                    $mod[$seq]->idnumber = $rawmods[$seq]->idnumber;
                    $mod[$seq]->visible = $rawmods[$seq]->visible;
                    $mod[$seq]->groupmode = $rawmods[$seq]->groupmode;
                    $mod[$seq]->groupingid = $rawmods[$seq]->groupingid;
                    $mod[$seq]->groupmembersonly = $rawmods[$seq]->groupmembersonly;
                    $mod[$seq]->indent = $rawmods[$seq]->indent;
                    $mod[$seq]->completion = $rawmods[$seq]->completion;
                    $mod[$seq]->extra = "";
                    if (!empty($CFG->enableavailability)) {
                        condition_info::fill_availability_conditions($rawmods[$seq]);
                        $mod[$seq]->availablefrom = $rawmods[$seq]->availablefrom;
                        $mod[$seq]->availableuntil = $rawmods[$seq]->availableuntil;
                        $mod[$seq]->showavailability = $rawmods[$seq]->showavailability;
                        $mod[$seq]->conditionscompletion = $rawmods[$seq]->conditionscompletion;
                        $mod[$seq]->conditionsgrade = $rawmods[$seq]->conditionsgrade;
                    }
                    $modname = $mod[$seq]->mod;
                    $functionname = $modname . "_get_coursemodule_info";
                    if (!file_exists("{$CFG->dirroot}/mod/{$modname}/lib.php")) {
                        continue;
                    }
                    include_once "{$CFG->dirroot}/mod/{$modname}/lib.php";
                    if (function_exists($functionname)) {
                        if ($info = $functionname($rawmods[$seq])) {
                            if (!empty($info->icon)) {
                                $mod[$seq]->icon = $info->icon;
                            }
                            if (!empty($info->iconcomponent)) {
                                $mod[$seq]->iconcomponent = $info->iconcomponent;
                            }
                            if (!empty($info->name)) {
                                $mod[$seq]->name = $info->name;
                            }
                            if ($info instanceof cached_cm_info) {
                                // When using cached_cm_info you can include three new fields
                                // that aren't available for legacy code
                                if (!empty($info->content)) {
                                    $mod[$seq]->content = $info->content;
                                }
                                if (!empty($info->extraclasses)) {
                                    $mod[$seq]->extraclasses = $info->extraclasses;
                                }
                                if (!empty($info->onclick)) {
                                    $mod[$seq]->onclick = $info->onclick;
                                }
                                if (!empty($info->customdata)) {
                                    $mod[$seq]->customdata = $info->customdata;
                                }
                            } else {
                                // When using a stdclass, the (horrible) deprecated ->extra field
                                // is available for BC
                                if (!empty($info->extra)) {
                                    $mod[$seq]->extra = $info->extra;
                                }
                            }
                        }
                    }
                    if (!isset($mod[$seq]->name)) {
                        $mod[$seq]->name = $DB->get_field($rawmods[$seq]->modname, "name", array("id" => $rawmods[$seq]->instance));
                    }
//.........这里部分代码省略.........
开发者ID:hitphp,项目名称:moodle,代码行数:101,代码来源:lib.php

示例2: get_array_of_activities

/**
 * For a given course, returns an array of course activity objects
 * Each item in the array contains he following properties:
 */
function get_array_of_activities($courseid)
{
    //  cm - course module id
    //  mod - name of the module (eg forum)
    //  section - the number of the section (eg week or topic)
    //  name - the name of the instance
    //  visible - is the instance visible or not
    //  groupingid - grouping id
    //  groupmembersonly - is this instance visible to group members only
    //  extra - contains extra string to include in any link
    global $CFG, $DB;
    if (!empty($CFG->enableavailability)) {
        require_once $CFG->libdir . '/conditionlib.php';
    }
    $course = $DB->get_record('course', array('id' => $courseid));
    if (empty($course)) {
        throw new moodle_exception('courseidnotfound');
    }
    $mod = array();
    $rawmods = get_course_mods($courseid);
    if (empty($rawmods)) {
        return $mod;
        // always return array
    }
    if ($sections = $DB->get_records("course_sections", array("course" => $courseid), "section ASC")) {
        foreach ($sections as $section) {
            if (!empty($section->sequence)) {
                $sequence = explode(",", $section->sequence);
                foreach ($sequence as $seq) {
                    if (empty($rawmods[$seq])) {
                        continue;
                    }
                    $mod[$seq] = new stdClass();
                    $mod[$seq]->id = $rawmods[$seq]->instance;
                    $mod[$seq]->cm = $rawmods[$seq]->id;
                    $mod[$seq]->mod = $rawmods[$seq]->modname;
                    // Oh dear. Inconsistent names left here for backward compatibility.
                    $mod[$seq]->section = $section->section;
                    $mod[$seq]->sectionid = $rawmods[$seq]->section;
                    $mod[$seq]->module = $rawmods[$seq]->module;
                    $mod[$seq]->added = $rawmods[$seq]->added;
                    $mod[$seq]->score = $rawmods[$seq]->score;
                    $mod[$seq]->idnumber = $rawmods[$seq]->idnumber;
                    $mod[$seq]->visible = $rawmods[$seq]->visible;
                    $mod[$seq]->visibleold = $rawmods[$seq]->visibleold;
                    $mod[$seq]->groupmode = $rawmods[$seq]->groupmode;
                    $mod[$seq]->groupingid = $rawmods[$seq]->groupingid;
                    $mod[$seq]->groupmembersonly = $rawmods[$seq]->groupmembersonly;
                    $mod[$seq]->indent = $rawmods[$seq]->indent;
                    $mod[$seq]->completion = $rawmods[$seq]->completion;
                    $mod[$seq]->extra = "";
                    $mod[$seq]->completiongradeitemnumber = $rawmods[$seq]->completiongradeitemnumber;
                    $mod[$seq]->completionview = $rawmods[$seq]->completionview;
                    $mod[$seq]->completionexpected = $rawmods[$seq]->completionexpected;
                    $mod[$seq]->availablefrom = $rawmods[$seq]->availablefrom;
                    $mod[$seq]->availableuntil = $rawmods[$seq]->availableuntil;
                    $mod[$seq]->showavailability = $rawmods[$seq]->showavailability;
                    $mod[$seq]->showdescription = $rawmods[$seq]->showdescription;
                    if (!empty($CFG->enableavailability)) {
                        condition_info::fill_availability_conditions($rawmods[$seq]);
                        $mod[$seq]->conditionscompletion = $rawmods[$seq]->conditionscompletion;
                        $mod[$seq]->conditionsgrade = $rawmods[$seq]->conditionsgrade;
                    }
                    $modname = $mod[$seq]->mod;
                    $functionname = $modname . "_get_coursemodule_info";
                    if (!file_exists("{$CFG->dirroot}/mod/{$modname}/lib.php")) {
                        continue;
                    }
                    include_once "{$CFG->dirroot}/mod/{$modname}/lib.php";
                    if ($hasfunction = function_exists($functionname)) {
                        if ($info = $functionname($rawmods[$seq])) {
                            if (!empty($info->icon)) {
                                $mod[$seq]->icon = $info->icon;
                            }
                            if (!empty($info->iconcomponent)) {
                                $mod[$seq]->iconcomponent = $info->iconcomponent;
                            }
                            if (!empty($info->name)) {
                                $mod[$seq]->name = $info->name;
                            }
                            if ($info instanceof cached_cm_info) {
                                // When using cached_cm_info you can include three new fields
                                // that aren't available for legacy code
                                if (!empty($info->content)) {
                                    $mod[$seq]->content = $info->content;
                                }
                                if (!empty($info->extraclasses)) {
                                    $mod[$seq]->extraclasses = $info->extraclasses;
                                }
                                if (!empty($info->iconurl)) {
                                    $mod[$seq]->iconurl = $info->iconurl;
                                }
                                if (!empty($info->onclick)) {
                                    $mod[$seq]->onclick = $info->onclick;
                                }
                                if (!empty($info->customdata)) {
//.........这里部分代码省略.........
开发者ID:numbas,项目名称:moodle,代码行数:101,代码来源:lib.php

示例3: get_array_of_activities

/**
 * For a given course, returns an array of course activity objects
 * Each item in the array contains he following properties:
 */
function get_array_of_activities($courseid)
{
    //  cm - course module id
    //  mod - name of the module (eg forum)
    //  section - the number of the section (eg week or topic)
    //  name - the name of the instance
    //  visible - is the instance visible or not
    //  groupingid - grouping id
    //  groupmembersonly - is this instance visible to group members only
    //  extra - contains extra string to include in any link
    global $CFG, $DB;
    if (!empty($CFG->enableavailability)) {
        require_once $CFG->libdir . '/conditionlib.php';
    }
    $course = $DB->get_record('course', array('id' => $courseid));
    if (empty($course)) {
        throw new moodle_exception('courseidnotfound');
    }
    $mod = array();
    $rawmods = get_course_mods($courseid);
    if (empty($rawmods)) {
        return $mod;
        // always return array
    }
    if ($sections = $DB->get_records("course_sections", array("course" => $courseid), "section ASC")) {
        foreach ($sections as $section) {
            if (!empty($section->sequence)) {
                $sequence = explode(",", $section->sequence);
                foreach ($sequence as $seq) {
                    if (empty($rawmods[$seq])) {
                        continue;
                    }
                    $mod[$seq]->id = $rawmods[$seq]->instance;
                    $mod[$seq]->cm = $rawmods[$seq]->id;
                    $mod[$seq]->mod = $rawmods[$seq]->modname;
                    $mod[$seq]->section = $section->section;
                    $mod[$seq]->idnumber = $rawmods[$seq]->idnumber;
                    $mod[$seq]->visible = $rawmods[$seq]->visible;
                    $mod[$seq]->groupmode = $rawmods[$seq]->groupmode;
                    $mod[$seq]->groupingid = $rawmods[$seq]->groupingid;
                    $mod[$seq]->groupmembersonly = $rawmods[$seq]->groupmembersonly;
                    $mod[$seq]->indent = $rawmods[$seq]->indent;
                    $mod[$seq]->completion = $rawmods[$seq]->completion;
                    $mod[$seq]->extra = "";
                    if (!empty($CFG->enableavailability)) {
                        condition_info::fill_availability_conditions($rawmods[$seq]);
                        $mod[$seq]->availablefrom = $rawmods[$seq]->availablefrom;
                        $mod[$seq]->availableuntil = $rawmods[$seq]->availableuntil;
                        $mod[$seq]->showavailability = $rawmods[$seq]->showavailability;
                        $mod[$seq]->conditionscompletion = $rawmods[$seq]->conditionscompletion;
                        $mod[$seq]->conditionsgrade = $rawmods[$seq]->conditionsgrade;
                    }
                    $modname = $mod[$seq]->mod;
                    $functionname = $modname . "_get_coursemodule_info";
                    if (!file_exists("{$CFG->dirroot}/mod/{$modname}/lib.php")) {
                        continue;
                    }
                    include_once "{$CFG->dirroot}/mod/{$modname}/lib.php";
                    if (function_exists($functionname)) {
                        if ($info = $functionname($rawmods[$seq])) {
                            if (!empty($info->extra)) {
                                $mod[$seq]->extra = $info->extra;
                            }
                            if (!empty($info->icon)) {
                                $mod[$seq]->icon = $info->icon;
                            }
                            if (!empty($info->iconcomponent)) {
                                $mod[$seq]->iconcomponent = $info->iconcomponent;
                            }
                            if (!empty($info->name)) {
                                $mod[$seq]->name = $info->name;
                            }
                        }
                    }
                    if (!isset($mod[$seq]->name)) {
                        $mod[$seq]->name = $DB->get_field($rawmods[$seq]->modname, "name", array("id" => $rawmods[$seq]->instance));
                    }
                }
            }
        }
    }
    return $mod;
}
开发者ID:vuchannguyen,项目名称:web,代码行数:87,代码来源:lib.php


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