moodle/mod/forum/mod.html

211 lines
8.5 KiB
HTML

<?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 = 0;
}
if (!isset($form->assesspublic)) {
$form->assesspublic = 0;
}
if (!isset($form->forcesubscribe)) {
$form->forcesubscribe = 0;
}
if (!isset($form->maxbytes)) {
$form->maxbytes = $CFG->forum_maxbytes;
}
?>
<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", moodle_strtolower("$course->student")), "forum");
?>
</td>
</tr>
<tr>
<td align=right><p><b><?php print_string("forcesubscribeq", "forum") ?>:</b></p></td>
<td>
<?php
unset($options);
$options[0] = get_string("no");
$options[1] = get_string("yes");
choose_from_menu($options, "forcesubscribe", $form->forcesubscribe, "");
helpbutton("subscription", get_string("forcesubscribeq", "forum"), "forum");
?>
</td>
</tr>
<tr valign=top>
<td align=right><p><b><?php print_string("maxattachmentsize", "forum") ?>:</b></p></td>
<td>
<?php
$choices = get_max_upload_sizes($CFG->maxbytes, $course->maxbytes);
$choices[0] = get_string("courseuploadlimit") . " (".display_size($course->maxbytes).")";
choose_from_menu ($choices, "maxbytes", $form->maxbytes, "");
helpbutton("maxattachmentsize", get_string("maxattachmentsize", "forum"), "forum");
?>
</td>
</tr>
<tr>
<td align=right valign=top><p><b><?php print_string("allowratings", "forum") ?>:</b></p></td>
<td>
<?php
echo "<script>";
echo " var subitemstime = ['startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo " var subitemsall = ['assessed', 'assesspublic', 'ratingtime', 'scale', ".
"'startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo "</script>";
echo "<input name=\"userating\" type=checkbox value=1 ";
echo " onclick=\"return lockoptions('form','userating', subitemsall)\" ";
if ($form->assessed) {
echo " checked ";
}
echo ">";
echo get_string("ratingsuse", "forum").":";
echo "<br />";
// The odd order below was to maintain backward compatibility
unset($options);
$options[2] = get_string("ratingonlyteachers", "forum", moodle_strtolower($course->teachers));
$options[1] = get_string("ratingeveryone", "forum");
echo get_string("users").":";
choose_from_menu($options, "assessed", $form->assessed, "");
echo "<br />";
unset($options);
$options[0] = get_string("ratingpublicnot", "forum", $course->students);
$options[1] = get_string("ratingpublic", "forum", $course->students);
echo get_string("view").":";
choose_from_menu($options, "assesspublic", $form->assesspublic, "");
echo "<br />";
echo get_string("grade").":";
print_grade_menu($course->id, "scale", $form->scale, false);
echo "<br />";
echo "<input name=\"ratingtime\" type=checkbox value=1 ";
echo " onclick=\"return lockoptions('form','ratingtime', subitemstime)\" ";
if ($form->assesstimestart and $form->assesstimefinish and $form->assessed) {
$form->ratingtime = 1;
echo " checked ";
}
echo ">";
print_string("ratingtime", "forum");
echo "<table align=left><tr><td align=right nowrap>";
echo get_string("from").":";
print_date_selector("startday", "startmonth", "startyear", $form->assesstimestart);
print_time_selector("starthour", "startminute", $form->assesstimestart);
echo "<br />";
echo get_string("to").":";
print_date_selector("finishday", "finishmonth", "finishyear", $form->assesstimefinish);
print_time_selector("finishhour", "finishminute", $form->assesstimefinish);
echo "<br />";
echo "</td></tr></table>";
echo "<input type=\"hidden\" name=\"hratingtime\" value=0>";
echo "<input type=\"hidden\" name=\"hassessed\" value=0>";
echo "<input type=\"hidden\" name=\"hassesspublic\" value=0>";
echo "<input type=\"hidden\" name=\"hscale\" value=0>";
echo "<input type=\"hidden\" name=\"hstartday\" value=0>";
echo "<input type=\"hidden\" name=\"hstartmonth\" value=0>";
echo "<input type=\"hidden\" name=\"hstartyear\" value=0>";
echo "<input type=\"hidden\" name=\"hstarthour\" value=0>";
echo "<input type=\"hidden\" name=\"hstartminute\" value=0>";
echo "<input type=\"hidden\" name=\"hfinishday\" value=0>";
echo "<input type=\"hidden\" name=\"hfinishmonth\" value=0>";
echo "<input type=\"hidden\" name=\"hfinishyear\" value=0>";
echo "<input type=\"hidden\" name=\"hfinishhour\" value=0>";
echo "<input type=\"hidden\" name=\"hfinishminute\" value=0>";
echo "<script>";
echo "lockoptions('form','userating', subitemsall);";
echo "</script>";
if (empty($form->ratingtime)) {
echo "<script>";
echo "lockoptions('form','ratingtime', subitemstime);";
echo "</script>";
}
?>
</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>