diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php index 2ecde429eee..e2b693354d9 100644 --- a/lang/en_utf8/quiz.php +++ b/lang/en_utf8/quiz.php @@ -134,8 +134,10 @@ $string['choosedatasetproperties'] = 'Choose dataset properties'; $string['choosefile'] = 'Choose a file'; $string['close'] = 'Close window'; $string['closebeforeopen'] = 'Could not update the quiz. You have specified a close date before the open date.'; +$string['closedat'] = 'closed: $a'; $string['closepreview'] = 'Close preview'; $string['closereview'] = 'Close review'; +$string['closesat'] = 'closes: $a'; $string['comment'] = 'Comment'; $string['commentorgrade'] = 'Make comment or override grade'; $string['comments'] = 'Comments'; @@ -457,6 +459,8 @@ $string['onlyteachersexport'] = 'Only teachers can export questions'; $string['onlyteachersimport'] = 'Only teachers with editing rights can import questions'; $string['open'] = 'Started'; $string['openclosedatesupdated'] = 'Quiz open and close dates updated'; +$string['openedat'] = 'opened: $a'; +$string['opensat'] = 'opens: $a'; $string['optional'] = 'optional'; $string['orderandpaging'] = 'Order and paging'; $string['orderingquiz'] = 'Order and paging'; @@ -530,6 +534,8 @@ $string['quizclose'] = 'Close the quiz'; $string['quizclosed'] = 'This quiz closed on $a'; $string['quizcloses'] = 'Quiz closes'; $string['quizcloseson'] = 'This quiz will close at $a'; +$string['quizisclosed'] = 'This quiz is closed ($a)'; +$string['quizisopen'] = 'This quiz is open ($a)'; $string['quiznavigation'] = 'Quiz navigation'; $string['quiznotavailable'] = 'The quiz will not be available until $a'; $string['quizopen'] = 'Open the quiz'; diff --git a/mod/quiz/accessrules.php b/mod/quiz/accessrules.php index 7ef4cec21a8..0d215d36c0a 100644 --- a/mod/quiz/accessrules.php +++ b/mod/quiz/accessrules.php @@ -510,17 +510,6 @@ class open_close_date_access_rule extends quiz_access_rule_base { } return false; } - /** - * Output information about this quiz's open and close dates, and whether - * the quiz is currently open. - */ - public function print_timing_information() { - $messages = $this->description(); - if (!$this->prevent_access()) { - $messages[] = get_string('quizopened', 'quiz'); - } - echo implode(' | ', $messages); - } } /** diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 867e983b627..fbbd9cdc264 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -1495,8 +1495,35 @@ function quiz_print_status_bar($quiz){ ?> | print_timing_information(); + $available = true; + $dates = array(); + $timenow = time(); + $dateformat = get_string('strftimedatetimeshort'); + if ($quiz->timeopen > 0) { + if ($timenow > $quiz->timeopen) { + $dates[] = get_string('openedat', 'quiz', userdate($quiz->timeopen, $dateformat)); + } else { + $dates[] = get_string('opensat', 'quiz', userdate($quiz->timeopen, $dateformat)); + $available = false; + } + } + if ($quiz->timeclose > 0) { + if ($timenow > $quiz->timeclose) { + $dates[] = get_string('closedat', 'quiz', userdate($quiz->timeclose, $dateformat)); + $available = false; + } else { + $dates[] = get_string('closesat', 'quiz', userdate($quiz->timeclose, $dateformat)); + } + } + if (empty($dates)) { + $dates[] = get_string('alwaysavailable', 'quiz'); + } + $dates = implode(', ', $dates); + if ($available) { + print_string('quizisopen', 'quiz', $dates); + } else { + print_string('quizisclosed', 'quiz', $dates); + } ?>