]> git.mjollnir.org Git - moodle.git/commitdiff
MOre tolerant of empty fields, and fixed heading
authormoodler <moodler>
Mon, 23 Aug 2004 12:29:29 +0000 (12:29 +0000)
committermoodler <moodler>
Mon, 23 Aug 2004 12:29:29 +0000 (12:29 +0000)
mod/quiz/edit.php

index 1422210cc3a13a7133d650d6e94de1ab5f4eb1fa..a52da9bb40c247e1cd18ec341c6e73d232a0529c 100644 (file)
 
     if ($modform and !empty($modform->course)) {    // form submitted from mod.html
 
-        if (empty($modform->name) or empty($modform->intro)) {
-            error(get_string("filloutallfields"), $_SERVER["HTTP_REFERER"]);
+        $modform->name = trim($modform->name);
+
+        if (empty($modform->name)) {
+            if (empty($modform->intro)) {
+                $modform->name = get_string('modulename', 'quiz');
+            } else {
+                $modform->name = strip_tags($modform->intro);
+            }
         }
 
         $SESSION->modform = $modform;    // Save the form in the current session
     $strediting = get_string(isset($modform->instance) ? "editingquiz" : "editquestions", "quiz");
     $strheading = empty($modform->name) ? $strediting : $modform->name;
 
-    print_header_simple("$strediting", "$strheading",
+    print_header_simple($strediting, '',
                  "<a href=\"$CFG->wwwroot/mod/quiz/index.php?id=$course->id\">$strquizzes</a> -> $strediting");
 
     // Print basic page layout.