<?php
    if (!isset($form->name)) {
        $form->name = "";
    }
    if (!isset($form->type)) {
        $form->type = "";
    }
    if (!isset($form->intro)) {
        $form->intro = "";
    }
    if (!isset($form->open)) {
        $form->open = 2;
    }
    if (!isset($form->assessed)) {
        $form->assessed = "";
    }
    if (!isset($form->forcesubscribe)) {
        $form->forcesubscribe = "";
    }
?>
<form name="form" method="post" <?php echo $onsubmit ?> action="mod.php">
<table cellpadding=5>
<tr>
<tr valign=top>
    <td align=right><p><b><?php print_string("forumname", "forum")?>:</b></p></td>
    <td>
        <input type="text" name="name" size=30 value="<?php p($form->name) ?>">
    </td>
</tr>
<tr valign=top>
    <td align=right><p><b><?php print_string("forumtype", "forum")?>:</b></p></td>
    <td>
    <?php
       $student = strtolower($course->student);
       require("$CFG->dirroot/mod/forum/lib.php");
       asort($FORUM_TYPES);
       if (! $form->type) {
           $form->type = "general";
       }
       if ($form->type == "news") {
           print_string("namenews", "forum");
           echo "<input type=\"hidden\" name=\"type\" value=\"news\">";
       } else if ($form->type == "social") {
           print_string("namesocial", "forum");
           echo "<input type=\"hidden\" name=\"type\" value=\"social\">";
       } else {
           choose_from_menu($FORUM_TYPES, "type", $form->type, "");
           helpbutton("forumtype", get_string("forumtype", "forum"), "forum");
       }
    ?>

    </td>
</tr>
<tr valign=top>
    <td align=right><p><b><?php print_string("forumintro", "forum")?>:</b></p>
    <font size="1">
     <?php
        helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
        echo "<br />";
        helpbutton("questions", get_string("helpquestions"), "moodle", true, true);
        echo "<br />";
        emoticonhelpbutton("form", "intro");
        echo " <br />";
      ?>
    </font>
    </td>
    <td>
        <textarea name="intro" rows=4 cols=50 wrap="virtual"><?php p($form->intro) ?></textarea>
    </td>
</tr>

<tr valign=top>
    <td align=right><p><b><?php print_string("allowdiscussions", "forum", strtolower("$course->student")) ?>:</b></p></td>
    <td>
        <?php 
            choose_from_menu($FORUM_OPEN_MODES, "open", $form->open, "");
            helpbutton("allowdiscussions", get_string("allowdiscussions", 
                       "forum", strtolower("$course->student")), "forum");
        ?>
    </td>
</tr>

<tr>
    <td align=right><p><b><?php print_string("allowratings", "forum") ?>:</b></p></td>
    <td>
        <?php 
            $options[0] = get_string("no"); 
            $options[1] = get_string("yes");
            choose_from_menu($options, "assessed", $form->assessed, "");
            helpbutton("ratings", get_string("allowratings", "forum"), "forum");
        ?>
    </td>
</tr>
<tr>
    <td align=right><p><b><?php print_string("forcesubscribeq", "forum") ?>:</b></p></td>
    <td>
        <?php 
            choose_from_menu($options, "forcesubscribe", $form->forcesubscribe, "");
            helpbutton("subscription", get_string("forcesubscribeq", "forum"), "forum");
        ?>
    </td>
</tr>
</table>
<center>
<input type="hidden" name=course     value="<? p($form->course) ?>">
<input type="hidden" name=coursemodule  value="<? p($form->coursemodule) ?>">
<input type="hidden" name=section       value="<? p($form->section) ?>">
<input type="hidden" name=module     value="<? p($form->module) ?>">
<input type="hidden" name=modulename value="<? p($form->modulename) ?>">
<input type="hidden" name=instance   value="<? p($form->instance) ?>">
<input type="hidden" name=mode       value="<? p($form->mode) ?>">
<input type="submit" value="<? print_string("savechanges") ?>">
<input type="submit" name=cancel value="<? print_string("cancel") ?>">
</center>
</form>
