<form id="theform" method="post" action="question.php">
<div class="boxaligncenter">
<table cellpadding="5">

  <tr valign="top">
    <td align="right"><b><?php print_string("category", "quiz") ?>:</b></td>
    <td align="left">
      <?php question_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 align="left">
      <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 />
      <?php
      helpbutton("questiontext", get_string("questiontext", "quiz"), "quiz", true, true);
      echo '<br />';
      if ($usehtmleditor) {
        helpbutton("richtext", get_string("helprichtext"), "moodle", true, true);
      } else {
        helpbutton("text", get_string("helptext"), "moodle", true, true);
      }
      ?>
    </td>
    <td align="left">
      <?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>
  
  <?php 
  if (!in_array('image', $hidefields)) {
    ?>
    <tr valign="top">
      <td align="right"><b><?php print_string("imagedisplay", "quiz") ?>:</b></td>
      <td align="left">
        <?php
        if (empty($images)) {
          print_string("noimagesyet");
        } else {
          choose_from_menu($images, "image", "$question->image", get_string("none"),"","");
        }
        ?>
      </td>
    </tr>
    <?php 
  }
  
  if (!in_array('defaultgrade', $hidefields)) {
    ?>
    <tr valign="top">
      <td align="right"><b><?php print_string("defaultgrade", "quiz") ?>:</b></td>
      <td align="left">
        <input type="text" name="defaultgrade" size="3" value="<?php p($question->defaultgrade) ?>" alt="<?php print_string("defaultgrade", "quiz") ?>" />

        <?php if (isset($err["defaultgrade"])) formerr($err["defaultgrade"]); ?>
      </td>
    </tr>
    <?php 
  }
  
  if (!in_array('penalty', $hidefields)) {
    ?>
    <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>
    <?php 
  }
  ?>

  <tr valign="top">
    <td align="right"><b><?php print_string("generalfeedback", "quiz") ?>:</b>
      <br /><br /><br />
      <?php
      helpbutton("generalfeedback", get_string("generalfeedback", "quiz"), "quiz", true, true);
      ?>
    </td>
    <td align="left">
      <?php
      if (isset($err["generalfeedback"])) {
        formerr($err["generalfeedback"]);
        echo "<br />";
      }
      print_textarea(false, 10, 60, 630, 200, "generalfeedback", $question->generalfeedback);
      ?>
    </td>
  </tr>
  
  <tr valign="top">
    <td colspan="2">&nbsp;</td>
  </tr>