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


PHP course_modinfo::get_section_info_all方法代码示例

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


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

示例1: get_activity_tree

/**
 * get_activity_tree :: course_modinfo -> integer -> context -> array
 * @param \course_modinfo $modinfo
 * @param integer $section_number
 * @param \context $context
 * @return array
 */
function get_activity_tree(\course_modinfo $modinfo, $section_number, \context $context)
{
    $completion_info = new \completion_info($modinfo->get_course());
    return F\map(F\filter($modinfo->get_section_info_all(), function (\section_info $section_info) {
        return $section_info->visible;
    }), function (\section_info $section_info) use($completion_info, $section_number, $context) {
        $mods = F\map(F\filter($section_info->modinfo->cms, function (\cm_info $cm_info) use($section_info) {
            global $CFG;
            return ($cm_info->uservisible || $CFG->enableavailability && !empty($cm_info->availableinfo)) && (int) $cm_info->sectionnum === (int) $section_info->section;
        }), function (\cm_info $cm_info) use($completion_info, $context) {
            global $CFG;
            $canComplete = $CFG->enablecompletion && isloggedin() && !isguestuser() && (int) $completion_info->is_enabled($cm_info) === COMPLETION_TRACKING_MANUAL;
            $hasCompleted = false;
            if ($canComplete) {
                $completion_data = $completion_info->get_data($cm_info, true);
                $hasCompleted = F\contains([COMPLETION_COMPLETE, COMPLETION_COMPLETE_PASS], (int) $completion_data->completionstate);
            }
            return (object) ['id' => (int) $cm_info->id, 'name' => $cm_info->name, 'modname' => $cm_info->modname, 'current' => is_current_mod($cm_info, $context), 'available' => $cm_info->available, 'canComplete' => $canComplete, 'hasCompleted' => $hasCompleted];
        });
        return (object) ['id' => (int) $section_info->id, 'section' => (int) $section_info->section, 'name' => \get_section_name($section_info->modinfo->courseid, $section_info->section), 'current' => is_current_section($section_info, $section_number, $context), 'activities' => array_values($mods)];
    });
}
开发者ID:robologo3000,项目名称:block-activity-tree,代码行数:29,代码来源:lib.php

示例2: getChildren

 /**
  * Returns the LOId of the sections (not empty, with a summary or with cms) of a course
  * @param course_modinfo $rawData : course_modinfo object
  * @return \intuitel\LOId : array with LOID of children
  */
 private function getChildren($rawData)
 {
     $sections = $rawData->get_section_info_all();
     $hasChildren = array();
     foreach ($sections as $section) {
         $sectionFactory = new SectionLOFactory();
         $sectionLO = $sectionFactory->createLOFromNative($section);
         if ($sectionLO != null) {
             //empty section: no name or summary
             $sectionLOid = $sectionLO->getloId();
             $hasChildren[] = $sectionLOid;
         }
     }
     return $hasChildren;
 }
开发者ID:juacas,项目名称:moodle-block_intuitel,代码行数:20,代码来源:CourseLOFactory.php


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