Skip to content

Commit

Permalink
Resolving bug #576.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kaipe committed Aug 3, 2003
1 parent bdb63d6 commit 5a24a01
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions mod/quiz/lib.php
Expand Up @@ -468,15 +468,28 @@ function quiz_print_question($number, $question, $grade, $courseid,
$stranswer = get_string("answer", "quiz");
$strmarks = get_string("marks", "quiz");

echo "<table width=100% cellspacing=10><tr><td nowrap width=100 valign=top>";
echo "<table width=100% cellspacing=10>";
echo "<tr><td nowrap width=100 valign=top>";
echo "<p align=center><b>$number</b></p>";
if ($feedback or $response) {
echo "<p align=center><font size=1>$strmarks: $actualgrade/$grade</font></p>";
} else {
echo "<p align=center><font size=1>$grade $strmarks</font></p>";
}
print_spacer(1,100);
echo "</td><td valign=top>";

if ($question->recentlyadded) {
echo "</td><td valign=top align=right>";
// Notify the user of this recently added question
echo '<font color="red">';
echo get_string('recentlyaddedquestion', 'quiz');
echo '</font>';
echo '</td></tr><tr><td></td><td valign=top>';

} else { // The normal case
echo "</td><td valign=top>";
}


if (empty($realquestion)) {
$realquestion->id = $question->id;
Expand Down Expand Up @@ -829,7 +842,9 @@ function quiz_print_question($number, $question, $grade, $courseid,
break;

case RANDOM:
echo "<P>Random questions should not be printed this way!</P>";
// This can only happen if it is a recently added question

echo '<P>' . get_string('random', 'quiz') . '</P>';
break;

default:
Expand Down Expand Up @@ -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
}
}
}

Expand Down

0 comments on commit 5a24a01

Please sign in to comment.