diff --git a/mod/quiz/editlib.php b/mod/quiz/editlib.php index 41c5f27738ce2..21ad23193e7e4 100644 --- a/mod/quiz/editlib.php +++ b/mod/quiz/editlib.php @@ -1237,44 +1237,55 @@ function quiz_print_grading_form($quiz, $pageurl, $tabindex) { */ function quiz_print_status_bar($quiz) { global $CFG; - $numberofquestions = quiz_number_of_questions_in_quiz($quiz->questions); - ?>
- sumgrades)) ?> - | - - sumgrades)), + array('class' => 'totalpoints')); + + $bits[] = html_writer::tag('span', + get_string('numquestionsx', 'quiz', quiz_number_of_questions_in_quiz($quiz->questions)), + array('class' => 'numberofquestions')); + $timenow = time(); + + // Exact open and close dates for the tool-tip. + $dates = array(); if ($quiz->timeopen > 0) { if ($timenow > $quiz->timeopen) { $dates[] = get_string('quizopenedon', 'quiz', userdate($quiz->timeopen)); } else { $dates[] = get_string('quizwillopen', 'quiz', userdate($quiz->timeopen)); - print_string('quizisclosed', 'quiz'); } } if ($quiz->timeclose > 0) { if ($timenow > $quiz->timeclose) { $dates[] = get_string('quizclosed', 'quiz', userdate($quiz->timeclose)); - print_string('quizisclosed', 'quiz'); } else { $dates[] = get_string('quizcloseson', 'quiz', userdate($quiz->timeclose)); - $currentstatus = get_string('quizisopenwillclose', 'quiz', - userdate($quiz->timeclose, get_string('strftimedatetimeshort', 'langconfig'))); } } if (empty($dates)) { $dates[] = get_string('alwaysavailable', 'quiz'); } - $dates = implode(', ', $dates); - echo ' | ' . $currentstatus . ''; + $tooltip = implode(', ', $dates);; + + // Brief summary on the page. + if ($timenow < $quiz->timeopen) { + $currentstatus = get_string('quizisclosedwillopen', 'quiz', + userdate($quiz->timeclose, get_string('strftimedatetimeshort', 'langconfig'))); + } else if ($quiz->timeclose && $timenow <= $quiz->timeclose) { + $currentstatus = get_string('quizisopenwillclose', 'quiz', + userdate($quiz->timeclose, get_string('strftimedatetimeshort', 'langconfig'))); + } else if ($quiz->timeclose && $timenow > $quiz->timeclose) { + $currentstatus = get_string('quizisclosed', 'quiz'); + } else { + $currentstatus = get_string('quizisopen', 'quiz'); + } - ?> -
- 'quizopeningstatus', 'title' => implode(', ', $dates))); + + echo html_writer::tag('div', implode(' | ', $bits), array('class' => 'statusbar')); } diff --git a/mod/quiz/lang/en/quiz.php b/mod/quiz/lang/en/quiz.php index a0a992ae8e46c..6deab91c515b8 100644 --- a/mod/quiz/lang/en/quiz.php +++ b/mod/quiz/lang/en/quiz.php @@ -555,6 +555,7 @@ $string['quiz:ignoretimelimits'] = 'Ignores time limit on quizzes'; $string['quizisclosed'] = 'This quiz is closed'; $string['quizisopen'] = 'This quiz is open'; +$string['quizisclosedwillopen'] = 'Quiz closed (opens {$a})'; $string['quizisopenwillclose'] = 'Quiz open (closes {$a})'; $string['quiz:manage'] = 'Manage quizzes'; $string['quiz:manageoverrides'] = 'Manage quiz overrides';