本文整理汇总了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)];
});
}
示例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;
}