$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';
$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';
$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';
}
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);
- }
}
/**
?></span>
| <span class="quizopeningstatus">
<?php
- $accessrule = new open_close_date_access_rule(new quiz($quiz, NULL, NULL, false), time());
- $accessrule->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);
+ }
?></span><?php
// If questions are shuffled, notify the user about the
// question order not making much sense