]> git.mjollnir.org Git - moodle.git/commitdiff
Bug 5247: stop people creating tests with a close date before the open date.
authortjhunt <tjhunt>
Thu, 1 Jun 2006 14:27:37 +0000 (14:27 +0000)
committertjhunt <tjhunt>
Thu, 1 Jun 2006 14:27:37 +0000 (14:27 +0000)
lang/en_utf8/quiz.php
mod/quiz/lib.php

index 87a56913c6181f607e21e135e11b2f506b1939c8..b43e4b09bb4c27d6146f55580cc63d1b1f8bc229 100644 (file)
@@ -102,6 +102,7 @@ $string['correctanswerlength'] = 'Significant Figures';
 $string['correctanswers'] = 'Correct answers';
 $string['correctanswershows'] = 'Correct answer shows';
 $string['corrresp'] = 'Correct Response';
+$string['closebeforeopen'] = 'Could not update the quiz. You have specified a close date before the open date.';
 $string['countdown'] = 'Countdown';
 $string['countdownfinished'] = 'The quiz is closing, you should submit your answers now.';
 $string['countdowntenminutes'] = 'The quiz will be closing in ten minutes.';
index 3b263d30bf950d3842a3f63785f369b67a0c13fd..7c4df55c3130777a17f1ac2112c2dd7f02ae59f4 100644 (file)
@@ -78,6 +78,10 @@ function quiz_add_instance($quiz) {
                                                     $quiz->availableminute);
     }
 
+    if ($quiz->timeopen != 0 && $quiz->timeclose != 0 && $quiz->timeclose < $quiz->timeopen) {
+        return get_string('closebeforeopen', 'quiz');
+    }
+
     $quiz->timelimit = round($quiz->timelimit);
 
     if (empty($quiz->name)) {
@@ -171,6 +175,10 @@ function quiz_update_instance($quiz) {
                                                     $quiz->availableminute);
     }
 
+    if ($quiz->timeopen != 0 && $quiz->timeclose != 0 && $quiz->timeclose < $quiz->timeopen) {
+        return get_string('closebeforeopen', 'quiz');
+    }
+
     $quiz->timelimit = round($quiz->timelimit);
 
     $quiz->id = $quiz->instance;