MDL-19072 XHTML export for match questions fix for distractors
authorJean-Michel Vedrine <vedrine@vedrine.org>
Sun, 31 Mar 2013 13:13:44 +0000 (15:13 +0200)
committerJean-Michel Vedrine <vedrine@vedrine.org>
Sun, 31 Mar 2013 13:13:44 +0000 (15:13 +0200)
question/format/xhtml/format.php

index 256db70..21db81d 100644 (file)
@@ -130,11 +130,13 @@ class qformat_xhtml extends qformat_default {
             foreach($question->options->subquestions as $subquestion) {
                 // build drop down for answers
                 $quest_text = $this->repchar( $subquestion->questiontext );
-                $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
-                $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}"));
-                $expout .= html_writer::tag('li', $quest_text);
-                $expout .= $dropdown;
-                $option++;
+                if ($quest_text != '') {
+                    $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
+                    $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}"));
+                    $expout .= html_writer::tag('li', $quest_text);
+                    $expout .= $dropdown;
+                    $option++;
+                }
             }
             $expout .= html_writer::end_tag('ul');
             break;