diff -u --recursive --new-file c:\xampp\htdocs\moodle\mod\quiz/attempt.php c:\xampp\htdocs\moodle192\mod\quiz/attempt.php
--- c:\xampp\htdocs\moodle\mod\quiz/attempt.php 2008-07-03 08:17:50.000000000 +0200
+++ c:\xampp\htdocs\moodle192\mod\quiz/attempt.php 2008-07-14 16:40:29.712619500 +0200
@@ -1,4 +1,4 @@
-timestart = $timestamp - 1;
}
+
+ //Check if the current page number is bigger than the highest ever visited in this attempt
+ //if so, set the current page number as the highest ever visited
+ if($page > $attempt->lastpage) {
+ if($page - $attempt->lastpage >= 2 and $quiz->noback == 0) {
+ $page = $attempt->lastpage+1;
+ }
+ $attempt->lastpage = $page;
+ }
+
+ //Check if the user manually requests a lower page number
+ //if so, redirect to highest number ever visited - no cheating allowed =)
+ //$quiz->noback == 0 ==> zurück nicht erlauben
+ if($page < $attempt->lastpage and $quiz->noback == 0) {
+ $page = $attempt->lastpage;
+ }
/// Load all the questions and states needed by this script
@@ -484,7 +500,11 @@
/// Print the navigation panel if required
$numpages = quiz_number_of_pages($attempt->layout);
if ($numpages > 1) {
- quiz_print_navigation_panel($page, $numpages);
+ if($quiz->noback == 0) {
+ quiz_print_navigation_panel_noback($page, $numpages);
+ } else {
+ quiz_print_navigation_panel($page, $numpages);
+ }
}
/// Print all the questions
@@ -507,12 +527,23 @@
echo "\n";
}
echo "\n";
+
+ //Add "NEXT"-Button
+
+ if($page < $numpages-1 and $quiz->noback == 0) {
+ echo "\n";
+ }
+
echo "";
// Print the navigation panel if required
if ($numpages > 1) {
- quiz_print_navigation_panel($page, $numpages);
+ if($quiz->noback == 0) {
+ #quiz_print_navigation_panel_noback($page, $numpages);
+ } else {
+ quiz_print_navigation_panel($page, $numpages);
+ }
}
// Finish the form
@@ -539,8 +570,9 @@
}
if ($showtimer && (!$ispreviewing || $timerstartvalue > 0)) {
$timerstartvalue = max($timerstartvalue, 1); // Make sure it starts just above zero.
- require('jstimer.php');
+ $showtimer = true;
}
+ require('jstimer.php');
// Finish the page
if (empty($popup)) {
diff -u --recursive --new-file c:\xampp\htdocs\moodle\mod\quiz/jstimer.php c:\xampp\htdocs\moodle192\mod\quiz/jstimer.php
--- c:\xampp\htdocs\moodle\mod\quiz/jstimer.php 2007-11-03 09:52:36.000000000 +0100
+++ c:\xampp\htdocs\moodle192\mod\quiz/jstimer.php 2008-08-18 11:17:38.082034900 +0200
@@ -29,6 +29,8 @@
+
+ if($showtimer == 1) { ?>
+ } else { ?>
+
+
+
+
+
+ }
+ if($quiz->noback == 1) {
+ ?>
+
+
+
+
+
+
+ // Load ALL of the newest graded states for the questions (vor new Navigation Layout)
+ $sql="SELECT m1.question,m1.timestamp,m1.answer,q.qtype
+ FROM ".$CFG->prefix."question_states m1
+ JOIN ".$CFG->prefix."question q
+ ON q.id=m1.question
+ INNER JOIN (SELECT question, MAX(timestamp) AS Maxtime FROM ".$CFG->prefix."question_states
+ WHERE attempt = '{$attempt->uniqueid}' AND question IN($attempt->layout) GROUP BY question) m2
+ ON m1.question = m2.question AND m1.timestamp = m2.Maxtime";
+ // SELECT * FROM mdl_question_states m1 INNER JOIN (SELECT question, MAX(timestamp) AS Maxtime FROM mdl_question_states WHERE attempt = '12' GROUP BY question) m2 ON m1.question = m2.question AND m1.timestamp = m2.Maxtime
+ $allgradedstates = get_records_sql($sql);
+ #echo $sql;
+ #echo $attempt->uniqueid;
+ #var_dump($allgradedstates);
+ $i_page=0;
+ $i_question=1;
+ $i=0;
+ $qids=explode(",",$attempt->layout);
+
+ foreach($qids as $id) {
+ if($i%7 == 0) {
+ echo "
+ } ?>
diff -u --recursive --new-file c:\xampp\htdocs\moodle\mod\quiz/locallib.php c:\xampp\htdocs\moodle192\mod\quiz/locallib.php
--- c:\xampp\htdocs\moodle\mod\quiz/locallib.php 2008-04-24 08:18:04.000000000 +0200
+++ c:\xampp\htdocs\moodle192\mod\quiz/locallib.php 2008-07-03 17:27:26.000000000 +0200
@@ -228,21 +228,65 @@
* @param integer $page The number of the current page (counting from 0).
* @param integer $pages The total number of pages.
*/
+function quiz_print_navigation_panel_noback($page, $pages) {
+ //$page++;
+ echo '
';
+ echo '' . get_string('page') . ':';
+
+ //Zurück-Link nicht mehr enzeigen
+
+// if ($page > 0) {
+// // Print previous link
+// $strprev = get_string('previous');
+// echo '(' . $strprev . ')';
+// }
+
+ //Nur mehr die Seitenzahlen anzeigen, aber keine Links mehr darauf
+
+ for ($i = 0; $i < $pages; $i++) {
+ if ($i == $page) {
+ echo ''.($i+1).'';
+ } else {
+ //echo ''.($i+1).'';
+ echo '' . ($i+1) . '';
+ }
+ }
+
+ //Nächste-Link bleibt wie er ist...
+
+ if ($page < $pages - 1) {
+ // Print next link
+ $strnext = get_string('next');
+ echo '(' . $strnext . ')';
+ }
+ echo '
';
+}
+
+/**
+ * Print navigation panel for quiz attempt and review pages
+ *
+ * @param integer $page The number of the current page (counting from 0).
+ * @param integer $pages The total number of pages.
+ */
function quiz_print_navigation_panel($page, $pages) {
//$page++;
echo '