Skip to content
Permalink
Browse files

Missingtype now also works without notices when the missing question …

…has no answers.
  • Loading branch information...
gustav_delius
gustav_delius committed Apr 30, 2006
1 parent ed28abc commit 2be604b665e3f3501c98239e5b6c93e7e73a96c2
Showing with 23 additions and 20 deletions.
  1. +15 −15 question/type/missingtype/display.html
  2. +8 −5 question/type/missingtype/questiontype.php
@@ -1,4 +1,3 @@
<?php notify('This question is of a type that has not been installed on your Moodle yet.<br />Please alert your Moodle administrator.'); ?>
<div class="qtext">
<?php echo $questiontext; ?>
</div>
@@ -7,18 +6,19 @@
<img class="qimage" src="<?php echo $image; ?>" alt="" />
<?php } ?>

<div class="ablock clearfix">
<div class="prompt">
<?php print_string('answers', 'quiz'); ?>
<?php if ($anss) { ?>
<div class="ablock clearfix">
<div class="prompt">
<?php print_string('answers', 'quiz'); ?>
</div>
<table class="answer">
<?php $row = 1; foreach ($anss as $answer) { ?>
<tr class="<?php echo 'r'.$row = $row ? 0 : 1; ?>">
<td class="c1 text">
<?php echo $answer->text; ?>
</td>
</tr>
<?php } ?>
</table>
</div>

<table class="answer">
<?php $row = 1; foreach ($anss as $answer) { ?>
<tr class="<?php echo 'r'.$row = $row ? 0 : 1; ?>">
<td class="c1 text">
<?php echo $answer->text; ?>
</td>
</tr>
<?php } ?>
</table>
</div>
<?php } ?>
@@ -34,11 +34,14 @@ function print_question_formulation_and_controls(&$question, &$state, $cmoptions
$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");
}

0 comments on commit 2be604b

Please sign in to comment.
You can’t perform that action at this time.