]> git.mjollnir.org Git - moodle.git/commitdiff
added action to redirect back to course page or to url in session var if cancel has...
authorjamiesensei <jamiesensei>
Wed, 15 Nov 2006 07:34:34 +0000 (07:34 +0000)
committerjamiesensei <jamiesensei>
Wed, 15 Nov 2006 07:34:34 +0000 (07:34 +0000)
course/modedit.php

index 0729b5723b6ec9e134f0a32629931b0662df3fb6..b0b57b013efc819db2fb2aa12ae80d0152ce7928 100644 (file)
     $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);