This is a course format independent url param and replaces weekly/topic specific params.
By using a standardised param we are able to use this url consistenly across the codebase
and reduce the risk of param collision
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/completionlib.php');
-$displaysection = optional_param('topic', 0, PARAM_INT);
+// Horrible backwards compatible parameter aliasing
+if ($topic = optional_param('topic', 0, PARAM_INT)) {
+ $url = $PAGE->url;
+ $url->param('section', $topic);
+ debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
+ redirect($url);
+}
+// End backwards-compatible aliasing..
$context = get_context_instance(CONTEXT_COURSE, $course->id);
require_once($CFG->libdir.'/filelib.php');
require_once($CFG->libdir.'/completionlib.php');
- $displaysection = optional_param('week', 0, PARAM_INT);
-
$streditsummary = get_string('editsummary');
$stradd = get_string('add');
$stractivities = get_string('activities');
$strmovedown = get_string('movedown');
}
+ // Horrible backwards compatible parameter aliasing
+ if ($week = optional_param('week', 0, PARAM_INT)) {
+ $url = $PAGE->url;
+ $url->param('section', $week);
+ debugging('Outdated week param passed to course/view.php', DEBUG_DEVELOPER);
+ redirect($url);
+ }
+ // End backwards-compatible aliasing..
+
$context = get_context_instance(CONTEXT_COURSE, $course->id);
//Print the Your progress icon if the track completion is enabled
$course = $DB->get_record('course', $params, '*', MUST_EXIST);
- $PAGE->set_url('/course/view.php', array('id' => $course->id)); // Defined here to avoid notices on errors etc
+ $urlparams = array('id' => $course->id);
+ if ($section) {
+ $urlparams['section'] = $section;
+ }
+
+ $PAGE->set_url('/course/view.php', $urlparams); // Defined here to avoid notices on errors etc
preload_course_contexts($course->id);
$context = context_course::instance($course->id, MUST_EXIST);
require_once($CFG->dirroot.'/calendar/lib.php'); /// This is after login because it needs $USER
+ //TODO: danp do we need different urls?
add_to_log($course->id, 'course', 'view', "view.php?id=$course->id", "$course->id");
$course->format = clean_param($course->format, PARAM_ALPHA);
$USER->editing = 0;
}
- $SESSION->fromdiscussion = $CFG->wwwroot .'/course/view.php?id='. $course->id;
+ $SESSION->fromdiscussion = $PAGE->url->out(false);
if ($course->id == SITEID) {
}
}
+ // 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 the actual course format.
require($CFG->dirroot .'/course/format/'. $course->format .'/format.php');
// Content wrapper end.