diff --git a/course/view.php b/course/view.php index ecf7fa4ed9bf3..ff29d5ba103f9 100644 --- a/course/view.php +++ b/course/view.php @@ -304,6 +304,20 @@ } $PAGE->set_heading($course->fullname); + +// Get information about course modules and existing module types. +// format.php in course formats may rely on presence of these variables. +$modinfo = get_fast_modinfo($course); +$modnames = get_module_types_names(); +$modnamesplural = get_module_types_names(true); +$modnamesused = $modinfo->get_used_module_names(); +$mods = $modinfo->get_cms(); +$sections = $modinfo->get_section_info_all(); + +// Include course AJAX. This should be done before starting the UI +// to allow page header, blocks, or drawers use the course editor. +include_course_ajax($course, $modnamesused); + echo $OUTPUT->header(); // Show communication room status notification. @@ -327,23 +341,11 @@ // Make sure that section 0 exists (this function will create one if it is missing). course_create_sections_if_missing($course, 0); -// Get information about course modules and existing module types. -// format.php in course formats may rely on presence of these variables. -$modinfo = get_fast_modinfo($course); -$modnames = get_module_types_names(); -$modnamesplural = get_module_types_names(true); -$modnamesused = $modinfo->get_used_module_names(); -$mods = $modinfo->get_cms(); -$sections = $modinfo->get_section_info_all(); - // CAUTION, hacky fundamental variable defintion to follow! // Note that because of the way course fromats are constructed though // inclusion we pass parameters around this way. $displaysection = $section; -// Include course AJAX. -include_course_ajax($course, $modnamesused); - // Include the actual course format. require($CFG->dirroot .'/course/format/'. $course->format .'/format.php'); // Content wrapper end.