Noted that xml format can now handle images.
[moodle-linuxchix.git] / admin / configvars.php
blob720f34eda19be6edd5b636336eef04003635c9c0
1 <?php // $Id$
2 // Shane Elliott
3 defined('MOODLE_INTERNAL') or die('Direct access to this script is forbidden.');
5 /// Add new sitewide configuration variables to this file.
8 /// $configvars is parsed by config.php
9 /// It is an array of arrays of objects
10 /// $configvars[sectionname][configvariablename] = configvar object
11 $configvars = array();
14 /// no, yes strings and menu options are used in a number of places
15 /// so we define them here to save time on repeatedly calling
16 /// get_string()
17 $stryes = get_string('yes');
18 $strno = get_string('no');
20 $noyesoptions[0] = $strno;
21 $noyesoptions[1] = $stryes;
25 /// A class to hold the configurable information
26 /// $field - the html code for the form field
27 /// $help - help text for the field
28 /// $warning - optional warning text to be displayed
29 /// method display_warning() - a generic function that can be used in an extended class
30 /// e.g. enablerssfeeds
31 class configvar {
33 var $field;
34 var $help;
35 var $warning;
37 function configvar($help, $field, $warning='') {
38 $this->help = $help;
39 $this->field = $field;
40 $this->warning = $warning;
43 function display_warning() {
44 return false;
52 ////////////////////////////////////////////////////////////////////
53 /// Miscellaneous config variables
54 ////////////////////////////////////////////////////////////////////
55 $misc = array();
58 /// maxeditingtime
59 unset($options);
60 $options[3600] = get_string('numminutes', '', 60);
61 $options[2700] = get_string('numminutes', '', 45);
62 $options[1800] = get_string('numminutes', '', 30);
63 $options[900] = get_string('numminutes', '', 15);
64 $options[300] = get_string('numminutes', '', 5);
65 $options[60] = get_string('numminutes', '', 1);
67 $misc['maxeditingtime'] = new configvar (get_string('configmaxeditingtime', 'admin'),
68 choose_from_menu ($options, 'maxeditingtime', $config->maxeditingtime, '', '', '', true) );
70 /// debug
71 unset($options);
72 $options[7] = $strno;
73 $options[15] = $stryes;
75 $misc['debug'] = new configvar (get_string('configdebug', 'admin'),
76 choose_from_menu ($options, 'debug', $config->debug, '', '', '', true) );
78 $misc['perfdebug'] = new configvar (get_string('configperfdebug', 'admin'),
79 choose_from_menu ($options, 'perfdebug', $config->perfdebug, '', '', '', true) );
81 /// enablerssfeeds
82 class configvarrss extends configvar {
83 function display_warning() {
84 return (!function_exists('utf8_encode'));
88 $misc['enablerssfeeds'] = new configvarrss (get_string('configenablerssfeeds', 'admin'),
89 choose_from_menu ($noyesoptions, 'enablerssfeeds', $config->enablerssfeeds, '', '', '', true),
90 '<font color="red"> You need to add XML support to your PHP installation.</font>' );
92 $misc['mymoodleredirect'] = new configvar (get_string('configmymoodleredirect','admin'),
93 choose_from_menu($noyesoptions,'mymoodleredirect',$config->mymoodleredirect,'','','',true));
95 unset($options);
96 $options[5] = get_string('worldblogs','blog');
97 $options[4] = get_string('siteblogs','blog');
98 $options[3] = get_string('courseblogs','blog');
99 $options[2] = get_string('groupblogs','blog');
100 $options[1] = get_string('personalblogs','blog');
101 $options[0] = get_string('disableblogs','blog');
103 $misc['bloglevel'] = new configvar (get_string('configbloglevel', 'admin'),
104 choose_from_menu ($options, 'bloglevel', $config->bloglevel,'','','',true));
106 ////////////////////////////////////////////////////////////////////
107 /// OPERATING SYSTEM config variables
108 ////////////////////////////////////////////////////////////////////
109 $operatingsystem = array();
111 /// gdversion
112 unset($options);
113 $options[0] = get_string('gdnot');
114 $options[1] = get_string('gd1');
115 $options[2] = get_string('gd2');
117 $installed = check_gd_version();
119 $operatingsystem['gdversion'] = new configvar (get_string('configgdversion', 'admin'),
120 choose_from_menu ($options, 'gdversion', $installed, '', '', '', true) );
122 /// dbsessions
123 $operatingsystem['dbsessions'] = new configvar (get_string('configdbsessions', 'admin'),
124 choose_from_menu ($noyesoptions, 'dbsessions', $config->dbsessions, '', '', '', true) );
126 /// sessiontimeout
127 unset($options);
128 $options[14400] = get_string('numhours', '', 4);
129 $options[10800] = get_string('numhours', '', 3);
130 $options[7200] = get_string('numhours', '', 2);
131 $options[5400] = get_string('numhours', '', '1.5');
132 $options[3600] = get_string('numminutes', '', 60);
133 $options[2700] = get_string('numminutes', '', 45);
134 $options[1800] = get_string('numminutes', '', 30);
135 $options[900] = get_string('numminutes', '', 15);
136 $options[300] = get_string('numminutes', '', 5);
138 $operatingsystem['sessiontimeout'] = new configvar (get_string('configsessiontimeout', 'admin'),
139 choose_from_menu ($options, 'sessiontimeout', $config->sessiontimeout, '', '', '', true) );
141 /// sessioncookie
142 $operatingsystem['sessioncookie'] = new configvar (get_string('configsessioncookie', 'admin'),
143 '<input name="sessioncookie" type="text" size="10" value="'.s($config->sessioncookie).'" alt="sessioncookie" />' );
144 $operatingsystem['sessioncookiepath'] = new configvar (get_string('configsessioncookiepath', 'admin'),
145 '<input name="sessioncookiepath" type="text" size="10" value="'.s($config->sessioncookiepath).'" alt="sessioncookiepath" />' );
147 /// zip
148 $operatingsystem['zip'] = new configvar (get_string('configzip', 'admin'),
149 '<input name="zip" type="text" size="30" value="'.s($config->zip).'" alt="zip" />' );
151 /// unzip
152 $operatingsystem['unzip'] = new configvar (get_string('configunzip', 'admin'),
153 '<input name="unzip" type="text" size="30" value="'.s($config->unzip).'" alt="unzip" />' );
155 $operatingsystem['pathtodu'] = new configvar(get_string('configpathtodu', 'admin'),
156 '<input name="pathtodu" type="text" size="30" value="'.s($config->pathtodu).'" alt="pathtodu" />');
158 /// slasharguments
159 unset($options);
160 $options[0] = "file.php?file=/pic.jpg";
161 $options[1] = "file.php/pic.jpg";
163 $operatingsystem['slasharguments'] = new configvar (get_string('configslasharguments', 'admin'),
164 choose_from_menu ($options, 'slasharguments', $config->slasharguments, '', '', '', true) );
166 /// proxyhost
167 $operatingsystem['proxyhost'] = new configvar (get_string('configproxyhost', 'admin'),
168 '<input name="proxyhost" type="text" size="30" value="'.s($config->proxyhost).'" alt="proxyhost" />' );
170 /// proxyport
171 $operatingsystem['proxyport'] = new configvar ('',
172 '<input name="proxyport" type="text" size="5" value="'.s($config->proxyport).'" alt="proxyport" />' );
176 ////////////////////////////////////////////////////////////////////
177 /// PERMISSIONS config variables
178 ////////////////////////////////////////////////////////////////////
179 $permissions = array();
181 /// teacherassignteachers
182 $permissions['teacherassignteachers'] = new configvar (get_string('configteacherassignteachers', 'admin'),
183 choose_from_menu ($noyesoptions, 'teacherassignteachers', $config->teacherassignteachers, '', '', '', true) );
185 /// allowunenroll
186 $permissions['allowunenroll'] = new configvar (get_string('configallowunenroll', 'admin'),
187 choose_from_menu ($noyesoptions, 'allowunenroll', $config->allowunenroll, '', '', '', true) );
189 /// allusersaresitestudents
190 $permissions['allusersaresitestudents'] = new configvar (get_string('configallusersaresitestudents', 'admin'),
191 choose_from_menu ($noyesoptions, 'allusersaresitestudents', $config->allusersaresitestudents, '', '', '', true) );
193 /// showsiteparticipantslist
194 unset($options);
195 $options[0] = get_string('siteteachers');
196 $options[1] = get_string('allteachers');
197 $options[2] = get_string('studentsandteachers');
199 $permissions['showsiteparticipantslist'] = new configvar (get_string('configshowsiteparticipantslist', 'admin'),
200 choose_from_menu ($options, 'showsiteparticipantslist', $config->showsiteparticipantslist, '', '', '', true) );
202 /// forcelogin
203 $permissions['forcelogin'] = new configvar (get_string('configforcelogin', 'admin'),
204 choose_from_menu ($noyesoptions, 'forcelogin', $config->forcelogin, '', '', '', true) );
206 /// forceloginforprofiles
207 $permissions['forceloginforprofiles'] = new configvar (get_string('configforceloginforprofiles', 'admin'),
208 choose_from_menu ($noyesoptions, 'forceloginforprofiles', $config->forceloginforprofiles, '', '', '', true) );
210 /// opentogoogle
211 $permissions['opentogoogle'] = new configvar (get_string('configopentogoogle', 'admin'),
212 choose_from_menu ($noyesoptions, 'opentogoogle', $config->opentogoogle, '', '', '', true) );
214 /// maxbytes
215 $options = get_max_upload_sizes();
217 $permissions['maxbytes'] = new configvar (get_string('configmaxbytes', 'admin'),
218 choose_from_menu ($options, 'maxbytes', $config->maxbytes, '', '', 0, true) );
220 /// messaging
221 $permissions['messaging'] = new configvar (get_string('configmessaging', 'admin'),
222 choose_from_menu ($noyesoptions, 'messaging', $config->messaging, '', '', '', true) );
224 /// allowobjectembed
225 $permissions['allowobjectembed'] = new configvar (get_string('configallowobjectembed', 'admin'),
226 choose_from_menu ($noyesoptions, 'allowobjectembed', $config->allowobjectembed, '', '', '', true) );
229 unset($options);
230 $options['none'] = 'No courses';
231 $options['all'] = 'All courses';
232 $options['requested'] = 'Requested courses';
234 $permissions['restrictmodulesfor'] = new configvar (get_string('configrestrictmodulesfor','admin'),
235 ' <script language="JavaScript">
236 function togglemodules(index) {
237 if (index == 0) {
238 document.getElementById(\'allowedmodules\').disabled=true;
240 else {
241 document.getElementById(\'allowedmodules\').disabled=false;
244 </script>'.
245 choose_from_menu($options,'restrictmodulesfor',$config->restrictmodulesfor,'','togglemodules(this.selectedIndex);','',true) );
247 $permissions['restrictbydefault'] = new configvar (get_string('configrestrictbydefault','admin'),
248 choose_from_menu($noyesoptions, 'restrictbydefault',$config->restrictbydefault,'','','',true) );
250 $allowstr = '<select name="defaultallowedmodules[]" id="allowedmodules" multiple="multiple" size="10"'.((empty($config->restrictmodulesfor)) ? "disabled=\"disabled\"" : "").'>';
252 $allowedmodules = array();
253 if (!empty($config->defaultallowedmodules)) {
254 $allowedmodules = explode(',',$config->defaultallowedmodules);
257 // On a fresh install of Moodle, this could be empty; prevent a warning on the following loop.
258 if (!$mods = get_records("modules")) {
259 $mods = array();
261 $s = "selected=\"selected\"";
262 $allowstr .= '<option value="0" '.((empty($allowedmodules)) ? $s : '').'>'.get_string('allownone').'</option>'."\n";
263 foreach ($mods as $mod) {
264 $selected = "";
265 if (in_array($mod->id,$allowedmodules))
266 $selected = $s;
267 $allowstr .= '<option '.$selected.' value="'.$mod->id.'">'.$mod->name.'</option>'."\n";
269 $allowstr .= '</select>';
271 $permissions['defaultallowedmodules'] = new configvar (get_string('configdefaultallowedmodules','admin'),$allowstr);
274 /// course requests
275 $reqcourse['enablecourserequests'] = new configvar (get_string('configenablecourserequests', 'admin'),
276 choose_from_menu ($noyesoptions,'enablecourserequests',$config->enablecourserequests,'','','',true) );
278 /// default category for course requests
279 require_once($CFG->dirroot.'/course/lib.php');
280 $reqcourse['defaultrequestedcategory'] = new configvar (get_string('configdefaultrequestedcategory', 'admin'),
281 choose_from_menu (make_categories_options(), 'defaultrequestedcategory',$config->defaultrequestedcategory,'','','',true) );
283 $reqcourse['requestedteachername'] = new configvar (get_string('configrequestedteachername','admin'),
284 '<input type="text" name="requestedteachername" size="20" maxlength="100" value="'.s($config->requestedteachername).'" />');
286 $reqcourse['requestedteachersname'] = new configvar (get_string('configrequestedteachersname','admin'),
287 '<input type="text" name="requestedteachersname" size="20" maxlength="100" value="'.s($config->requestedteachersname).'" />');
289 $reqcourse['requestedstudentname'] = new configvar (get_string('configrequestedstudentname','admin'),
290 '<input type="text" name="requestedstudentname" size="20" maxlength="100" value="'.s($config->requestedstudentname).'" />');
292 $reqcourse['requestedstudentsname'] = new configvar (get_string('configrequestedstudentsname','admin'),
293 '<input type="text" name="requestedstudentsname" size="20" maxlength="100" value="'.s($config->requestedstudentsname).'" />');
295 ////////////////////////////////////////////////////////////////////
296 /// INTERFACE config variables
297 ////////////////////////////////////////////////////////////////////
298 $interface = array();
300 /// language settings
301 $interface['lang'] = new configvar ( get_string('configlang', 'admin'),
302 choose_from_menu(get_list_of_languages(), 'lang', $config->lang, '', '', '', true) );
304 /// language menu
305 $interface['langmenu'] = new configvar ( get_string('configlangmenu', 'admin'),
306 choose_from_menu($noyesoptions, 'langmenu', $config->langmenu, '', '', '', true) );
308 /// language list
309 $interface['langlist'] = new configvar ( get_string('configlanglist', 'admin'),
310 '<input name="langlist" type="text" size="60" value="'.s($config->langlist).'" alt="langlist" />' );
312 /// language menu
313 $interface['langcache'] = new configvar ( get_string('configlangcache', 'admin'),
314 choose_from_menu($noyesoptions, 'langcache', $config->langcache, '', '', '', true) );
316 /// locale
317 $interface['locale'] = new configvar ( get_string('configlocale', 'admin'),
318 '<input name="locale" type="text" size="10" value="'.s($config->locale).'" alt="locale" />' );
320 /// docroot
321 $interface['docroot'] = new configvar ( get_string('configdocroot', 'admin'),
322 '<input name="docroot" type="text" size="60" value="'.s($config->docroot).'" alt="docroot" />' );
324 /// timezone
326 $interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
327 choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
329 /// country
330 $interface['country'] = new configvar ( get_string('configcountry', 'admin'),
331 choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) );
333 /// framename
334 if (empty($config->framename)) {
335 $config->framename = "_top";
338 $interface['framename'] = new configvar (get_string('configframename', 'admin'),
339 '<input name="framename" type="text" size="15" value="'.s($config->framename).'" alt="framename" />' );
341 /// language list
342 $interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'),
343 '<input name="themelist" type="text" size="60" value="'.s($config->themelist).'" alt="themelist" />' );
345 /// user themes
346 $interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'),
347 choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) );
349 /// course themes
350 $interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'),
351 choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) );
353 /// allowuserblockhiding
354 $interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'),
355 choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) );
357 /// showblocksonmodpages
358 $interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'),
359 choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) );
362 /// tabselectedtofront
363 $interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'),
364 choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) );
368 ////////////////////////////////////////////////////////////////////
369 /// USER config variables
370 ////////////////////////////////////////////////////////////////////
371 $user = array();
373 /// sitepolicy
374 $user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'),
375 '<input type="text" name="sitepolicy" size="60" value="'.$config->sitepolicy.'" alt="sitepolicy" />' );
378 /// fullnamedisplay
379 unset($options);
380 $options['language'] = get_string('language');
381 $options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname');
382 $options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname');
383 $options['firstname'] = get_string('firstname');
385 $user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'),
386 choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) );
388 /// extendedusernamechars
389 $user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'),
390 choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) );
392 /// autologinguests
393 $user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
394 choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
396 /// hiddenuserfields
397 $fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
398 if (empty($config->hiddenuserfields)) {
399 $config->hiddenuserfields = 'none';
401 $configfields = array_flip(explode(',', $config->hiddenuserfields));
402 $fieldoptions = '';
403 foreach ($fields as $value) {
404 $fieldoptions .= '<option value="'.$value.'"';
405 if (isset($configfields[$value])) {
406 $fieldoptions .= ' selected="selected"';
408 $fieldoptions .= '>'.get_string($value).'</option>';
411 $user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
412 '<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
417 ////////////////////////////////////////////////////////////////////
418 /// SECURITY config variables
419 ////////////////////////////////////////////////////////////////////
420 $security = array();
422 /// displayloginfailures
423 unset($options);
424 $options[''] = get_string('nobody');
425 $options['admin'] = get_string('administrators');
426 $options['teacher'] = get_string('administratorsandteachers');
427 $options['everybody'] = get_string('everybody');
429 $security['displayloginfailures'] = new configvar (get_string('configdisplayloginfailures', 'admin'),
430 choose_from_menu($options, 'displayloginfailures', $config->displayloginfailures, '', '', '', true) );
432 /// notifyloginfailures
433 unset($options);
434 $options[''] = get_string('nobody');
435 $options['mainadmin'] = get_string('administrator');
436 $options['alladmins'] = get_string('administratorsall');
438 $security['notifyloginfailures'] = new configvar (get_string('confignotifyloginfailures', 'admin'),
439 choose_from_menu($options, 'notifyloginfailures', $config->notifyloginfailures, '', '', '', true) );
441 /// notifyloginthreshold
442 unset($options);
443 for ($i=1; $i<=100; $i++) {
444 $options[$i] = "$i";
447 $security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
448 choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
450 /// secureforms
451 $security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
452 choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
454 /// loginhttps
455 $security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
456 choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
458 /// runclamonupload
459 $security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
460 choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
462 /// pathtoclam
463 $security['pathtoclam'] = new configvar (get_string('configpathtoclam', 'admin'),
464 '<input type="text" name="pathtoclam" size="30" value="'.$config->pathtoclam.'" alt="pathtoclam" />' );
466 /// quarantinedir
467 $security['quarantinedir'] = new configvar (get_string('configquarantinedir', 'admin'),
468 '<input type="text" name="quarantinedir" size="30" value="'.$config->quarantinedir.'" alt="quarantinedir" />' );
470 /// clamfailureonupload
471 unset($options);
472 $options['donothing'] = get_string('configclamdonothing', 'admin');
473 $options['actlikevirus'] = get_string('configclamactlikevirus', 'admin');
475 $security['clamfailureonupload'] = new configvar (get_string('configclamfailureonupload', 'admin'),
476 choose_from_menu($options, 'clamfailureonupload', $config->clamfailureonupload, '', '', '', true) );
481 ////////////////////////////////////////////////////////////////////
482 /// MAINTENANCE config variables
483 ////////////////////////////////////////////////////////////////////
484 $maintenance = array();
486 /// longtimenosee
487 unset($options);
488 $options[0] = get_string('never');
489 $options[1000] = get_string('numdays', '', 1000);
490 $options[365] = get_string('numdays', '', 365);
491 $options[180] = get_string('numdays', '', 180);
492 $options[150] = get_string('numdays', '', 150);
493 $options[120] = get_string('numdays', '', 120);
494 $options[90] = get_string('numdays', '', 90);
495 $options[60] = get_string('numdays', '', 60);
496 $options[30] = get_string('numdays', '', 30);
497 $options[21] = get_string('numdays', '', 21);
498 $options[14] = get_string('numdays', '', 14);
499 $options[7] = get_string('numdays', '', 7);
501 $maintenance['longtimenosee'] = new configvar (get_string('configlongtimenosee', 'admin'),
502 choose_from_menu ($options, 'longtimenosee', $config->longtimenosee, '', '', '', true) );
504 /// deleteunconfirmed
505 unset($options);
506 $options[0] = get_string('never');
507 $options[168] = get_string('numdays', '', 7);
508 $options[144] = get_string('numdays', '', 6);
509 $options[120] = get_string('numdays', '', 5);
510 $options[96] = get_string('numdays', '', 4);
511 $options[72] = get_string('numdays', '', 3);
512 $options[48] = get_string('numdays', '', 2);
513 $options[24] = get_string('numdays', '', 1);
514 $options[12] = get_string('numhours', '', 12);
515 $options[6] = get_string('numhours', '', 6);
516 $options[1] = get_string('numhours', '', 1);
518 $maintenance['deleteunconfirmed'] = new configvar (get_string('configdeleteunconfirmed', 'admin'),
519 choose_from_menu ($options, 'deleteunconfirmed', $config->deleteunconfirmed, '', '', '', true) );
521 /// loglifetime
522 unset($options);
523 $options[0] = get_string('neverdeletelogs');
524 $options[1000] = get_string('numdays', '', 1000);
525 $options[365] = get_string('numdays', '', 365);
526 $options[180] = get_string('numdays', '', 180);
527 $options[150] = get_string('numdays', '', 150);
528 $options[120] = get_string('numdays', '', 120);
529 $options[90] = get_string('numdays', '', 90);
530 $options[60] = get_string('numdays', '', 60);
531 $options[30] = get_string('numdays', '', 30);
533 $maintenance['loglifetime'] = new configvar (get_string('configloglifetime', 'admin'),
534 choose_from_menu ($options, 'loglifetime', $config->loglifetime, '', '', '', true) );
537 ////////////////////////////////////////////////////////////////////
538 /// MAIL config variables
539 ////////////////////////////////////////////////////////////////////
540 $mail = array();
542 /// smtphosts
543 $mail['smtphosts'] = new configvar (get_string('configsmtphosts', 'admin'),
544 '<input name="smtphosts" type="text" size="30" value="'.s($config->smtphosts).'" alt="smtphosts" />' );
546 /// smtpuser
547 $mail['smtpuser'] = new configvar (get_string('configsmtpuser', 'admin'),
548 '<input name="smtpuser" type="text" size="10" value="'.s($config->smtpuser).'" alt="smtpuser" />' );
550 /// smtppass
551 $mail['smtppass'] = new configvar ('',
552 '<input name="smtppass" type="password" size="10" value="'.s($config->smtppass).'" alt="smtppass" />' );
554 /// noreplyaddress
555 $mail['noreplyaddress'] = new configvar (get_string('confignoreplyaddress', 'admin'),
556 '<input name="noreplyaddress" type="text" size="30" value="'.s($config->noreplyaddress).'" alt="noreplyaddress" />' );
558 /// digestmailtime
559 $hours = array();
560 for ($i=0; $i<=23; $i++) {
561 $hours[$i] = sprintf("%02d",$i);
564 $mail['digestmailtime'] = new configvar (get_string('configdigestmailtime', 'admin'),
565 choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, '', '', 0, true) );
567 /// allowemailaddresses
568 $mail['allowemailaddresses'] = new configvar (get_string('configallowemailaddresses', 'admin'),
569 '<input name="allowemailaddresses" type="text" size="60" value="'.s($config->allowemailaddresses).'" alt="allowemailaddresses" />' );
571 /// denyemailaddresses
572 $mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
573 '<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
575 if (!empty($CFG->unicodedb)) { ///These options are only available if running under unicodedb
576 /// sitemailcharset
577 unset($options);
578 unset($charsets);
579 $charsets = get_list_of_charsets();
580 $options['0'] = get_string('none');
581 $options = array_merge($options, $charsets);
582 $mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
583 choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
585 /// allowusermailcharset
586 $mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
587 choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
590 /// enable stats
591 $stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
592 choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
594 unset($options);
595 $options['none'] = get_string('none');
596 $options[60*60*24*7] = get_string('numweeks','moodle',1);
597 $options[60*60*24*14] = get_string('numweeks','moodle',2);
598 $options[60*60*24*21] = get_string('numweeks','moodle',3);
599 $options[60*60*24*28] = get_string('nummonths','moodle',1);
600 $options[60*60*24*56] = get_string('nummonths','moodle',2);
601 $options[60*60*24*84] = get_string('nummonths','moodle',3);
602 $options[60*60*24*112] = get_string('nummonths','moodle',4);
603 $options[60*60*24*140] = get_string('nummonths','moodle',5);
604 $options[60*60*24*168] = get_string('nummonths','moodle',6);
605 $options['all'] = get_string('all');
607 $stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
608 choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
610 unset($options);
611 $options[0] = get_string('untilcomplete');
612 $options[60*60] = '1 '.get_string('hour');
613 $options[60*60*2] = '2 '.get_string('hours');
614 $options[60*60*3] = '3 '.get_string('hours');
615 $options[60*60*4] = '4 '.get_string('hours');
616 $options[60*60*5] = '5 '.get_string('hours');
617 $options[60*60*6] = '6 '.get_string('hours');
618 $options[60*60*7] = '7 '.get_string('hours');
619 $options[60*60*8] = '8 '.get_string('hours');
621 if (empty($config->statsruntimestarthour)) {
622 $config->statsruntimestarthour = 0;
624 if (empty($config->statsruntimestartminute)) {
625 $config->statsruntimestartminute = 0;
628 $stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
629 choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );
631 $stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
632 print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
634 $stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
635 '<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
638 ////////////////////////////////////////////////////////////////////
640 $configvars['interface'] = $interface;
641 $configvars['security'] = $security;
642 $configvars['operatingsystem'] = $operatingsystem;
643 $configvars['maintenance'] = $maintenance;
644 $configvars['mail'] = $mail;
645 $configvars['user'] = $user;
646 $configvars['permissions'] = $permissions;
647 $configvars['requestedcourse'] = $reqcourse;
648 $configvars['misc'] = $misc;
649 $configvars['stats'] = $stats;