From 980f8d92befa806c12c4be82da21a05844871cf1 Mon Sep 17 00:00:00 2001 From: gbateson Date: Sat, 3 Feb 2007 01:12:30 +0000 Subject: [PATCH] allow empty JQuiz questions (which have at least one answer) --- mod/hotpot/template/v6.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/mod/hotpot/template/v6.php b/mod/hotpot/template/v6.php index f82ca1d32d..bd84a4f09e 100644 --- a/mod/hotpot/template/v6.php +++ b/mod/hotpot/template/v6.php @@ -402,7 +402,8 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { $i = count($values); break; case 'jquiz': - while ($this->parent->xml_value('data,questions,question-record', "[$i]['#']['question'][0]['#']")) { + $tags = 'data,questions,question-record'; + while (($question="[$i]['#']") && $this->parent->xml_value($tags, $question)) { $i++; } break; @@ -1244,8 +1245,10 @@ class hotpot_xml_quiz_template extends hotpot_xml_template_default { $question_text = $this->parent->xml_value($tags, $question."['question'][0]['#']"); $question_type = $this->parent->xml_value($tags, $question."['question-type'][0]['#']"); - // check we have a question - if ($question_text && $question_type) { + $first_answer_text = $this->parent->xml_value($tags, $question."['answers'][0]['#']['answer'][0]['#']['text'][0]['#']"); + + // check we have a question (or at least one answer) + if (($question_text || $first_answer_text) && $question_type) { $str .= '