- Lets make cheating more complicated, more javascript based.
- Mark attempt to zero if time limit is exceeded over 60 seconds
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);
?>
<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
// -->
</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 {
$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;