mirror of
https://github.com/moodle/moodle.git
synced 2025-01-29 11:46:19 +01:00
quiz editing: MDL-17296 improve display of open and closde dates on the editing page.
This commit is contained in:
parent
041a4b0f09
commit
e476804cdb
@ -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';
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1495,8 +1495,35 @@ function quiz_print_status_bar($quiz){
|
||||
?></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
|
||||
|
Loading…
x
Reference in New Issue
Block a user