]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-10690 - Make quiz name a manditory field. Merged from MOODLE_18_STABLE.
authortjhunt <tjhunt>
Fri, 3 Aug 2007 10:33:29 +0000 (10:33 +0000)
committertjhunt <tjhunt>
Fri, 3 Aug 2007 10:33:29 +0000 (10:33 +0000)
mod/quiz/lib.php
mod/quiz/mod_form.php

index cc6f6e650cf543d0b2e1226a614d067b95b87e8e..edcc3e4713ba26c15d5596194dede486bfa44115 100644 (file)
@@ -571,14 +571,7 @@ function quiz_process_options(&$quiz) {
         $quiz->preventlate = 0;
     }
 
-    // Quiz name. (Make up a default if one was not given.)
-    if (empty($quiz->name)) {
-        if (empty($quiz->intro)) {
-            $quiz->name = get_string('modulename', 'quiz');
-        } else {
-            $quiz->name = shorten_text(strip_tags($quiz->intro));
-        }
-    }
+    // Quiz name (now a required field).
     $quiz->name = trim($quiz->name);
 
     // Time limit. (Get rid of it if the checkbox was not ticked.)
index b197e37462bee8193e2a37783c0ccf3e1d907616..588ca573ea56a8db6e9b3b8acfa8af3f6e3089bb 100644 (file)
@@ -16,6 +16,7 @@ class mod_quiz_mod_form extends moodleform_mod {
 
         $mform->addElement('text', 'name', get_string('name'), array('size'=>'64'));
         $mform->setType('name', PARAM_TEXT);
+        $mform->addRule('name', null, 'required', null, 'client');
 
         $mform->addElement('htmleditor', 'intro', get_string("introduction", "quiz"));
         $mform->setType('intro', PARAM_RAW);