$string['time'] = 'Time';
$string['timecompleted'] = 'Completed';
$string['timedelay'] = 'You are not allowed to do the quiz since you have not passed the time delay before attempting another quiz';
-$string['timeleft'] = 'Time Remaining';
+$string['timeleft'] = 'Time left';
$string['timelimit'] = 'Time limit';
$string['timelimitmin'] = 'Time limit (minutes)';
$string['timelimitexeeded'] = 'Sorry! Quiz time limit exceeded!';
return $this->_quiz->timeclose && $this->_timenow > $this->_quiz->timeclose;
}
public function time_left($attempt, $timenow) {
+ // If this is a teacher preview after the close date, do not show
+ // the time.
+ if ($attempt->preview && $timenow > $this->_quiz->timeclose) {
+ return false;
+ }
+
+ // Otherwise, return to the time left until the close date, providing
+ // that is less than QUIZ_SHOW_TIME_BEFORE_DEADLINE
if ($this->_quiz->timeclose) {
$timeleft = $this->_quiz->timeclose - $timenow;
if ($timeleft < QUIZ_SHOW_TIME_BEFORE_DEADLINE) {
// Once time has run out.
timeoutid: null,
- // Desired position of the top of timer_outer: 100px from the top of the window.
- targettop: 100,
-
- // How often we check to positing and adjust it. Delay in milliseconds.
- movedelay: 100,
-
- // Last known postion of timer_outer.
- oldtop: this.target_top,
-
// Colours used to change the timer bacground colour when time had nearly run out.
// This array is indexed by number of seconds left.
finalcolours: [
quiz_timer.endtime = new Date().getTime() + timeleft*1000;
// Get references to some bits of the DOM we need.
- quiz_timer.timerouter = document.getElementById('quiz-timer-outer'),
- quiz_timer.timerdisplay = document.getElementById('quiz-timer-display'),
+ quiz_timer.timerouter = document.getElementById('quiz-timer'),
+ quiz_timer.timerdisplay = document.getElementById('quiz-time-left'),
quiz_timer.quizform = document.getElementById('responseform'),
- // Get things starte.
- quiz_timer.move();
+ // Make the timer visible.
+ quiz_timer.timerouter.style.display = 'block';
+
+ // Get things started.
quiz_timer.update_time();
},
// Arrange for this method to be called again soon.
quiz_timer.timeoutid = setTimeout(quiz_timer.update_time, quiz_timer.updatedelay);
- },
-
- // Function to keep the clock in the same place on the screen.
- move: function() {
- // Work out where the top of the window is.
- var pos;
- if (window.innerHeight) {
- pos = window.pageYOffset
- } else if (document.documentElement && document.documentElement.scrollTop) {
- pos = document.documentElement.scrollTop
- } else if (document.body) {
- pos = document.body.scrollTop
- }
-
- // We want the timer target_top pixels from the top of the window,
- // or the top of the document, whichever is lower.
- pos += quiz_timer.targettop;
- if (pos < quiz_timer.targettop) {
- pos = quiz_timer.targettop;
- }
-
- // Only move the timer if the window has stopped moving, and the position has stabilised.
- if (pos == quiz_timer.oldtop) {
- quiz_timer.timerouter.style.top = pos + 'px';
- }
- quiz_timer.oldtop = pos;
-
- // Arrange for this method to be called again soon.
- setTimeout(quiz_timer.move, quiz_timer.movedelay);
}
};