From 145dbd7cee0fff54da91beec2d991a924ab6b8eb Mon Sep 17 00:00:00 2001 From: jamiesensei Date: Wed, 15 Nov 2006 07:34:34 +0000 Subject: [PATCH] added action to redirect back to course page or to url in session var if cancel has been pressed. --- course/modedit.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/course/modedit.php b/course/modedit.php index 0729b5723b..b0b57b013e 100644 --- a/course/modedit.php +++ b/course/modedit.php @@ -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); -- 2.39.5