本文整理匯總了PHP中course_modinfo::get_course方法的典型用法代碼示例。如果您正苦於以下問題:PHP course_modinfo::get_course方法的具體用法?PHP course_modinfo::get_course怎麽用?PHP course_modinfo::get_course使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類course_modinfo
的用法示例。
在下文中一共展示了course_modinfo::get_course方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createLOFromNative
/**
* From a moodle course_modinfo object, it creates an intuitel LO
* @author elever
* @see \intuitel\LOFactory::createLOFromNative()
* @param \course_modinfo $rawData : moodle course_modinfo object
* @return CourseLO $course : intuitelLO course object
*/
function createLOFromNative($rawData)
{
$lmscourse = $rawData->get_course();
$courseLoid = Intuitel::getIDFactory()->getLoIdfromId('course', $lmscourse->id);
// course object is created, constructor sets the compulsory attributes: LOId, loName, hasPrecedingSib, hasParent; and the optional: hasFollowingSib
$course = new CourseLO($courseLoid, $lmscourse->fullname, null, null);
// optional attributes
$courseLang = $this->getLang($rawData);
$course->setLang($courseLang);
$childrenLoId = $this->getChildren($rawData);
$course->sethasChildren($childrenLoId);
return $course;
}
示例2: 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)];
});
}
示例3: getIterator
/**
* Implementation of IteratorAggregate::getIterator(), allows to cycle through properties
* and use {@link convert_to_array()}
*
* @return ArrayIterator
*/
public function getIterator() {
$ret = array();
foreach (get_object_vars($this) as $key => $value) {
if (substr($key, 0, 1) == '_') {
if (method_exists($this, 'get'.$key)) {
$ret[substr($key, 1)] = $this->{'get'.$key}();
} else {
$ret[substr($key, 1)] = $this->$key;
}
}
}
$ret['sequence'] = $this->get_sequence();
$ret['course'] = $this->get_course();
$ret = array_merge($ret, course_get_format($this->modinfo->get_course())->get_format_options($this->_section));
return new ArrayIterator($ret);
}
示例4: get_course
/**
* @return object Moodle course object that was used to construct this data
*/
public function get_course()
{
return $this->modinfo->get_course();
}
示例5: block_intuitel_get_course_lang
/**
* Retrieves the forced language of the course of null if not forced language.
* @param course_modinfo $course_info : course_modinfo object of the course
* @return string|NULL $lang: forced language of the course or null if not language is forced
*/
function block_intuitel_get_course_lang($course_info)
{
$course = $course_info->get_course();
if ($course->lang != null) {
$lang = block_intuitel_get_parent_lang($course->lang);
} else {
$lang = null;
}
return $lang;
}