Merged fixes for display of correctanswers from stable

This commit is contained in:
moodler 2004-09-04 08:12:23 +00:00
parent 106f3dfbe4
commit 20229ca246
2 changed files with 5 additions and 5 deletions

View File

@ -168,9 +168,10 @@ class quiz_match_qtype extends quiz_default_questiontype {
$menuname = $nameprefix.$subquestion->id;
$response = isset($question->response[$menuname])
? $question->response[$menuname] : '0';
if (isset($correctanswers[$menuname])
&& $correctanswers[$menuname]->id
== $response) {
if ($readonly
and $quiz->correctanswers
and isset($correctanswers[$menuname])
and ($correctanswers[$menuname]->id == $response)) {
$class = ' class="highlight" ';
} else {
$class = '';

View File

@ -210,8 +210,7 @@ class quiz_multichoice_qtype extends quiz_default_questiontype {
echo "<input $readonly $name $checked $type value=\"$answer->id\" />";
echo "</td>";
if ($readonly and $quiz->correctanswers || $quiz->feedback
and !empty($correctanswers[$nameprefix.$aid])) {
if ($readonly and $quiz->correctanswers and !empty($correctanswers[$nameprefix.$aid])) {
echo '<td valign="top" class="highlight">'.format_text("$qnumchar. $answer->answer").'</td>';
} else {
echo '<td valign="top">'.format_text("$qnumchar. $answer->answer").'</td>';