mirror of
https://github.com/moodle/moodle.git
synced 2025-04-22 17:02:03 +02:00
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:
parent
49ce3d79b4
commit
68a7b97074
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user