Permalink
Browse files

Fixes for quiztimer.

- Lets make cheating more complicated, more javascript based.
- Mark attempt to zero if time limit is exceeded over 60 seconds
  • Loading branch information...
1 parent 49ce3d7 commit 68a7b970746edb887ed5a17347cec6489bc364d5 julmis committed Jun 20, 2004
Showing with 22 additions and 1 deletion.
  1. +6 −0 mod/quiz/attempt.php
  2. +4 −0 mod/quiz/jstimer.php
  3. +12 −1 mod/quiz/lib.php
View
@@ -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
@@ -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
@@ -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;

0 comments on commit 68a7b97

Please sign in to comment.