Merge branch 'wip-MDL-37206-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
+14
-4
@@ -117,15 +117,25 @@
|
||||
}
|
||||
add_to_log($course->id, 'course', $loglabel, "view.php?". $logparam, $infoid);
|
||||
|
||||
$course->format = clean_param($course->format, PARAM_ALPHA);
|
||||
if (!file_exists($CFG->dirroot.'/course/format/'.$course->format.'/format.php')) {
|
||||
$course->format = 'weeks'; // Default format is weeks
|
||||
}
|
||||
// Fix course format if it is no longer installed
|
||||
$course->format = course_get_format($course)->get_format();
|
||||
|
||||
$PAGE->set_pagelayout('course');
|
||||
$PAGE->set_pagetype('course-view-' . $course->format);
|
||||
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
||||
|
||||
// Preload course format renderer before output starts.
|
||||
// This is a little hacky but necessary since
|
||||
// format.php is not included until after output starts
|
||||
if (file_exists($CFG->dirroot.'/course/format/'.$course->format.'/renderer.php')) {
|
||||
require_once($CFG->dirroot.'/course/format/'.$course->format.'/renderer.php');
|
||||
if (class_exists('format_'.$course->format.'_renderer')) {
|
||||
// call get_renderer only if renderer is defined in format plugin
|
||||
// otherwise an exception would be thrown
|
||||
$PAGE->get_renderer('format_'. $course->format);
|
||||
}
|
||||
}
|
||||
|
||||
if ($reset_user_allowed_editing) {
|
||||
// ugly hack
|
||||
unset($PAGE->_user_allowed_editing);
|
||||
|
||||
Reference in New Issue
Block a user