Bug 5247: stop people creating tests with a close date before the open date.

This commit is contained in:
tjhunt
2006-06-01 14:27:37 +00:00
parent 095759281b
commit cd70aa32f2
2 changed files with 9 additions and 0 deletions
+1
View 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.';
+8
View 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;