From ffa1f07890e06c682c62b381dfba7a5aaef088cc Mon Sep 17 00:00:00 2001 From: gustav_delius Date: Mon, 27 Mar 2006 08:38:55 +0000 Subject: [PATCH] Removed notices caused by empty responses --- question/type/match/questiontype.php | 2 +- question/type/multichoice/questiontype.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) 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 { -- 2.39.5