MDL-35276 fix redirect to course/section pages

This commit is contained in:
Marina Glancy
2012-09-26 10:58:03 +08:00
parent c366bea3cf
commit 583c0cf67f
6 changed files with 72 additions and 68 deletions
+3 -3
View File
@@ -35,7 +35,7 @@ $add = optional_param('add', '', PARAM_ALPHA); // module name
$update = optional_param('update', 0, PARAM_INT);
$return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true
$type = optional_param('type', '', PARAM_ALPHANUM); //TODO: hopefully will be removed in 2.0
$sectionreturn = optional_param('sr', 0, PARAM_INT);
$sectionreturn = optional_param('sr', null, PARAM_INT);
$url = new moodle_url('/course/modedit.php');
$url->param('sr', $sectionreturn);
@@ -264,7 +264,7 @@ if ($mform->is_cancelled()) {
if ($return && !empty($cm->id)) {
redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id");
} else {
redirect(course_get_url($course, $sectionreturn));
redirect(course_get_url($course, $cw->section, array('sr' => $sectionreturn)));
}
} else if ($fromform = $mform->get_data()) {
if (empty($fromform->coursemodule)) {
@@ -633,7 +633,7 @@ if ($mform->is_cancelled()) {
redirect($gradingman->get_management_url($returnurl));
}
} else {
redirect(course_get_url($course, $sectionreturn));
redirect(course_get_url($course, $cw->section, array('sr' => $sectionreturn)));
}
exit;