Automatic installer.php lang files by installer_builder (20070202)
[moodle.git] / admin / configvars.php
blob60aa0aeef6aa94a4b08fdc9406e05dc040add2d1
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[5] = $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=/1/pic.jpg";
161 $options[1] = "file.php/1/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="15" 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 /// doctonewwindow
325 $interface['doctonewwindow'] = new configvar ( get_string('configdoctonewwindow', 'admin'),
326 choose_from_menu($noyesoptions, 'doctonewwindow', $config->doctonewwindow, '', '', '', true) );
328 /// timezone
329 $interface['timezone'] = new configvar ( get_string('configtimezone', 'admin'),
330 choose_from_menu (get_list_of_timezones(), 'timezone', $config->timezone, get_string('serverlocaltime'), '', '99', true ) );
332 /// country
333 $interface['country'] = new configvar ( get_string('configcountry', 'admin'),
334 choose_from_menu (get_list_of_countries(), 'country', $config->country, get_string('selectacountry'), '', 0, true) );
336 /// framename
337 if (empty($config->framename)) {
338 $config->framename = "_top";
341 $interface['framename'] = new configvar (get_string('configframename', 'admin'),
342 '<input name="framename" type="text" size="15" value="'.s($config->framename).'" alt="framename" />' );
344 /// language list
345 $interface['themelist'] = new configvar ( get_string('configthemelist', 'admin'),
346 '<input name="themelist" type="text" size="60" value="'.s($config->themelist).'" alt="themelist" />' );
348 /// user themes
349 $interface['allowuserthemes'] = new configvar (get_string('configallowuserthemes', 'admin'),
350 choose_from_menu ($noyesoptions, 'allowuserthemes', $config->allowuserthemes, '', '', '', true) );
352 /// course themes
353 $interface['allowcoursethemes'] = new configvar (get_string('configallowcoursethemes', 'admin'),
354 choose_from_menu ($noyesoptions, 'allowcoursethemes', $config->allowcoursethemes, '', '', '', true) );
356 /// allowuserblockhiding
357 $interface['allowuserblockhiding'] = new configvar (get_string('configallowuserblockhiding', 'admin'),
358 choose_from_menu ($noyesoptions, 'allowuserblockhiding', $config->allowuserblockhiding, '', '', '', true) );
360 /// showblocksonmodpages
361 $interface['showblocksonmodpages'] = new configvar (get_string('configshowblocksonmodpages', 'admin'),
362 choose_from_menu ($noyesoptions, 'showblocksonmodpages', $config->showblocksonmodpages, '', '', '', true) );
365 /// tabselectedtofront
366 $interface['tabselectedtofront'] = new configvar (get_string('tabselectedtofront', 'admin'),
367 choose_from_menu ($noyesoptions, 'tabselectedtofront', $config->tabselectedtofront, '', '', '', true) );
371 ////////////////////////////////////////////////////////////////////
372 /// USER config variables
373 ////////////////////////////////////////////////////////////////////
374 $user = array();
376 /// sitepolicy
377 $user['sitepolicy'] = new configvar (get_string('configsitepolicy', 'admin'),
378 '<input type="text" name="sitepolicy" size="60" value="'.$config->sitepolicy.'" alt="sitepolicy" />' );
381 /// fullnamedisplay
382 unset($options);
383 $options['language'] = get_string('language');
384 $options['firstname lastname'] = get_string('firstname') . ' + ' . get_string('lastname');
385 $options['lastname firstname'] = get_string('lastname') . ' + ' . get_string('firstname');
386 $options['firstname'] = get_string('firstname');
388 $user['fullnamedisplay'] = new configvar (get_string('configfullnamedisplay', 'admin'),
389 choose_from_menu ($options, 'fullnamedisplay', $config->fullnamedisplay, '', '', '', true) );
391 /// extendedusernamechars
392 $user['extendedusernamechars'] = new configvar (get_string('configextendedusernamechars', 'admin'),
393 choose_from_menu ($noyesoptions, 'extendedusernamechars', $config->extendedusernamechars, '', '', '', true) );
395 /// autologinguests
396 $user['autologinguests'] = new configvar (get_string('configautologinguests', 'admin'),
397 choose_from_menu ($noyesoptions, 'autologinguests', $config->autologinguests, '', '', '', true) );
399 /// hiddenuserfields
400 $fields = array('none', 'description', 'city', 'country', 'webpage', 'icqnumber', 'skypeid', 'yahooid', 'aimid', 'msnid', 'lastaccess');
401 if (empty($config->hiddenuserfields)) {
402 $config->hiddenuserfields = 'none';
404 $configfields = array_flip(explode(',', $config->hiddenuserfields));
405 $fieldoptions = '';
406 foreach ($fields as $value) {
407 $fieldoptions .= '<option value="'.$value.'"';
408 if (isset($configfields[$value])) {
409 $fieldoptions .= ' selected="selected"';
411 $fieldoptions .= '>'.get_string($value).'</option>';
414 $user['hiddenuserfields'] = new configvar (get_string('confighiddenuserfields', 'admin'),
415 '<select id="menuhiddenuserfields" name="hiddenuserfields[]" size="10" multiple="multiple">'.$fieldoptions.'</select>' );
420 ////////////////////////////////////////////////////////////////////
421 /// SECURITY config variables
422 ////////////////////////////////////////////////////////////////////
423 $security = array();
425 /// displayloginfailures
426 unset($options);
427 $options[''] = get_string('nobody');
428 $options['admin'] = get_string('administrators');
429 $options['teacher'] = get_string('administratorsandteachers');
430 $options['everybody'] = get_string('everybody');
432 $security['displayloginfailures'] = new configvar (get_string('configdisplayloginfailures', 'admin'),
433 choose_from_menu($options, 'displayloginfailures', $config->displayloginfailures, '', '', '', true) );
435 /// notifyloginfailures
436 unset($options);
437 $options[''] = get_string('nobody');
438 $options['mainadmin'] = get_string('administrator');
439 $options['alladmins'] = get_string('administratorsall');
441 $security['notifyloginfailures'] = new configvar (get_string('confignotifyloginfailures', 'admin'),
442 choose_from_menu($options, 'notifyloginfailures', $config->notifyloginfailures, '', '', '', true) );
444 /// notifyloginthreshold
445 unset($options);
446 for ($i=1; $i<=100; $i++) {
447 $options[$i] = "$i";
450 $security['notifyloginthreshold'] = new configvar (get_string('confignotifyloginthreshold', 'admin'),
451 choose_from_menu($options, 'notifyloginthreshold', $config->notifyloginthreshold, '', '', '', true) );
453 $security['protectusernames'] = new configvar (get_string('configprotectusernames', 'admin'),
454 choose_from_menu($noyesoptions, 'protectusernames', $config->protectusernames, '', '', '', true) );
456 /// secureforms
457 $security['secureforms'] = new configvar (get_string('configsecureforms', 'admin'),
458 choose_from_menu ($noyesoptions, 'secureforms', $config->secureforms, '', '', '', true) );
460 /// loginhttps
461 $security['loginhttps'] = new configvar (get_string('configloginhttps', 'admin'),
462 choose_from_menu ($noyesoptions, 'loginhttps', $config->loginhttps, '', '', '', true) );
464 /// runclamonupload
465 $security['runclamonupload'] = new configvar (get_string('configrunclamonupload', 'admin'),
466 choose_from_menu($noyesoptions, 'runclamonupload', $config->runclamonupload, '', '', '', true) );
468 /// pathtoclam
469 $security['pathtoclam'] = new configvar (get_string('configpathtoclam', 'admin'),
470 '<input type="text" name="pathtoclam" size="30" value="'.$config->pathtoclam.'" alt="pathtoclam" />' );
472 /// quarantinedir
473 $security['quarantinedir'] = new configvar (get_string('configquarantinedir', 'admin'),
474 '<input type="text" name="quarantinedir" size="30" value="'.$config->quarantinedir.'" alt="quarantinedir" />' );
476 /// clamfailureonupload
477 unset($options);
478 $options['donothing'] = get_string('configclamdonothing', 'admin');
479 $options['actlikevirus'] = get_string('configclamactlikevirus', 'admin');
481 $security['clamfailureonupload'] = new configvar (get_string('configclamfailureonupload', 'admin'),
482 choose_from_menu($options, 'clamfailureonupload', $config->clamfailureonupload, '', '', '', true) );
487 ////////////////////////////////////////////////////////////////////
488 /// MAINTENANCE config variables
489 ////////////////////////////////////////////////////////////////////
490 $maintenance = array();
492 /// longtimenosee
493 unset($options);
494 $options[0] = get_string('never');
495 $options[1000] = get_string('numdays', '', 1000);
496 $options[365] = get_string('numdays', '', 365);
497 $options[180] = get_string('numdays', '', 180);
498 $options[150] = get_string('numdays', '', 150);
499 $options[120] = get_string('numdays', '', 120);
500 $options[90] = get_string('numdays', '', 90);
501 $options[60] = get_string('numdays', '', 60);
502 $options[30] = get_string('numdays', '', 30);
503 $options[21] = get_string('numdays', '', 21);
504 $options[14] = get_string('numdays', '', 14);
505 $options[7] = get_string('numdays', '', 7);
507 $maintenance['longtimenosee'] = new configvar (get_string('configlongtimenosee', 'admin'),
508 choose_from_menu ($options, 'longtimenosee', $config->longtimenosee, '', '', '', true) );
510 /// deleteunconfirmed
511 unset($options);
512 $options[0] = get_string('never');
513 $options[168] = get_string('numdays', '', 7);
514 $options[144] = get_string('numdays', '', 6);
515 $options[120] = get_string('numdays', '', 5);
516 $options[96] = get_string('numdays', '', 4);
517 $options[72] = get_string('numdays', '', 3);
518 $options[48] = get_string('numdays', '', 2);
519 $options[24] = get_string('numdays', '', 1);
520 $options[12] = get_string('numhours', '', 12);
521 $options[6] = get_string('numhours', '', 6);
522 $options[1] = get_string('numhours', '', 1);
524 $maintenance['deleteunconfirmed'] = new configvar (get_string('configdeleteunconfirmed', 'admin'),
525 choose_from_menu ($options, 'deleteunconfirmed', $config->deleteunconfirmed, '', '', '', true) );
527 /// loglifetime
528 unset($options);
529 $options[0] = get_string('neverdeletelogs');
530 $options[1000] = get_string('numdays', '', 1000);
531 $options[365] = get_string('numdays', '', 365);
532 $options[180] = get_string('numdays', '', 180);
533 $options[150] = get_string('numdays', '', 150);
534 $options[120] = get_string('numdays', '', 120);
535 $options[90] = get_string('numdays', '', 90);
536 $options[60] = get_string('numdays', '', 60);
537 $options[30] = get_string('numdays', '', 30);
539 $maintenance['loglifetime'] = new configvar (get_string('configloglifetime', 'admin'),
540 choose_from_menu ($options, 'loglifetime', $config->loglifetime, '', '', '', true) );
543 ////////////////////////////////////////////////////////////////////
544 /// MAIL config variables
545 ////////////////////////////////////////////////////////////////////
546 $mail = array();
548 /// smtphosts
549 $mail['smtphosts'] = new configvar (get_string('configsmtphosts', 'admin'),
550 '<input name="smtphosts" type="text" size="30" value="'.s($config->smtphosts).'" alt="smtphosts" />' );
552 /// smtpuser
553 $mail['smtpuser'] = new configvar (get_string('configsmtpuser', 'admin'),
554 '<input name="smtpuser" type="text" size="10" value="'.s($config->smtpuser).'" alt="smtpuser" />' );
556 /// smtppass
557 $mail['smtppass'] = new configvar ('',
558 '<input name="smtppass" type="password" size="10" value="'.s($config->smtppass).'" alt="smtppass" />' );
560 /// noreplyaddress
561 $mail['noreplyaddress'] = new configvar (get_string('confignoreplyaddress', 'admin'),
562 '<input name="noreplyaddress" type="text" size="30" value="'.s($config->noreplyaddress).'" alt="noreplyaddress" />' );
564 /// digestmailtime
565 $hours = array();
566 for ($i=0; $i<=23; $i++) {
567 $hours[$i] = sprintf("%02d",$i);
570 $mail['digestmailtime'] = new configvar (get_string('configdigestmailtime', 'admin'),
571 choose_from_menu($hours, 'digestmailtime', $config->digestmailtime, '', '', 0, true) );
573 /// allowemailaddresses
574 $mail['allowemailaddresses'] = new configvar (get_string('configallowemailaddresses', 'admin'),
575 '<input name="allowemailaddresses" type="text" size="60" value="'.s($config->allowemailaddresses).'" alt="allowemailaddresses" />' );
577 /// denyemailaddresses
578 $mail['denyemailaddresses'] = new configvar (get_string('configdenyemailaddresses', 'admin'),
579 '<input name="denyemailaddresses" type="text" size="60" value="'.s($config->denyemailaddresses).'" alt="denyemailaddresses" />' );
581 if (!empty($CFG->unicodedb)) { ///These options are only available if running under unicodedb
582 /// sitemailcharset
583 unset($options);
584 unset($charsets);
585 $charsets = get_list_of_charsets();
586 $options['0'] = get_string('none');
587 $options = array_merge($options, $charsets);
588 $mail['sitemailcharset'] = new configvar (get_string('configsitemailcharset', 'admin'),
589 choose_from_menu($options, 'sitemailcharset', $config->sitemailcharset, '', '', '', true));
591 /// allowusermailcharset
592 $mail['allowusermailcharset'] = new configvar (get_string('configallowusermailcharset', 'admin'),
593 choose_from_menu($noyesoptions, 'allowusermailcharset', $config->allowusermailcharset, '', '', '', true));
596 /// enable stats
597 if (empty($CFG->disablestatsprocessing)) {
598 $stats['enablestats'] = new configvar (get_string('configenablestats','admin'),
599 choose_from_menu($noyesoptions, 'enablestats', $config->enablestats, '', '', '', true) );
601 unset($options);
602 $options['none'] = get_string('none');
603 $options[60*60*24*7] = get_string('numweeks','moodle',1);
604 $options[60*60*24*14] = get_string('numweeks','moodle',2);
605 $options[60*60*24*21] = get_string('numweeks','moodle',3);
606 $options[60*60*24*28] = get_string('nummonths','moodle',1);
607 $options[60*60*24*56] = get_string('nummonths','moodle',2);
608 $options[60*60*24*84] = get_string('nummonths','moodle',3);
609 $options[60*60*24*112] = get_string('nummonths','moodle',4);
610 $options[60*60*24*140] = get_string('nummonths','moodle',5);
611 $options[60*60*24*168] = get_string('nummonths','moodle',6);
612 $options['all'] = get_string('all');
614 $stats['statsfirstrun'] = new configvar (get_string('configstatsfirstrun','admin'),
615 choose_from_menu($options,'statsfirstrun',$config->statsfirstrun,'','','',true) );
617 unset($options);
618 $options[0] = get_string('untilcomplete');
619 $options[60*60] = '1 '.get_string('hour');
620 $options[60*60*2] = '2 '.get_string('hours');
621 $options[60*60*3] = '3 '.get_string('hours');
622 $options[60*60*4] = '4 '.get_string('hours');
623 $options[60*60*5] = '5 '.get_string('hours');
624 $options[60*60*6] = '6 '.get_string('hours');
625 $options[60*60*7] = '7 '.get_string('hours');
626 $options[60*60*8] = '8 '.get_string('hours');
628 if (empty($config->statsruntimestarthour)) {
629 $config->statsruntimestarthour = 0;
631 if (empty($config->statsruntimestartminute)) {
632 $config->statsruntimestartminute = 0;
635 $stats['statsmaxruntime'] = new configvar (get_string('configstatsmaxruntime','admin'),
636 choose_from_menu($options,'statsmaxruntime',$config->statsmaxruntime,'','','',true) );
638 $stats['statsruntimestart'] = new configvar (get_string('configstatsruntimestart','admin'),
639 print_time_selector("statsruntimestarthour","statsruntimestartminute",make_timestamp(2000,1,1,$config->statsruntimestarthour,$config->statsruntimestartminute),5,true) );
641 $stats['statsuserthreshold'] = new configvar (get_string('configstatsuserthreshold','admin'),
642 '<input type="text" name="statsuserthreshold" size="4" value="'.$config->statsuserthreshold.'" />');
645 ////////////////////////////////////////////////////////////////////
647 $configvars['interface'] = $interface;
648 $configvars['security'] = $security;
649 $configvars['operatingsystem'] = $operatingsystem;
650 $configvars['maintenance'] = $maintenance;
651 $configvars['mail'] = $mail;
652 $configvars['user'] = $user;
653 $configvars['permissions'] = $permissions;
654 $configvars['requestedcourse'] = $reqcourse;
655 $configvars['misc'] = $misc;
656 if (empty($CFG->disablestatsprocessing)) {
657 $configvars['stats'] = $stats;