moodle/mod/glossary/mod.html
stronk7 d698fea233 Some $ME are now out!
Merged from MOODLE_14_STABLE
2005-02-27 00:12:25 +00:00

513 lines
18 KiB
HTML

<?php // $Id$
include_once($CFG->dirroot.'/mod/glossary/lib.php');
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->allowprintview)) {
$form->allowprintview = 1;
}
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 = 'dictionary';
}
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;
}
if (!isset($form->editalways)) {
$form->editalways = 0;
}
if (!isset($form->rsstype)) {
$form->rsstype = 0;
}
if (!isset($form->rssarticles)) {
$form->rssarticles = 0;
}
if (!isset($form->assessed)) {
$form->assessed = 0;
}
if (!isset($form->scale)) {
$form->scale = 0;
}
if (!isset($form->assesstimestart)) {
$form->assesstimestart = 0;
}
if (!isset($form->assesstimefinish)) {
$form->assesstimefinish = 0;
}
?>
<form name="form" method="post" action="mod.php">
<center>
<table cellpadding="5">
<tr valign="top">
<td align="right"><b><?php print_string("name") ?>:</b></td>
<td align="left">
<input type="text" name="name" size="30" value="<?php p($form->name) ?>" />
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php print_string("description") ?>:</b><br />
<?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);
?>
</td>
<td align="left">
<?php print_textarea($usehtmleditor, 20, 50, 680, 400, "intro", $form->intro); ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("entbypage", "glossary") ?>:</b></td>
<td align="left">
<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"><b><?php echo get_string("isglobal", "glossary") ?>:</b></td>
<td align="left">
<?php
$selected = '';
if ($form->globalglossary) {
$selected = 'checked="checked"';
}
?>
<input type="checkbox" name="globalglossary" value="1" <?php p($selected)?> /> <?php helpbutton("globalglossary", get_string("globalglossary", "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"><b><?php echo get_string("glossarytype", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="mainglossary">
<option value="1" <?php
if ( $form->mainglossary ) {
echo "selected=\"selected\"";
}
?>>
<?php echo get_string("mainglossary", "glossary") ?></option>
<option value="0" <?php
if ( !$form->mainglossary ) {
echo "selected=\"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"><b><?php p(get_string("studentcanpost", "glossary")) ?>:</b><br />
<font size="1"><?php p(get_string("warningstudentcapost","glossary")) ?></font></td>
<td align="left">
<select size="1" name="studentcanpost">
<option value="1" <?php
if ( $form->studentcanpost ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->studentcanpost ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("studentcanpost", get_string("studentcanpost", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("allowduplicatedentries", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="allowduplicatedentries">
<option value="1" <?php
if ( $form->allowduplicatedentries ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->allowduplicatedentries ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("allowduplicatedentries", get_string("allowduplicatedentries", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("allowcomments", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="allowcomments">
<option value="1" <?php
if ( $form->allowcomments ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->allowcomments ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("allowcomments", get_string("allowcomments", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("allowprintview", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="allowprintview">
<option value="1" <?php
if ( $form->allowprintview ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->allowprintview ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("allowprintview", get_string("allowprintview", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("usedynalink", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="usedynalink">
<option value="1" <?php
if ( $form->usedynalink ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->usedynalink ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("usedynalink", get_string("usedynalink", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("defaultapproval", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="defaultapproval">
<option value="1" <?php
if ( $form->defaultapproval ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->defaultapproval ) {
echo "selected=\"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"><b><?php echo get_string("displayformat", "glossary") ?>:</b></td>
<td align="left">
<?php
//get and update available formats
$recformats = glossary_get_available_formats();
//reload current format, because of it has changed (deleted format)
if (isset($form->id)) {
if ($currentglossary = get_record("glossary",'id',$form->id)) {
$form->displayformat = $currentglossary->displayformat;
}
}
$formats = array();
//Take names
foreach ($recformats as $format) {
$formats[$format->name] = get_string("displayformat$format->name", "glossary");
}
//Sort it
asort($formats);
choose_from_menu($formats,'displayformat',$form->displayformat,'');
?>
<?php helpbutton("displayformat", get_string("displayformat", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("showspecial", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="showspecial">
<option value="1" <?php
if ( $form->showspecial ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->showspecial ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("shows", get_string("showspecial", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("showalphabet", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="showalphabet">
<option value="1" <?php
if ( $form->showalphabet ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->showalphabet ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("shows", get_string("showalphabet", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("showall", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="showall">
<option value="1" <?php
if ( $form->showall ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->showall ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("shows", get_string("showall", "glossary"), "glossary") ?>
</td>
</tr>
<tr valign="top">
<td align="right"><b><?php echo get_string("editalways", "glossary") ?>:</b></td>
<td align="left">
<select size="1" name="editalways">
<option value="1" <?php
if ( $form->editalways ) {
echo "selected=\"selected\"";
}
?>
><?php echo get_string("yes") ?></option>
<option value="0" <?php
if ( !$form->editalways ) {
echo "selected=\"selected\"";
}
?>><?php echo get_string("no") ?>
</option>
</select> <?php helpbutton("editalways", get_string("editalways", "glossary"), "glossary") ?>
</td>
</tr>
<?php
//Only show rss parameters if rss is activated at site and glossary levels
if (isset($CFG->enablerssfeeds) && isset($CFG->glossary_enablerssfeeds) &&
$CFG->enablerssfeeds && $CFG->glossary_enablerssfeeds) {
echo "<tr valign=\"top\">";
echo "<td align=\"right\"><b>".get_string("rsstype").":</b></td>";
echo "<td align=\"left\">";
unset($choices);
$choices[0] = get_string("none");
$choices[1] = get_string("withauthor", "glossary");
$choices[2] = get_string("withoutauthor", "glossary");
choose_from_menu ($choices, "rsstype", $form->rsstype, "");
helpbutton("rsstype", get_string("rsstype"), "glossary");
echo "</td>";
echo "</tr>";
echo "<tr valign=\"top\">";
echo "<td align=\"right\"><b>".get_string("rssarticles").":</b></td>";
echo "<td align=\"left\">";
unset($choices);
$choices[0] = "0";
$choices[1] = "1";
$choices[2] = "2";
$choices[3] = "3";
$choices[4] = "4";
$choices[5] = "5";
$choices[10] = "10";
$choices[15] = "15";
$choices[20] = "20";
$choices[25] = "25";
$choices[30] = "30";
$choices[40] = "40";
$choices[50] = "50";
choose_from_menu ($choices, "rssarticles", $form->rssarticles, "");
helpbutton("rssarticles", get_string("rssarticles"), "glossary");
echo "</td>";
echo "</tr>";
}
?>
<tr>
<td align="right" valign="top"><b><?php print_string("allowratings", "glossary") ?>:</b></td>
<td align="left">
<?php
echo "<script type=\"text/javascript\">";
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=\"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 "\n\n<table cellpadding=\"5\" align=\"left\">";
echo "<tr><td align=\"right\" nowrap=\"nowrap\">";
echo get_string("users").":";
echo "</td><td align=\"left\" nowrap=\"nowrap\">";
choose_from_menu($options, "assessed", $form->assessed, "");
echo "</td></tr>";
echo "<tr><td align=\"right\" nowrap=\"nowrap\">";
echo get_string("grade").":";
echo "</td><td align=\"left\" nowrap=\"nowrap\">";
print_grade_menu($course->id, "scale", $form->scale, false);
echo "</td></tr></table>\n\n";
echo "<br clear=\"all\" />";
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=\"checked\" ";
}
echo " />";
print_string("ratingtime", "glossary");
echo "<table cellpadding=\"5\" align=\"left\"><tr><td align=\"right\" nowrap=\"nowrap\">";
echo get_string("from").":";
echo "</td><td align=\"left\" nowrap=\"nowrap\">";
print_date_selector("startday", "startmonth", "startyear", $form->assesstimestart);
print_time_selector("starthour", "startminute", $form->assesstimestart);
echo "</td></tr>";
echo "<tr><td align=\"right\" nowrap=\"nowrap\">";
echo get_string("to").":";
echo "</td><td align=\"left\" nowrap=\"nowrap\">";
print_date_selector("finishday", "finishmonth", "finishyear", $form->assesstimefinish);
print_time_selector("finishhour", "finishminute", $form->assesstimefinish);
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 type=\"text/javascript\">";
echo "lockoptions('form','userating', subitemsall);";
echo "</script>";
if (empty($form->ratingtime)) {
echo "<script type=\"text/javascript\">";
echo "lockoptions('form','ratingtime', subitemstime);";
echo "</script>";
}
?>
</td>
</tr>
<?php print_visible_setting($form); ?>
</table>
<!-- These hidden variables are always the same -->
<input type="hidden" name="course" value="<?php p($form->course) ?>" />
<input type="hidden" name="sesskey" value="<?php p($form->sesskey) ?>" />
<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>