]> git.mjollnir.org Git - moodle.git/commitdiff
Fixed page path (docs and css) for module editing MDL-8452
authormoodler <moodler>
Wed, 14 Feb 2007 14:08:50 +0000 (14:08 +0000)
committermoodler <moodler>
Wed, 14 Feb 2007 14:08:50 +0000 (14:08 +0000)
course/modedit.php

index 9ab4375ddd4cd02a9de60573d802a404d545a871..493c43803115c25c43f7071c90535b10d1e79d57 100644 (file)
@@ -11,8 +11,9 @@
     $update        = optional_param('update', 0, PARAM_INT);
     //return to course/view.php if false or mod/modname/view.php if true
     $return        = optional_param('return', 0, PARAM_BOOL);
+    $type          = optional_param('type', '', PARAM_ALPHANUM);
 
-    if (!empty($add)){
+    if (!empty($add)) {
         $section = required_param('section', PARAM_INT);
         $course = required_param('course', PARAM_INT);
 
         }
         $strnav = '';
 
-    }elseif (!empty($update)){
+        $CFG->pagepath = 'mod/'.$module->name;
+        if (!empty($type)) {
+            $CFG->pagepath .= '/'.$type;
+        } else {
+            $CFG->pagepath .= '/mod';
+        }
+
+    } else if (!empty($update)) {
         if (! $cm = get_record("course_modules", "id", $update)) {
             error("This course module doesn't exist");
         }
             $pageheading = get_string("updatinga", "moodle", $fullmodulename);
         }
         $strnav = "<a href=\"$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id\">".format_string($form->name,true)."</a> ->";
-    }else{
+        $CFG->pagepath = 'mod/'.$module->name;
+        if (!empty($type)) {
+            $CFG->pagepath .= '/'.$type;
+        } else {
+            $CFG->pagepath .= '/mod';
+        }
+    } else {
         error('Invalid operation.');
     }
 
     if (file_exists($modmoodleform)) {
         require_once($modmoodleform);
 
-    }else{
+    } else {
         error('No formslib form description file found for this activity.');
     }
 
         } else {
             redirect("view.php?id=$course->id#section-".$cousesection);
         }
-    } elseif ($fromform=$mform->get_data()){
+    } else if ($fromform=$mform->get_data()){
         if (empty($fromform->coursemodule)) { //add
             if (! $course = get_record("course", "id", $fromform->course)) {
                 error("This course doesn't exist");
             add_to_log($course->id, $fromform->modulename, "update",
                        "view.php?id=$fromform->coursemodule",
                        "$fromform->instance", $fromform->coursemodule);
-        }elseif (!empty($fromform->add)){
+
+        } else if (!empty($fromform->add)){
 
             if (!course_allowed_module($course,$fromform->modulename)) {
                 error("This module ($fromform->modulename) has been disabled for this particular course");
             add_to_log($course->id, $fromform->modulename, "add",
                        "view.php?id=$fromform->coursemodule",
                        "$fromform->instance", $fromform->coursemodule);
-        }else{
+        } else {
             error("Data submitted is invalid.");
         }
 
         redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$fromform->coursemodule");
         exit;
 
-    }else{
+    } else {
         $context = get_context_instance(CONTEXT_COURSE, $course->id);
         require_capability('moodle/course:manageactivities', $context);