From: gustav_delius Date: Mon, 27 Mar 2006 08:38:55 +0000 (+0000) Subject: Removed notices caused by empty responses X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=ffa1f07890e06c682c62b381dfba7a5aaef088cc;p=moodle.git Removed notices caused by empty responses --- diff --git a/question/type/match/questiontype.php b/question/type/match/questiontype.php index 3205eae761..9596b52224 100644 --- a/question/type/match/questiontype.php +++ b/question/type/match/questiontype.php @@ -326,7 +326,7 @@ class question_match_qtype extends default_questiontype { if (isset($state->responses)) { foreach($state->responses as $left=>$right){ $lpair = $question->options->subquestions[$left]->questiontext; - $rpair = $question->options->subquestions[$right]->answertext; + $rpair = $right ? $question->options->subquestions[$right]->answertext : ''; $results[$left] = $lpair." : ".$rpair; } return $results; diff --git a/question/type/multichoice/questiontype.php b/question/type/multichoice/questiontype.php index ae4b18c281..99d2bc6969 100644 --- a/question/type/multichoice/questiontype.php +++ b/question/type/multichoice/questiontype.php @@ -362,7 +362,7 @@ class question_multichoice_qtype extends default_questiontype { $answers = $question->options->answers; if (!empty($state->responses)) { foreach ($state->responses as $aid =>$rid){ - $answer = $answers[$rid]->answer; + $answer = $rid ? $answers[$rid]->answer : ''; $responses[] = $answer; } } else {