From 46e910c7cd121b6bc7f9223dfc0ee506bc32d230 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Fri, 30 Mar 2007 09:34:05 +0000 Subject: [PATCH] Fix notice. Merged from MOODLE_17_STABLE. --- lib/questionlib.php | 4 +++- mod/quiz/attempt.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/questionlib.php b/lib/questionlib.php index 008373659ec..fd53272d0e8 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -634,8 +634,10 @@ function get_question_options(&$questions) { * @param object $cmoptions * @param object $attempt The attempt for which the question sessions are * to be restored or created. +* @param mixed either the id of a previous attempt, if this attmpt is +* building on a previous one, or false for a clean attempt. */ -function get_question_states(&$questions, $cmoptions, $attempt, $lastattemptid=null) { +function get_question_states(&$questions, $cmoptions, $attempt, $lastattemptid = false) { global $CFG, $QTYPES; // get the question ids diff --git a/mod/quiz/attempt.php b/mod/quiz/attempt.php index 7ed0978b6a2..618148e6e7b 100644 --- a/mod/quiz/attempt.php +++ b/mod/quiz/attempt.php @@ -285,7 +285,8 @@ error('Could not load question options'); } - // If the new attempt is to be based on a previous attempt find its id + // If the new attempt is to be based on a previous attempt find its id + $lastattemptid = false; if ($newattempt and $attempt->attempt > 1 and $quiz->attemptonlast and !$attempt->preview) { // Find the previous attempt if (!$lastattemptid = get_field('quiz_attempts', 'uniqueid', 'quiz', $attempt->quiz, 'userid', $attempt->userid, 'attempt', $attempt->attempt-1)) {