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:
@@ -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");
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user