<form name="theform" method="post" action="question.php">
<center>
<table cellpadding="5">
<tr valign="top">
    <td align="right"><b><?php  print_string("category", "quiz") ?>:</b></td>
    <td>
    <?php   quiz_category_select_menu($course->id, true, true, $question->category); ?>
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
    <td>
        <input type="text" name="name" size="50" value="<?php  p($question->name) ?>" alt="<?php  print_string("questionname", "quiz") ?>" />
        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("question", "quiz") ?>:</b>
    <br />
    <br />
    <br />
    <font size="1">
    <?php
           if ($usehtmleditor) {
               helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
           } else {
               helpbutton("text", get_string("helptext"), "moodle", true, true);
           }
    ?>
    </font>
    </td>
    <td>
        <?php  if (isset($err["questiontext"])) {
               formerr($err["questiontext"]);
               echo "<br />";
           }

           print_textarea($usehtmleditor, 15, 60, 630, 300, "questiontext", $question->questiontext);

           if ($usehtmleditor) {
               echo '<input type="hidden" name="questiontextformat" value="'.FORMAT_HTML.'" />';
           } else {
               echo "<div align=\"right\">";
               print_string("formattexttype");
               echo ":&nbsp;";
               if (!isset($question->questiontextformat)) {
                   $question->questiontextformat = FORMAT_MOODLE;
               }
               choose_from_menu(format_text_menu(), "questiontextformat", $question->questiontextformat, "");
               helpbutton("textformat", get_string("helpformatting"));
               echo "</div>";
           }
        ?>
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("imagedisplay", "quiz") ?>:</b></td>
    <td>
    <?php   if (empty($images)) {
            print_string("noimagesyet");
        } else {
            choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
        }
    ?>
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("penaltyfactor", "quiz") ?>:</b></td>
    <td>
        <input type="text" name="penalty" size="3" value="<?php  p($question->penalty) ?>" alt="<?php  print_string("penaltyfactor", "quiz") ?>" />
        <?php helpbutton('penalty', get_string('penalty', 'quiz'), 'quiz'); ?>
        <?php  if (isset($err["penalty"])) formerr($err["penalty"]); ?>
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("correctanswer", "quiz") ?>:</b></td>
    <td>
        <input align="left" type="text" id="correct0" name="answer[]" size="10" value="<?php p($answer->answer) ?>" alt="<?php  print_string("correctanswer", "quiz") ?>" />
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("acceptederror", "quiz"); ?>:</b></td>
    <td>
        <input align="left" type="text" id="acceptederror0" name="tolerance[]" size="10" value="<?php p($tolerance); ?>" alt="<?php  print_string("acceptederror", "quiz"); ?>" />&plusmn;
        <input type="hidden" name="fraction[]" value="1" />
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("feedback", "quiz") ?>:</b></td>
    <td>
        <textarea name="feedback[]" rows="2" cols="50"><?php  p($answer->feedback); ?></textarea>
    </td>
</tr>
<tr valign="top">
<td align="right"><b><?php  print_string("unit", "quiz") ?>:</b></td>
    <td><?php
    if (isset($units[0]) && 1.0 === (float)$units[0]->multiplier) {
        $unit = $units[0]->unit;
    } else {
        $unit = '';
    }
    $multiplier = '1.0';
    ?>
    <input type="hidden" name="multiplier[]" value="<?php p($multiplier) ?>" />
    <input align="left" type="text" id="defaultunit" name="unit[]" size="10" value="<?php p($unit) ?>" alt="<?php print_string("unit", "quiz") ?>" />
    <b>(<?php  print_string("optional", "quiz") ?>)</b>
    </td>
</tr>
<tr valign="top">
<td></td>
<td align="left"><b><?php  print_string("alternativeunits", "quiz") ?>:</b></td>
<td></td>
</tr>
<?php
for ($i = 1; $i < 6; $i++) {
    if (isset($units[$i])) {
        $multiplier = (float)$units[$i]->multiplier;
        $unit = $units[$i]->unit;
    } else {
        $multiplier = '';
        $unit = '';
    }
?>
<tr valign="top">
<td></td>
    <td align="left">
        <b><?php  print_string("multiplier", "quiz") ?>:</b>
        <input type="text" size="10" name="multiplier[]" value="<?php  p($multiplier) ?>"
                alt="<?php print_string("multiplier", "quiz") ?>" />
        <b>&nbsp;&nbsp;&nbsp;<?php p("unit", "quiz") ?>:</b>
        <input type="text" name="unit[]" size="5" value="<?php  p($unit) ?>" />
    </td>
</tr>
<?php
} /// END for

    $QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
    $QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
</center>
</form>
