Fixes for quiztimer.

- Lets make cheating more complicated, more javascript based.
- Mark attempt to zero if time limit is exceeded over 60 seconds
This commit is contained in:
julmis 2004-06-20 10:57:27 +00:00
parent 49ce3d79b4
commit 68a7b97074
3 changed files with 22 additions and 1 deletions

View File

@ -143,6 +143,12 @@
error("Could not grade your quiz attempt!");
}
if($timelimit > 0) {
if(($timelimit + 60) <= $timesincestart) {
$result->sumgrades = 0;
}
}
if ($attempt = quiz_save_attempt($quiz, $questions, $result, $attemptnumber)) {
add_to_log($course->id, "quiz", "submit",
"review.php?id=$cm->id&attempt=$attempt->id", "$quiz->id", $cm->id);

View File

@ -6,6 +6,10 @@
?>
<script language="javascript" type="text/javascript">
<!--
function send_data() {
document.forms[0].submit();
return true;
}
var timesup = "<?php print_string("timesup","quiz");?>";
var quizclose = <?php echo ($quiz->timeclose - time()) - $timerstartvalue; ?>; // in seconds

View File

@ -1187,7 +1187,7 @@ function quiz_print_quiz_questions($quiz, $results=NULL, $questions=NULL, $shuff
// -->
</script>
<noscript>
<center><p><strong>Javascript must be enabled!</strong></p></center>
<center><p><strong><?php print_string("noscript","quiz"); ?></strong></p></center>
</noscript>
<?php
} else {
@ -1256,8 +1256,19 @@ function quiz_print_quiz_questions($quiz, $results=NULL, $questions=NULL, $shuff
$shuffleorder = implode(',', $questionorder);
echo "<input type=\"hidden\" name=\"shuffleorder\" value=\"$shuffleorder\" />\n";
}
if($quiz->timelimit > 0) {
echo "<script language=\"javascript\" type=\"text/javascript\">\n";
echo "<!--\n";
echo "document.write('<center><input type=\"button\" value=\"".get_string("savemyanswers", "quiz")."\" onclick=\"return send_data();\" /></center>');\n";
echo "// -->\n";
echo "</script>\n";
echo "<noscript>\n";
echo "<center><strong>".get_string("noscript","quiz")."</strong></center>\n";
echo "</noscript>\n";
} else {
echo "<center>\n<input type=\"submit\" value=\"".get_string("savemyanswers", "quiz")."\" />\n</center>";
}
}
echo "</form>";
return true;