As discussed in the thread http://moodle.org/mod/forum/discuss.php?d=30628 (and others) the limitation to 10 answers in a question is problematic for some users. I modified the match questiontype to (a) display all defined answers (e.g. from an import with more than 10 answers) and (b) to always display one additional empty answer field.

This commit is contained in:
mindforge
2005-09-16 09:12:25 +00:00
parent 435241d385
commit a67c2e0a33
2 changed files with 14 additions and 10 deletions
+13 -9
View File
@@ -7,18 +7,22 @@
}
}
if (empty($subquestions) and empty($subanswers)) {
for ($i=0 ; $i < QUIZ_MAX_NUMBER_ANSWERS ; $i++) {
$subquestions = array();
$subanswers = array();
if (!empty($oldsubquestions)) {
foreach ($oldsubquestions as $oldsubquestion) {
$subquestions[] = $oldsubquestion->questiontext; // insert questions into slots
$subanswers[] = $oldsubquestion->answertext; // insert answers into slots
}
}
$i = count($subquestions);
$limit = QUIZ_MAX_NUMBER_ANSWERS;
$limit = $limit < $i ? $i+1 : $limit;
for (; $i < $limit; $i++) {
$subquestions[] = ""; // Make question slots, default as blank
$subanswers[] = ""; // Make answer slots, default as blank
}
if (!empty($oldsubquestions)) {
$i=0;
foreach ($oldsubquestions as $oldsubquestion) {
$subquestions[$i] = $oldsubquestion->questiontext; // insert questions into slots
$subanswers[$i] = $oldsubquestion->answertext; // insert answers into slots
$i++;
}
}
}
print_heading_with_help(get_string("editingmatch", "quiz"), "match", "quiz");
require("$CFG->dirroot/mod/quiz/questiontypes/match/match.html");
+1 -1
View File
@@ -76,7 +76,7 @@
</td>
</tr>
<?php
for ($i=1; $i<=QUIZ_MAX_NUMBER_ANSWERS; $i++) {
for ($i=1; $i <= count($subquestions); $i++) {
?>
<tr valign="top">
<td align="right"><b><?php echo get_string("question", "quiz")." $i"; ?> :</b></td>