Index: course/lib.php =================================================================== --- course/lib.php (revision 14710) +++ course/lib.php (working copy) @@ -3624,6 +3624,29 @@ } /** + * Allow the format to set it's own page layout + * + * @param string $format Course format ID e.g. 'weeks' $course->format + * @param moodle_page $page The page to manipulate + * @return void + */ +function course_format_set_pagelayout($format, moodle_page $page) { + global $CFG; + + $featurefile = $CFG->dirroot.'/course/format/'.$format.'/lib.php'; + $featurefunction = 'callback_'.$format.'_set_pagelayout'; + if (!function_exists($featurefunction) && file_exists($featurefile)) { + require_once $featurefile; + } + if (function_exists($featurefunction)) { + $featurefunction($page); + } else { + // Default behavior + $page->set_pagelayout('course'); + } +} + +/** * Returns the information about the ajax support in the given source format * * The returned object's property (boolean)capable indicates that Index: course/view.php =================================================================== --- course/view.php (revision 14710) +++ course/view.php (working copy) @@ -92,7 +92,7 @@ $course->format = 'weeks'; // Default format is weeks } - $PAGE->set_pagelayout('course'); + course_format_set_pagelayout($course->format, $PAGE); $PAGE->set_pagetype('course-view-' . $course->format); $PAGE->set_other_editing_capability('moodle/course:manageactivities');