Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Print images correctly on questions included from categories in
other courses.
  • Loading branch information
moodler committed Jul 12, 2003
1 parent 52dcc2f commit 263cff8
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions mod/quiz/lib.php
Expand Up @@ -411,11 +411,19 @@ function quiz_print_question($number, $question, $grade, $courseid,
/// Prints a quiz question, any format
/// $question is provided as an object

if ($question->image) {
if ($quizcategory = get_record("quiz_categories", "id", $question->category)) {
$question->course = $quizcategory->course;
} else {
$question->course = $courseid;
}
}

if ($question->qtype == DESCRIPTION) { // Special case question - has no answers etc
echo '<p align="center">';
echo text_to_html($question->questiontext);
if ($question->image) {
print_file_picture($question->image, $courseid);
print_file_picture($question->image, $question->course);
}
echo '</p>';
return true;
Expand Down Expand Up @@ -450,7 +458,7 @@ function quiz_print_question($number, $question, $grade, $courseid,
case NUMERICAL:
echo text_to_html($question->questiontext);
if ($question->image) {
print_file_picture($question->image, $courseid);
print_file_picture($question->image, $question->course);
}
if ($response) {
$value = "VALUE=\"$response[0]\"";
Expand Down Expand Up @@ -485,7 +493,7 @@ function quiz_print_question($number, $question, $grade, $courseid,
}
echo text_to_html($question->questiontext);
if ($question->image) {
print_file_picture($question->image, $courseid);
print_file_picture($question->image, $question->course);
}

$truechecked = "";
Expand Down Expand Up @@ -530,7 +538,7 @@ function quiz_print_question($number, $question, $grade, $courseid,
}
echo text_to_html($question->questiontext);
if ($question->image) {
print_file_picture($question->image, $courseid);
print_file_picture($question->image, $question->course);
}
echo "<TABLE ALIGN=right>";
echo "<TR><TD valign=top>$stranswer:&nbsp;&nbsp;</TD><TD>";
Expand Down Expand Up @@ -586,7 +594,7 @@ function quiz_print_question($number, $question, $grade, $courseid,
echo text_to_html($question->questiontext);
}
if (!empty($question->image)) {
print_file_picture($question->image, $courseid);
print_file_picture($question->image, $question->course);
}

if ($shuffleanswers) {
Expand Down Expand Up @@ -636,7 +644,7 @@ function quiz_print_question($number, $question, $grade, $courseid,
}
echo text_to_html($question->questiontext);
if ($question->image) {
print_file_picture($question->image, $courseid);
print_file_picture($question->image, $question->course);
}

/// First, get all the questions available
Expand Down

0 comments on commit 263cff8

Please sign in to comment.