<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 align="left">
    <?php echo $categories[$question->category]; ?>
    <input type="hidden" name="category" value="<?php echo "$question->category"; ?>" />
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("questionname", "quiz") ?>:</b></td>
    <td align="left">
        <?php
           if (empty($question->name)) {
               $question->name =  get_string("randomsamatch", "quiz");
           }
        ?>
        <input type="text" name="name" size="40" value="<?php  p($question->name) ?>" />
        <?php  if (isset($err["name"])) formerr($err["name"]); ?>
    </td>
</tr>
<tr valign="top">
    <td align="right"><b><?php  print_string("introduction", "quiz") ?>:</b>
    <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 align="left">
        <?php  if (isset($err["questiontext"])) {
               formerr($err["questiontext"]);
               echo "<br />";
           }
           if (empty($question->questiontext)) {
               $question->questiontext =  get_string("randomsamatchintro", "quiz");
           }
           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 (empty($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("penaltyfactor", "quiz") ?>:</b></td>
    <td align="left">
        <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("randomsamatchnumber", "quiz") ?>:</b></td>
    <td align="left">
    <?php
        if ($numberavailable < 2) {
            echo get_string('createfirst', 'quiz');
            $maxrandom=2;
        } else if ($numberavailable < 6) {
            $maxrandom = $numberavailable;
        } else {
            $maxrandom = QUIZ_MAX_NUMBER_ANSWERS;
        }
        for ($i=2;$i<=$maxrandom;$i++) {
            $menu[$i] = $i;
        }
        choose_from_menu($menu, "choose", "$options->choose", "");
        unset($menu);
     ?>
    </td>
</tr>
<?php
    $QUIZ_QTYPES[$question->qtype]->print_replacement_options($question, $course, $contextquiz);
    $QUIZ_QTYPES[$question->qtype]->print_question_form_end($question);
?>
</table>
</center>
</form>
