$module['afterlink'] = $cm->afterlink;
$module['customdata'] = json_encode($cm->customdata);
$module['completion'] = $cm->completion;
+ $module['noviewlink'] = plugin_supports('mod', $cm->modname, FEATURE_NO_VIEW_LINK, false);
// Check module completion.
$completion = $completioninfo->is_enabled($cm);
);
}
- if (!empty($cm->showdescription) or $cm->modname == 'label') {
+ if (!empty($cm->showdescription) or $module['noviewlink']) {
// We want to use the external format. However from reading get_formatted_content(), $cm->content format is always FORMAT_HTML.
$options = array('noclean' => true);
list($module['description'], $descriptionformat) = external_format_text($cm->content,
'afterlink' => new external_value(PARAM_RAW, 'After link info to be displayed.',
VALUE_OPTIONAL),
'customdata' => new external_value(PARAM_RAW, 'Custom data (JSON encoded).', VALUE_OPTIONAL),
- 'noviewlink' => new external_value(PARAM_BOOL, 'Whether the module does link to
- a new page.', VALUE_OPTIONAL),
++ 'noviewlink' => new external_value(PARAM_BOOL, 'Whether the module has no view page',
++ VALUE_OPTIONAL),
'completion' => new external_value(PARAM_INT, 'Type of completion tracking:
0 means none, 1 manual, 2 automatic.', VALUE_OPTIONAL),
'completiondata' => new external_single_structure(
$sort = $params['sort'];
switch($classification) {
+ case COURSE_TIMELINE_ALLINCLUDINGHIDDEN:
+ break;
case COURSE_TIMELINE_ALL:
break;
case COURSE_TIMELINE_PAST:
$hiddencourses = get_hidden_courses_on_timeline();
$courses = [];
- // If the timeline requires the hidden courses then restrict the result to only $hiddencourses else exclude.
- if ($classification == COURSE_TIMELINE_HIDDEN) {
+ // If the timeline requires really all courses, get really all courses.
+ if ($classification == COURSE_TIMELINE_ALLINCLUDINGHIDDEN) {
+ $courses = course_get_enrolled_courses_for_logged_in_user(0, $offset, $sort, $fields, COURSE_DB_QUERY_LIMIT);
+
+ // Otherwise if the timeline requires the hidden courses then restrict the result to only $hiddencourses.
+ } else if ($classification == COURSE_TIMELINE_HIDDEN) {
$courses = course_get_enrolled_courses_for_logged_in_user(0, $offset, $sort, $fields,
COURSE_DB_QUERY_LIMIT, $hiddencourses);
+
+ // Otherwise get the requested courses and exclude the hidden courses.
} else {
$courses = course_get_enrolled_courses_for_logged_in_user(0, $offset, $sort, $fields,
COURSE_DB_QUERY_LIMIT, [], $hiddencourses);