mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
Fixed glaring error in Match format
This commit is contained in:
parent
7d95c2b824
commit
971a7ce06f
1 changed files with 23 additions and 15 deletions
|
@ -61,28 +61,36 @@ function writequestion( $question ) {
|
||||||
break;
|
break;
|
||||||
case SHORTANSWER:
|
case SHORTANSWER:
|
||||||
$expout .= "<ul class=\"shortanswer\">\n";
|
$expout .= "<ul class=\"shortanswer\">\n";
|
||||||
$count = 0;
|
$expout .= " <li><input name=\"quest_$id\" type=\"text\" /></li>\n";
|
||||||
foreach($question->answers as $answer) {
|
|
||||||
$ans_text = $this->repchar( $answer->answer );
|
|
||||||
$expout .= " <li>$ans_text</li><br />\n";
|
|
||||||
$expout .= " <input name=\"quest_{$id}_$count\" type=\"text\" /></li>\n";
|
|
||||||
++$count;
|
|
||||||
}
|
|
||||||
$expout .= "</ul>\n";
|
$expout .= "</ul>\n";
|
||||||
break;
|
break;
|
||||||
case NUMERICAL:
|
case NUMERICAL:
|
||||||
$expout .= "<p class=\"numerical\">\n";
|
$expout .= "<ul class=\"numerical\">\n";
|
||||||
$expout .= " <input name=\"quest_$id\" type=\"text\" />\n";
|
$expout .= " <li><input name=\"quest_$id\" type=\"text\" /></li>\n";
|
||||||
$expout .= "</p>\n";
|
$expout .= "</ul>\n";
|
||||||
break;
|
break;
|
||||||
case MATCH:
|
case MATCH:
|
||||||
$expout .= "<ul class=\"match\">\n";
|
$expout .= "<ul class=\"match\">\n";
|
||||||
$count = 0;
|
|
||||||
|
// build answer list
|
||||||
|
$ans_list = array();
|
||||||
foreach($question->subquestions as $subquestion) {
|
foreach($question->subquestions as $subquestion) {
|
||||||
$ans_text = $this->repchar( $subquestion->questiontext );
|
$ans_list[] = $this->repchar( $subquestion->answertext );
|
||||||
$expout .= " <li>$ans_text</li><br />\n";
|
}
|
||||||
$expout .= " <input name=\"quest_{$id}_$count\" type=\"text\" /></li>\n";
|
shuffle( $ans_list ); // random display order
|
||||||
++$count;
|
|
||||||
|
// build drop down for answers
|
||||||
|
$dropdown = "<select name=\"quest_$id\">\n";
|
||||||
|
foreach($ans_list as $ans) {
|
||||||
|
$dropdown .= "<option value=\"$ans\">$ans</option>\n";
|
||||||
|
}
|
||||||
|
$dropdown .= "</select>\n";
|
||||||
|
|
||||||
|
// finally display
|
||||||
|
foreach($question->subquestions as $subquestion) {
|
||||||
|
$quest_text = $this->repchar( $subquestion->questiontext );
|
||||||
|
$expout .= " <li>$quest_text</li>\n";
|
||||||
|
$expout .= $dropdown;
|
||||||
}
|
}
|
||||||
$expout .= "</ul>\n";
|
$expout .= "</ul>\n";
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue