From: kaipe Date: Sun, 3 Aug 2003 21:39:32 +0000 (+0000) Subject: Resolving bug #576. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=5a24a01868d9e263c592579085b7eaeb2aa77e50;p=moodle.git Resolving bug #576. This solution shows the message "Recently added question!" and the question text for each question that has been added since the reviewed attempt. The advantage with the chosen solution is that it will work fine for the (soon to come) "Each attempt builds on the last" quiz option. As I don't have the karma needed for updating in lang/en/, the message does not yet look quite as I described it above. --- diff --git a/mod/quiz/lib.php b/mod/quiz/lib.php index 99f197f72e..51481c45bb 100644 --- a/mod/quiz/lib.php +++ b/mod/quiz/lib.php @@ -468,7 +468,8 @@ function quiz_print_question($number, $question, $grade, $courseid, $stranswer = get_string("answer", "quiz"); $strmarks = get_string("marks", "quiz"); - echo "
"; + echo ""; + echo "
"; echo "

$number

"; if ($feedback or $response) { echo "

$strmarks: $actualgrade/$grade

"; @@ -476,7 +477,19 @@ function quiz_print_question($number, $question, $grade, $courseid, echo "

$grade $strmarks

"; } print_spacer(1,100); - echo "
"; + + if ($question->recentlyadded) { + echo ""; + // Notify the user of this recently added question + echo ''; + echo get_string('recentlyaddedquestion', 'quiz'); + echo ''; + echo '
'; + + } else { // The normal case + echo ""; + } + if (empty($realquestion)) { $realquestion->id = $question->id; @@ -829,7 +842,9 @@ function quiz_print_question($number, $question, $grade, $courseid, break; case RANDOM: - echo "

Random questions should not be printed this way!

"; + // This can only happen if it is a recently added question + + echo '

' . get_string('random', 'quiz') . '

'; break; default: @@ -869,8 +884,16 @@ function quiz_print_quiz_questions($quiz, $results=NULL, $questions=NULL, $shuff if ($shuffleorder) { // Order has been defined, so reorder questions $oldquestions = $questions; $questions = array(); - foreach ($shuffleorder as $key) { - $questions[] = $oldquestions[$key]; // This loses the index key, but doesn't matter + foreach ($shuffleorder as $key) { + if (empty($oldquestions[$key])) { // Check for recently added questions + if ($recentlyaddedquestion = + get_record("quiz_questions", "id", $key)) { + $recentlyaddedquestion->recentlyadded = true; + $questions[] = $recentlyaddedquestion; + } + } else { + $questions[] = $oldquestions[$key]; // This loses the index key, but doesn't matter + } } }