From: gustav_delius Date: Sun, 30 Apr 2006 17:30:22 +0000 (+0000) Subject: Missingtype now also works without notices when the missing question has no answers. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=2be604b665e3f3501c98239e5b6c93e7e73a96c2;p=moodle.git Missingtype now also works without notices when the missing question has no answers. --- diff --git a/question/type/missingtype/display.html b/question/type/missingtype/display.html index 31e01f5907..e4ebf65893 100644 --- a/question/type/missingtype/display.html +++ b/question/type/missingtype/display.html @@ -1,4 +1,3 @@ -Please alert your Moodle administrator.'); ?>
@@ -7,18 +6,19 @@ -
-
- + +
+
+ +
+ + + + + + +
+ text; ?> +
- - - - - - - -
- text; ?> -
-
+ \ No newline at end of file diff --git a/question/type/missingtype/questiontype.php b/question/type/missingtype/questiontype.php index f759bbd6e2..45764e2d7e 100644 --- a/question/type/missingtype/questiontype.php +++ b/question/type/missingtype/questiontype.php @@ -34,11 +34,14 @@ class question_missingtype_qtype extends default_questiontype { $formatoptions, $cmoptions->course); $image = get_question_image($question, $cmoptions->course); - // Print each answer in a separate row - foreach ($answers as $answer) { - $a->text = format_text("$answer->answer", FORMAT_MOODLE, $formatoptions, $cmoptions->course); - - $anss[] = clone($a); + // Print each answer in a separate row if there are any + $anss = array(); + if ($answers) { + foreach ($answers as $answer) { + $a->text = format_text("$answer->answer", FORMAT_MOODLE, $formatoptions, $cmoptions->course); + + $anss[] = clone($a); + } } include("$CFG->dirroot/question/type/missingtype/display.html"); }