mirror of
https://github.com/moodle/moodle.git
synced 2025-01-31 12:45:04 +01:00
added action to redirect back to course page or to url in session var if cancel has been pressed.
This commit is contained in:
parent
f1e6550be2
commit
145dbd7cee
@ -10,6 +10,23 @@
|
||||
$add = optional_param('add', '', PARAM_ALPHA);
|
||||
$update = optional_param('update', 0, PARAM_INT);
|
||||
|
||||
$cancel = optional_param('cancel', 0, PARAM_BOOL);
|
||||
|
||||
if ($cancel) {
|
||||
if (!empty($SESSION->returnpage)) {
|
||||
$return = $SESSION->returnpage;
|
||||
unset($SESSION->returnpage);
|
||||
redirect($return);
|
||||
} else {
|
||||
$course = required_param('course', PARAM_INT);
|
||||
$section = optional_param('section', '', PARAM_INT);
|
||||
if (! $course = get_record("course", "id", $course)) {
|
||||
error("This course doesn't exist");
|
||||
}
|
||||
redirect("view.php?id=$course->id#section-$section");
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($add)){
|
||||
$section = required_param('section', PARAM_INT);
|
||||
$course = required_param('course', PARAM_INT);
|
||||
|
Loading…
x
Reference in New Issue
Block a user