2 /// This file allows to manage the default behaviour of the display formats
4 require_once("../../config.php");
5 require_once($CFG->libdir
.'/adminlib.php');
6 require_once("lib.php");
8 $id = required_param('id', PARAM_INT
);
9 $mode = optional_param('mode');
11 admin_externalpage_setup('managemodules'); // this is hacky, tehre should be a special hidden page for it
13 if ( !$displayformat = get_record("glossary_formats","id",$id) ) {
14 error ("Invalid Glossary Format");
17 $form = data_submitted();
18 if ( $mode == 'visible' ) {
19 if ( $displayformat ) {
20 if ( $displayformat->visible
) {
21 $displayformat->visible
= 0;
23 $displayformat->visible
= 1;
25 update_record("glossary_formats",$displayformat);
27 redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=modsettingglossary#glossary_formats_header");
29 } elseif ( $mode == 'edit' and $form) {
31 $displayformat->popupformatname
= $form->popupformatname
;
32 $displayformat->showgroup
= $form->showgroup
;
33 $displayformat->defaultmode
= $form->defaultmode
;
34 $displayformat->defaulthook
= $form->defaulthook
;
35 $displayformat->sortkey
= $form->sortkey
;
36 $displayformat->sortorder
= $form->sortorder
;
38 update_record("glossary_formats",$displayformat);
39 redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=modsettingglossary#glossary_formats_header");
43 $strmodulename = get_string("modulename", "glossary");
44 $strdisplayformats = get_string("displayformats","glossary");
46 admin_externalpage_print_header();
48 print_heading($strmodulename . ': ' . get_string("displayformats","glossary"));
50 print_simple_box("<center>".get_string("configwarning", 'admin')."</center>", "center", "60%");
53 $yes = get_string("yes");
54 $no = get_string("no");
56 echo '<form method="post" action="formats.php" id="form">';
57 echo '<table width="90%" align="center" class="generalbox">';
60 <td colspan
="3" align
="center"><strong
>
61 <?php
echo get_string('displayformat'.$displayformat->name
,'glossary'); ?
>
65 <td align
="right" width
="20%"><?php
print_string('popupformat','glossary'); ?
></td
>
68 //get and update available formats
69 $recformats = glossary_get_available_formats();
74 foreach ($recformats as $format) {
75 $formats[$format->name
] = get_string("displayformat$format->name", "glossary");
80 choose_from_menu($formats,'popupformatname',$displayformat->popupformatname
);
84 <?php
print_string("cnfrelatedview", "glossary") ?
><br
/><br
/>
88 <td align
="right" width
="20%"><?php
print_string('defaultmode','glossary'); ?
></td
>
90 <select size
="1" name
="defaultmode">
96 switch ( strtolower($displayformat->defaultmode
) ) {
98 $sletter = ' selected="selected" ';
102 $scat = ' selected="selected" ';
106 $sdate = ' selected="selected" ';
110 $sauthor = ' selected="selected" ';
114 <option value
="letter" <?php
p($sletter)?
>><?php
print_string("letter", "glossary"); ?
></option
>
115 <option value
="cat" <?php
p($scat)?
>><?php
print_string("cat", "glossary"); ?
></option
>
116 <option value
="date" <?php
p($sdate)?
>><?php
print_string("date", "glossary"); ?
></option
>
117 <option value
="author" <?php
p($sauthor)?
>><?php
print_string("author", "glossary"); ?
></option
>
121 <?php
print_string("cnfdefaultmode", "glossary") ?
><br
/><br
/>
125 <td align
="right" width
="20%"><?php
print_string('defaulthook','glossary'); ?
></td
>
127 <select size
="1" name
="defaulthook">
131 $sallcategories = '';
132 $snocategorised = '';
133 switch ( strtolower($displayformat->defaulthook
) ) {
135 $sall = ' selected="selected" ';
139 $sspecial = ' selected="selected" ';
143 $sallcategories = ' selected="selected" ';
147 $snocategorised = ' selected="selected" ';
151 <option value
="ALL" <?php
p($sall)?
>><?php
p(get_string("allentries","glossary"))?
></option
>
152 <option value
="SPECIAL" <?php
p($sspecial)?
>><?php
p(get_string("special","glossary"))?
></option
>
153 <option value
="0" <?php
p($sallcategories)?
>><?php
p(get_string("allcategories","glossary"))?
></option
>
154 <option value
="-1" <?php
p($snocategorised)?
>><?php
p(get_string("notcategorised","glossary"))?
></option
>
158 <?php
print_string("cnfdefaulthook", "glossary") ?
><br
/><br
/>
162 <td align
="right" width
="20%"><?php
print_string('defaultsortkey','glossary'); ?
></td
>
164 <select size
="1" name
="sortkey">
170 switch ( strtolower($displayformat->sortkey
) ) {
172 $sfname = ' selected="selected" ';
176 $slname = ' selected="selected" ';
180 $screation = ' selected="selected" ';
184 $supdate = ' selected="selected" ';
188 <option value
="CREATION" <?php
p($screation)?
>><?php
p(get_string("sortbycreation","glossary"))?
></option
>
189 <option value
="UPDATE" <?php
p($supdate)?
>><?php
p(get_string("sortbylastupdate","glossary"))?
></option
>
190 <option value
="FIRSTNAME" <?php
p($sfname)?
>><?php
p(get_string("firstname"))?
></option
>
191 <option value
="LASTNAME" <?php
p($slname)?
>><?php
p(get_string("lastname"))?
></option
>
195 <?php
print_string("cnfsortkey", "glossary") ?
><br
/><br
/>
199 <td align
="right" width
="20%"><?php
print_string('defaultsortorder','glossary'); ?
></td
>
201 <select size
="1" name
="sortorder">
205 switch ( strtolower($displayformat->sortorder
) ) {
207 $sasc = ' selected="selected" ';
211 $sdesc = ' selected="selected" ';
215 <option value
="asc" <?php
p($sasc)?
>><?php
p(get_string("ascending","glossary"))?
></option
>
216 <option value
="desc" <?php
p($sdesc)?
>><?php
p(get_string("descending","glossary"))?
></option
>
220 <?php
print_string("cnfsortorder", "glossary") ?
><br
/><br
/>
224 <td align
="right" width
="20%"><?php
print_string("includegroupbreaks", "glossary"); ?
>:</td
>
226 <select size
="1" name
="showgroup">
230 if ($displayformat->showgroup
) {
231 $yselected = " selected=\"selected\" ";
233 $nselected = " selected=\"selected\" ";
236 <option value
="1" <?php
echo $yselected ?
>><?php
p($yes)?
></option
>
237 <option value
="0" <?php
echo $nselected ?
>><?php
p($no)?
></option
>
241 <?php
print_string("cnfshowgroup", "glossary") ?
><br
/><br
/>
245 <td colspan
="3" align
="center">
246 <input type
="submit" value
="<?php print_string("savechanges
") ?>" /></td
>
248 <input type
="hidden" name
="id" value
="<?php p($id) ?>" />
249 <input type
="hidden" name
="mode" value
="edit" />
252 echo '</table></form>';