<?php
    if (!isset($form->name)) {
        $form->name = "";
    }
    if (!isset($form->intro)) {
        $form->intro = "";
    }
    if (!isset($form->keepdays)) {
        $form->keepdays = 30;
    }
    if (!isset($form->studentlogs)) {
        $form->studentlogs = 0;
    }
    if (!isset($form->chattime)) {
        $form->chattime = 0;
    }
    if (!isset($form->schedule)) {
        $form->schedule = 0;
    }
?>
<form name="form" method="post" action="mod.php">
<table cellpadding=5>
<tr>
<tr valign=top>
    <td align=right><p><b><?php print_string("chatname", "chat")?>:</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("chatintro", "chat")?>:</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>
        <?php print_textarea($usehtmleditor, 20, 50, 680, 400, "intro", $form->intro); ?>
    </td>
</tr>
<tr valign=top>
    <td align=right><p><b><?php print_string("chattime", "chat") ?>:</b></td>
    <td><?php
           print_date_selector("chatday", "chatmonth", "chatyear", $form->chattime);
           echo "&nbsp;-&nbsp;";
           print_time_selector("chathour", "chatminute", $form->chattime);
    ?></td>
</tr>
<tr valign=top>
    <td align=right><p><b><?php print_string("repeattimes", "chat") ?>:</b></td>
    <td><?php
       unset($options);
       $options[0]  = get_string("donotusechattime", "chat");
       $options[1]  = get_string("repeatnone", "chat");
       $options[2]  = get_string("repeatdaily", "chat");
       $options[3]  = get_string("repeatweekly", "chat");
       choose_from_menu ($options, "schedule", $form->schedule, "", "", "");
    ?></td>
</tr>
<tr valign=top>
	<td align=right><p><b><?php print_string("savemessages", "chat")?>:</b></p>
	<td>
    <?php 
       unset($options);
       $options[0]    = get_string("neverdeletemessages", "chat");
       $options[365]  = get_string("numdays", "", 365);
       $options[180]  = get_string("numdays", "", 180);
       $options[150]  = get_string("numdays", "", 150);
       $options[120]  = get_string("numdays", "", 120);
       $options[90]   = get_string("numdays", "", 90);
       $options[60]   = get_string("numdays", "", 60);
       $options[30]   = get_string("numdays", "", 30);
       $options[21]   = get_string("numdays", "", 21);
       $options[14]   = get_string("numdays", "", 14);
       $options[7]    = get_string("numdays", "", 7);
       $options[2]    = get_string("numdays", "", 2);

       choose_from_menu ($options, "keepdays", $form->keepdays, "", "", "");
    ?>
    </td>
</tr>
<tr valign=top>
	<td align=right><p><b><?php print_string("studentseereports", "chat")?>:</b></p>
	<td>
    <?php 
       unset($options);
       $options[0]    = get_string("no");
       $options[1]    = get_string("yes");
       choose_from_menu ($options, "studentlogs", $form->studentlogs, "", "", "");
    ?>
    </td>
</tr>

</table>
<center>
<input type="hidden" name=course     value="<?php  p($form->course) ?>">
<input type="hidden" name=coursemodule  value="<?php  p($form->coursemodule) ?>">
<input type="hidden" name=section       value="<?php  p($form->section) ?>">
<input type="hidden" name=module     value="<?php  p($form->module) ?>">
<input type="hidden" name=modulename value="<?php  p($form->modulename) ?>">
<input type="hidden" name=instance   value="<?php  p($form->instance) ?>">
<input type="hidden" name=mode       value="<?php  p($form->mode) ?>">
<input type="submit" value="<?php  print_string("savechanges") ?>">
<input type="submit" name=cancel value="<?php  print_string("cancel") ?>">
</center>
</form>
