}
}
- // Start the form
+ echo "<form id=\"responseform\" method=\"post\" action=\"attempt.php\" onclick=\"this.autocomplete='off'\">\n";
if($quiz->timelimit > 0) {
// Make sure javascript is enabled for time limited quizzes
?>
<script type="text/javascript">
- //<![CDATA[
- document.write("<form id=\"responseform\" method=\"post\" action=\"attempt.php\" onclick=\"this.autocomplete='off'\">\n");
- //]]>
+ // Do nothing.
</script>
<noscript>
<div>
</div>
</noscript>
<?php
- } else {
- echo "<form id=\"responseform\" method=\"post\" action=\"attempt.php\" onclick=\"this.autocomplete='off'\">\n";
}
// Add a hidden field with the quiz id
echo "<input type=\"submit\" name=\"markall\" value=\"".get_string("markall", "quiz")."\" />\n";
}
echo "<input type=\"submit\" name=\"finishattempt\" value=\"".get_string("finishattempt", "quiz")."\" onclick=\"$onclick\" />\n";
- echo '<input type="hidden" name="timeup" value="0" />';
+ echo '<input type="hidden" name="timeup" id="timeup" value="0" />';
echo "</div>";
// For teachers ignore the quiz closing time
$secondsleft = 999999999999;
}
+
// If time limit is set include floating timer.
// MDL-7495, no timer for users with disability
-
- if ($quiz->timelimit > 0 && !has_capability('mod/quiz:ignoretimelimits', $context)) {
-
+ if ($quiz->timelimit > 0 && !has_capability('mod/quiz:ignoretimelimits', $context, NULL, false)) {
$timesincestart = time() - $attempt->timestart;
$timerstartvalue = min($quiz->timelimit*60 - $timesincestart, $secondsleft);
if ($timerstartvalue <= 0) {
function countdown_clock(theTimer) {
var timeout_id = null;
- // @EC PF : current client time
- var ec_now_epoch = new Date().getTime();
-
- // @EC PF : time left according to client
- quizTimerValue = Math.floor( (ec_quiz_finish - ec_now_epoch) /1000 );
+ quizTimerValue = Math.floor((ec_quiz_finish - new Date().getTime())/1000);
if(quizTimerValue <= 0) {
clearTimeout(timeout_id);
- var ourForm = document.forms['responseform'];
- ourForm.timeup.value = 1;
+ document.getElementById('timeup').value = 1;
+ var ourForm = document.getElementById('responseform');
if (ourForm.onsubmit) {
ourForm.onsubmit();
}
}
now = quizTimerValue;
- var hours = Math.floor( now / 3600 );
- parseInt(hours);
- now = now - (hours * 3600);
- var minutes = Math.floor(now / 60);
- parseInt(minutes);
- now = now - (minutes * 60);
+ var hours = Math.floor(now/3600);
+ now = now - (hours*3600);
+ var minutes = Math.floor(now/60);
+ now = now - (minutes*60);
var seconds = now;
- parseInt(seconds);
var t = "" + hours;
t += ((minutes < 10) ? ":0" : ":") + minutes;
var col = '#' + 'ff' + hexascii.charAt(seconds) + '0' + hexascii.charAt(seconds) + 0;
theTimer.style.backgroundColor = col;
}
- document.forms['clock'].time.value = t.toString();
+ document.getElementById('time').value = t.toString();
timeout_id = setTimeout("countdown_clock(theTimer)", 1000);
}
function movecounter(timerbox) {
-
var pos;
if (window.innerHeight) {
} else if (document.documentElement && document.documentElement.scrollTop) {
pos = document.documentElement.scrollTop
} else if (document.body) {
- pos = document.body.scrollTop
+ pos = document.body.scrollTop
}
if (pos < theTop) {
}
old = pos;
temp = setTimeout('movecounter(timerbox)',100);
-}
-
-function xGetElementById(e)
-{
- if(typeof(e)!='string') return e;
- if(document.getElementById) e=document.getElementById(e);
- else if(document.all) e=document.all[e];
- else e=null;
- return e;
-}
+}
\ No newline at end of file