diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 186139eda92..1440106a985 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -96,7 +96,7 @@ if (empty($slots)) { throw new moodle_quiz_exception($attemptobj->get_quizobj(), 'noquestionsfound'); } -// Update attempt page +// Update attempt page if ($attemptobj->get_currentpage() != $page) { $DB->set_field('quiz_attempts', 'currentpage', $page); } diff --git a/mod/quiz/attemptlib.php b/mod/quiz/attemptlib.php index cc957584d8e..a713757fc64 100644 --- a/mod/quiz/attemptlib.php +++ b/mod/quiz/attemptlib.php @@ -601,7 +601,7 @@ class quiz_attempt { public function get_userid() { return $this->attempt->userid; } - + /** @return int the current page of the attempt. */ public function get_currentpage() { return $this->attempt->currentpage; diff --git a/mod/quiz/db/upgrade.php b/mod/quiz/db/upgrade.php index 55119e8e2ef..a512fc262e6 100644 --- a/mod/quiz/db/upgrade.php +++ b/mod/quiz/db/upgrade.php @@ -69,13 +69,13 @@ function xmldb_quiz_upgrade($oldversion) { // quiz savepoint reached upgrade_mod_savepoint(true, 2011120701, 'quiz'); } - + if ($oldversion < 2011120703) { // Track page of quiz attempts $table = new xmldb_table('quiz_attempts'); - + $field = new xmldb_field('currentpage', XMLDB_TYPE_INTEGER, '10', XMLDB_UNSIGNED, XMLDB_NOTNULL, null, 0); - + if (!$dbman->field_exists($table, $field)) { $dbman->add_field($table, $field); } diff --git a/mod/quiz/startattempt.php b/mod/quiz/startattempt.php index a43fc08cb75..a9451237b97 100644 --- a/mod/quiz/startattempt.php +++ b/mod/quiz/startattempt.php @@ -82,7 +82,7 @@ $lastattempt = end($attempts); if ($lastattempt && !$lastattempt->timefinish) { $currentattemptid = $lastattempt->id; $messages = $accessmanager->prevent_access(); - + if ($page == -1) { $page = $lastattempt->currentpage; } @@ -101,7 +101,7 @@ if ($lastattempt && !$lastattempt->timefinish) { $accessmanager->prevent_new_attempt(count($attempts), $lastattempt); if ($page == -1) { - $page = 0; + $page = 0; } }