moodle/mod/glossary/mod.html
2004-01-25 20:34:54 +00:00

414 lines
14 KiB
HTML

<!-- This page defines the form to create or edit an instance of this module -->
<!-- It is used from /course/mod.php. The whole instance is available as $form. -->
<?PHP
/// stablishing hard-coded default parameters... Will be replaced soon by global settings.
global $CFG;
if (!isset($form->studentcanpost)) {
$form->studentcanpost = $CFG->glossary_studentspost;
}
if (!isset($form->allowduplicatedentries)) {
$form->allowduplicatedentries = $CFG->glossary_dupentries;
}
if (!isset($form->allowcomments)) {
$form->allowcomments = $CFG->glossary_allowcomments;
}
if (!isset($form->usedynalink)) {
$form->usedynalink = $CFG->glossary_linkbydefault;
}
if (!isset($form->defaultapproval)) {
$form->defaultapproval = $CFG->glossary_defaultapproval;
}
if (!isset($form->entbypage)) {
$form->entbypage = $CFG->glossary_entbypage;
}
if (!isset($form->mainglossary)) {
$form->mainglossary = 0;
}
if (!isset($form->displayformat)) {
$form->displayformat = 0;
}
if ( !isset($form->globalglossary) ) {
$form->globalglossary = 0;
}
if (!isset($form->intro)) {
$form->intro = "";
}
if (!isset($form->name)) {
$form->name = "";
}
if (!isset($form->showall)) {
$form->showall = 1;
}
if (!isset($form->showalphabet)) {
$form->showalphabet = 1;
}
if (!isset($form->showspecial)) {
$form->showspecial = 1;
}
?>
<FORM name="form" method="post" action="<?=$ME ?>">
<CENTER>
<TABLE cellpadding=5>
<TR valign=top>
<TD align=right><P><B><?php print_string("name") ?>:</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("description") ?>:</b></p>
<font size="1">
<?php
helpbutton("description", get_string("description"), "glossary", true, true);
echo "<br />";
helpbutton("writing", get_string("helpwriting"), "moodle", true, true);
echo "<br />";
helpbutton("text", get_string("helptext"), "moodle", true, true);
?>
<br />
</font>
</td>
<td>
<textarea name="intro" rows=5 cols=50 wrap="virtual"><?php p($form->intro) ?></textarea>
</td>
</tr>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("entbypage", "glossary") ?>:</B></P></TD>
<TD>
<input name=entbypage type=text size=2 value="<?php p($form->entbypage) ?>"> <?php helpbutton("entbypage", get_string("entbypage", "glossary"), "glossary") ?>
</TD>
</TR>
<!-- More rows go in here... -->
<?php
if (isadmin() ) {
?>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("isglobal", "glossary") ?>:</B></P></TD>
<TD>
<?php
$selected = "";
if ( isset($form->globalglossary) ) {
if ($form->globalglossary) {
$selected = "checked";
}
}
?>
<input type="checkbox" name="globalglossary" value=1 <?PHP p($selected)?>> <?php helpbutton("globalglossary", get_string("globallossary", "glossary"), "glossary") ?>
</TD>
</TR>
<?php
} else {
echo '<INPUT type="hidden" name=globalglossary value="' . $form->globalglossary . '">';
}
?>
<?php
$mainglossary = get_record("glossary","mainglossary",1,"course",$form->course);
if (!$mainglossary or $mainglossary->id == $form->instance ) {
?>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("glossarytype", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="mainglossary">
<option value="1" <?php
if ( $form->mainglossary ) {
echo "selected";
}
?>>
<?php echo get_string("mainglossary", "glossary") ?></option>
<option value="0" <?php
if ( !$form->mainglossary ) {
echo "selected";
}
?>><?php echo get_string("secondaryglossary", "glossary") ?>
</option>
</select> <?php helpbutton("mainglossary", get_string("mainglossary", "glossary"), "glossary") ?>
</TD>
</TR>
<?php
} else {
echo "<INPUT type=\"hidden\" name=mainglossary value=\"0\">";
}
?>
<TR valign=top>
<TD align=right><P><B><?php p(get_string("studentcanpost", "glossary")) ?>:</B><br>
<font size=1><?php p(get_string("warningstudentcapost","glossary")) ?></font></P></TD>
<TD>
<select size="1" name="studentcanpost">
<option value="1" <?php
if ( $form->studentcanpost ) {
echo "selected";
}
?>><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->studentcanpost ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("studentcanpost", get_string("studentcanpost", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("allowduplicatedentries", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="allowduplicatedentries">
<option value="1" <?php
if ( $form->allowduplicatedentries ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->allowduplicatedentries ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("allowduplicatedentries", get_string("allowduplicatedentries", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("allowcomments", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="allowcomments">
<option value="1" <?php
if ( $form->allowcomments ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->allowcomments ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("allowcomments", get_string("allowcomments", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("usedynalink", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="usedynalink">
<option value="1" <?php
if ( $form->usedynalink ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->usedynalink ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("usedynalink", get_string("usedynalink", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("defaultapproval", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="defaultapproval">
<option value="1" <?php
if ( $form->defaultapproval ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->defaultapproval ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("defaultapproval", get_string("defaultapproval", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<td colspan=2><hr>
</tr>
</tr>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("displayformat", "glossary") ?>:</B></P></TD>
<TD>
<?php
$formats = array();
$formats[0] = get_string("displayformatdefault", "glossary");
$formats[1] = get_string("displayformatcontinuous", "glossary");
$basedir = opendir("$CFG->dirroot/mod/glossary/formats");
while ($dir = readdir($basedir)) {
$firstchar = substr($dir, 0, 1);
if ($firstchar == "." or $dir == "CVS" or $dir == "_vti_cnf") {
continue;
}
if (filetype("$CFG->dirroot/mod/glossary/formats/$dir") == "dir") {
continue;
}
if ( $pos = strpos($dir, ".") ) {
$dir = substr($dir, 0, $pos );
if ($dir != 0 and $dir != 1) { // excluding basic formats
$dp = get_record("glossary_displayformats","fid",$dir);
if ( !$dp or $dp->visible ) {
$formats[$dir] = get_string("displayformat$dir", "glossary");
}
}
}
}
asort($formats);
choose_from_menu ($formats, "displayformat", $form->displayformat, "");
?>
</select> <?php helpbutton("displayformat", get_string("displayformat", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("showspecial", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="showspecial">
<option value="1" <?php
if ( $form->showspecial ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->showspecial ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("shows", get_string("showspecial", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("showalphabet", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="showalphabet">
<option value="1" <?php
if ( $form->showalphabet ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->showalphabet ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("shows", get_string("showalphabet", "glossary"), "glossary") ?>
</TD>
</TR>
<TR valign=top>
<TD align=right><P><B><?php echo get_string("showall", "glossary") ?>:</B></P></TD>
<TD>
<select size="1" name="showall">
<option value="1" <?php
if ( $form->showall ) {
echo "selected";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->showall ) {
echo "selected";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("shows", get_string("showall", "glossary"), "glossary") ?>
</TD>
</TR>
<tr>
<td align=right valign=top><p><b><?php print_string("allowratings", "glossary") ?>:</b></p></td>
<td>
<?php
echo "<script>";
echo " var subitemstime = ['startday','startmonth','startyear','starthour', 'startminute',".
"'finishday','finishmonth','finishyear','finishhour','finishminute'];";
echo " var subitemsall = ['assessed', '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", "glossary").":";
echo "<br />";
// The odd order below was to maintain backward compatibility
unset($options);
$options[2] = get_string("ratingonlyteachers", "glossary", moodle_strtolower($course->teachers));
$options[1] = get_string("ratingeveryone", "glossary");
echo get_string("users").":";
choose_from_menu($options, "assessed", $form->assessed, "");
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", "glossary");
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=\"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>
<!-- These hidden variables are always the same -->
<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") ?>">
</CENTER>
</FORM>