MDL-61781 admin_settings: Fix default settings value for docroot
[moodle.git] / admin / settings / appearance.php
CommitLineData
11b749ca 1<?php
1ea1bcb3 2
3// This file defines settingpages and externalpages under the "appearance" category
4
b884e46d
MG
5$capabilities = array(
6 'moodle/my:configsyspages',
7 'moodle/tag:manage'
8);
9
10if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // speedup for non-admins, add all caps used on this page
a559f630 11
e106013f 12 $ADMIN->add('appearance', new admin_category('themes', new lang_string('themes')));
220a90c5 13 // "themesettings" settingpage
e106013f 14 $temp = new admin_settingpage('themesettings', new lang_string('themesettings', 'admin'));
113efed5 15 $setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'),
e584e6ae 16 new lang_string('configthemelist', 'admin'), '', PARAM_NOTAGS);
113efed5
FM
17 $setting->set_force_ltr(true);
18 $temp->add($setting);
e106013f 19 $setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'), new lang_string('configthemedesignermode', 'admin'), 0);
78946b9b
PS
20 $setting->set_updatedcallback('theme_reset_all_caches');
21 $temp->add($setting);
e106013f
SH
22 $temp->add(new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'), new lang_string('configallowuserthemes', 'admin'), 0));
23 $temp->add(new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'), new lang_string('configallowcoursethemes', 'admin'), 0));
24 $temp->add(new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'), new lang_string('configallowcategorythemes', 'admin'), 0));
25 $temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), new lang_string('configallowthemechangeonurl', 'admin'), 0));
26 $temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1));
27 $temp->add(new admin_setting_configcheckbox('allowblockstodock', new lang_string('allowblockstodock', 'admin'), new lang_string('configallowblockstodock', 'admin'), 1));
113efed5
FM
28 $temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'),
29 new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10'));
b865a3e2
JC
30 $temp->add(new admin_setting_configtextarea(
31 'customusermenuitems',
32 new lang_string('customusermenuitems', 'admin'),
33 new lang_string('configcustomusermenuitems', 'admin'),
4887d152 34 'grades,grades|/grade/report/mygrades.php|grades
c9451960 35messages,message|/message/index.php|message
4887d152 36preferences,moodle|/user/preferences.php|preferences',
113efed5 37 PARAM_RAW,
b865a3e2
JC
38 '50',
39 '10'
40 ));
e106013f
SH
41 $temp->add(new admin_setting_configcheckbox('enabledevicedetection', new lang_string('enabledevicedetection', 'admin'), new lang_string('configenabledevicedetection', 'admin'), 1));
42 $temp->add(new admin_setting_devicedetectregex('devicedetectregex', new lang_string('devicedetectregex', 'admin'), new lang_string('devicedetectregex_desc', 'admin'), ''));
220a90c5 43 $ADMIN->add('themes', $temp);
e106013f 44 $ADMIN->add('themes', new admin_externalpage('themeselector', new lang_string('themeselector','admin'), $CFG->wwwroot . '/theme/index.php'));
220a90c5 45
78946b9b 46 // settings for each theme
bd3b3bba 47 foreach (core_component::get_plugin_list('theme') as $theme => $themedir) {
78946b9b
PS
48 $settings_path = "$themedir/settings.php";
49 if (file_exists($settings_path)) {
e106013f 50 $settings = new admin_settingpage('themesetting'.$theme, new lang_string('pluginname', 'theme_'.$theme));
78946b9b 51 include($settings_path);
dbf9e4ba
PS
52 if ($settings) {
53 $ADMIN->add('themes', $settings);
54 }
78946b9b
PS
55 }
56 }
57
2258b4dc
FM
58 // Logos section.
59 $temp = new admin_settingpage('logos', new lang_string('logossettings', 'admin'));
60
61 // Logo file setting.
62 $title = get_string('logo', 'admin');
63 $description = get_string('logo_desc', 'admin');
64 $setting = new admin_setting_configstoredfile('core_admin/logo', $title, $description, 'logo', 0,
65 ['maxfiles' => 1, 'accepted_types' => ['.jpg', '.png']]);
66 $setting->set_updatedcallback('theme_reset_all_caches');
67 $temp->add($setting);
68
69 // Small logo file setting.
70 $title = get_string('logocompact', 'admin');
71 $description = get_string('logocompact_desc', 'admin');
72 $setting = new admin_setting_configstoredfile('core_admin/logocompact', $title, $description, 'logocompact', 0,
73 ['maxfiles' => 1, 'accepted_types' => ['.jpg', '.png']]);
74 $setting->set_updatedcallback('theme_reset_all_caches');
75 $temp->add($setting);
76
77 $ADMIN->add('appearance', $temp);
03d9401e 78
8bf0f207 79 // Calendar settings.
e106013f 80 $temp = new admin_settingpage('calendar', new lang_string('calendarsettings','admin'));
8bf0f207
MN
81
82 $temp->add(new admin_setting_configselect('calendartype', new lang_string('calendartype', 'admin'),
83 new lang_string('calendartype_desc', 'admin'), 'gregorian', \core_calendar\type_factory::get_list_of_calendar_types()));
220a90c5 84 $temp->add(new admin_setting_special_adminseesall());
85 //this is hacky because we do not want to include the stuff from calendar/lib.php
e106013f
SH
86 $temp->add(new admin_setting_configselect('calendar_site_timeformat', new lang_string('pref_timeformat', 'calendar'),
87 new lang_string('explain_site_timeformat', 'calendar'), '0',
88 array('0' => new lang_string('default', 'calendar'),
89 '%I:%M %p' => new lang_string('timeformat_12', 'calendar'),
90 '%H:%M' => new lang_string('timeformat_24', 'calendar'))));
f6554146
DP
91 $temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'),
92 new lang_string('helpstartofweek', 'admin'), get_string('firstdayofweek', 'langconfig'),
220a90c5 93 array(
e106013f
SH
94 0 => new lang_string('sunday', 'calendar'),
95 1 => new lang_string('monday', 'calendar'),
96 2 => new lang_string('tuesday', 'calendar'),
97 3 => new lang_string('wednesday', 'calendar'),
98 4 => new lang_string('thursday', 'calendar'),
99 5 => new lang_string('friday', 'calendar'),
100 6 => new lang_string('saturday', 'calendar')
220a90c5 101 )));
102 $temp->add(new admin_setting_special_calendar_weekend());
5bc12ca2
SB
103 $options = array(365 => new lang_string('numyear', '', 1),
104 270 => new lang_string('nummonths', '', 9),
105 180 => new lang_string('nummonths', '', 6),
106 150 => new lang_string('nummonths', '', 5),
107 120 => new lang_string('nummonths', '', 4),
108 90 => new lang_string('nummonths', '', 3),
109 60 => new lang_string('nummonths', '', 2),
110 30 => new lang_string('nummonth', '', 1),
111 21 => new lang_string('numweeks', '', 3),
112 14 => new lang_string('numweeks', '', 2),
113 7 => new lang_string('numweek', '', 1),
114 6 => new lang_string('numdays', '', 6),
115 5 => new lang_string('numdays', '', 5),
116 4 => new lang_string('numdays', '', 4),
117 3 => new lang_string('numdays', '', 3),
118 2 => new lang_string('numdays', '', 2),
119 1 => new lang_string('numday', '', 1));
120 $temp->add(new admin_setting_configselect('calendar_lookahead', new lang_string('configlookahead', 'admin'), new lang_string('helpupcominglookahead', 'admin'), 21, $options));
68ec4a27
ARN
121 $options = array();
122 for ($i=1; $i<=20; $i++) {
123 $options[$i] = $i;
124 }
e106013f
SH
125 $temp->add(new admin_setting_configselect('calendar_maxevents',new lang_string('configmaxevents','admin'),new lang_string('helpupcomingmaxevents', 'admin'),10,$options));
126 $temp->add(new admin_setting_configcheckbox('enablecalendarexport', new lang_string('enablecalendarexport', 'admin'), new lang_string('configenablecalendarexport','admin'), 1));
af5d990b
AA
127
128 // Calendar custom export settings.
129 $days = array(365 => new lang_string('numdays', '', 365),
130 180 => new lang_string('numdays', '', 180),
131 150 => new lang_string('numdays', '', 150),
132 120 => new lang_string('numdays', '', 120),
133 90 => new lang_string('numdays', '', 90),
134 60 => new lang_string('numdays', '', 60),
135 30 => new lang_string('numdays', '', 30),
136 5 => new lang_string('numdays', '', 5));
137 $temp->add(new admin_setting_configcheckbox('calendar_customexport', new lang_string('configcalendarcustomexport', 'admin'), new lang_string('helpcalendarcustomexport','admin'), 1));
138 $temp->add(new admin_setting_configselect('calendar_exportlookahead', new lang_string('configexportlookahead','admin'), new lang_string('helpexportlookahead', 'admin'), 365, $days));
139 $temp->add(new admin_setting_configselect('calendar_exportlookback', new lang_string('configexportlookback','admin'), new lang_string('helpexportlookback', 'admin'), 5, $days));
e106013f 140 $temp->add(new admin_setting_configtext('calendar_exportsalt', new lang_string('calendarexportsalt','admin'), new lang_string('configcalendarexportsalt', 'admin'), random_string(60)));
e73b527c 141 $temp->add(new admin_setting_configcheckbox('calendar_showicalsource', new lang_string('configshowicalsource', 'admin'), new lang_string('helpshowicalsource','admin'), 1));
220a90c5 142 $ADMIN->add('appearance', $temp);
143
cae83708 144 // blog
ab996aff
PS
145 $temp = new admin_settingpage('blog', new lang_string('blog','blog'), 'moodle/site:config', empty($CFG->enableblogs));
146 $temp->add(new admin_setting_configcheckbox('useblogassociations', new lang_string('useblogassociations', 'blog'), new lang_string('configuseblogassociations','blog'), 1));
147 $temp->add(new admin_setting_bloglevel('bloglevel', new lang_string('bloglevel', 'admin'), new lang_string('configbloglevel', 'admin'), 4, array(BLOG_GLOBAL_LEVEL => new lang_string('worldblogs','blog'),
148 BLOG_SITE_LEVEL => new lang_string('siteblogs','blog'),
149 BLOG_USER_LEVEL => new lang_string('personalblogs','blog'))));
150 $temp->add(new admin_setting_configcheckbox('useexternalblogs', new lang_string('useexternalblogs', 'blog'), new lang_string('configuseexternalblogs','blog'), 1));
151 $temp->add(new admin_setting_configselect('externalblogcrontime', new lang_string('externalblogcrontime', 'blog'), new lang_string('configexternalblogcrontime', 'blog'), 86400,
152 array(43200 => new lang_string('numhours', '', 12),
153 86400 => new lang_string('numhours', '', 24),
154 172800 => new lang_string('numdays', '', 2),
155 604800 => new lang_string('numdays', '', 7))));
156 $temp->add(new admin_setting_configtext('maxexternalblogsperuser', new lang_string('maxexternalblogsperuser','blog'), new lang_string('configmaxexternalblogsperuser', 'blog'), 1));
157 $temp->add(new admin_setting_configcheckbox('blogusecomments', new lang_string('enablecomments', 'admin'), new lang_string('configenablecomments', 'admin'), 1));
158 $temp->add(new admin_setting_configcheckbox('blogshowcommentscount', new lang_string('showcommentscount', 'admin'), new lang_string('configshowcommentscount', 'admin'), 1));
159 $ADMIN->add('appearance', $temp);
cae83708 160
da3ab9c4 161 // Navigation settings
e106013f 162 $temp = new admin_settingpage('navigation', new lang_string('navigation'));
89c51017 163 $choices = array(
e106013f
SH
164 HOMEPAGE_SITE => new lang_string('site'),
165 HOMEPAGE_MY => new lang_string('mymoodle', 'admin'),
166 HOMEPAGE_USER => new lang_string('userpreference', 'admin')
89c51017 167 );
e5cfbeea
AG
168 $temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'),
169 new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_MY, $choices));
110831ce 170 $temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1));
d20337f1 171 $temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0));
e106013f 172 $temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
b0712163 173 $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
e106013f 174 $temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
f87ce4e9
SH
175 $sortoptions = array(
176 'sortorder' => new lang_string('sort_sortorder', 'admin'),
177 'fullname' => new lang_string('sort_fullname', 'admin'),
178 'shortname' => new lang_string('sort_shortname', 'admin'),
179 'idnumber' => new lang_string('sort_idnumber', 'admin'),
180 );
181 $temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
c0a9edbd
MN
182 $temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
183 new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
e106013f 184 $temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
3ae54e04 185 $temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
26f12a35 186 $temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 1));
4037098e 187 $temp->add(new admin_setting_configcheckbox('navshowfrontpagemods', new lang_string('navshowfrontpagemods', 'admin'), new lang_string('navshowfrontpagemods_help', 'admin'), 1));
e106013f 188 $temp->add(new admin_setting_configcheckbox('navadduserpostslinks', new lang_string('navadduserpostslinks', 'admin'), new lang_string('navadduserpostslinks_help', 'admin'), 1));
89c51017 189
da3ab9c4
SH
190 $ADMIN->add('appearance', $temp);
191
5ca3c838 192 // "htmlsettings" settingpage
e106013f
SH
193 $temp = new admin_settingpage('htmlsettings', new lang_string('htmlsettings', 'admin'));
194 $temp->add(new admin_setting_configcheckbox('formatstringstriptags', new lang_string('stripalltitletags', 'admin'), new lang_string('configstripalltitletags', 'admin'), 1));
c3ed4a5a 195 $temp->add(new admin_setting_emoticons());
8eb1d25f 196 $ADMIN->add('appearance', $temp);
e106013f 197 $ADMIN->add('appearance', new admin_externalpage('resetemoticons', new lang_string('emoticonsreset', 'admin'),
7680da6c 198 new moodle_url('/admin/resetemoticons.php'), 'moodle/site:config', true));
8eb1d25f 199
220a90c5 200 // "documentation" settingpage
e106013f 201 $temp = new admin_settingpage('documentation', new lang_string('moodledocs'));
b07f2c46 202 $temp->add(new admin_setting_configtext('docroot', new lang_string('docroot', 'admin'), new lang_string('configdocroot', 'admin'), 'https://docs.moodle.org', PARAM_URL));
9452cae8
DN
203 $ltemp = array('' => get_string('forceno'));
204 $ltemp += get_string_manager()->get_list_of_translations(true);
205 $temp->add(new admin_setting_configselect('doclang', get_string('doclang', 'admin'), get_string('configdoclang', 'admin'), '', $ltemp));
e106013f 206 $temp->add(new admin_setting_configcheckbox('doctonewwindow', new lang_string('doctonewwindow', 'admin'), new lang_string('configdoctonewwindow', 'admin'), 0));
220a90c5 207 $ADMIN->add('appearance', $temp);
208
823c593f
RT
209 $temp = new admin_externalpage('mypage', new lang_string('mypage', 'admin'), $CFG->wwwroot . '/my/indexsys.php',
210 'moodle/my:configsyspages');
03d9401e
MD
211 $ADMIN->add('appearance', $temp);
212
823c593f
RT
213 $temp = new admin_externalpage('profilepage', new lang_string('myprofile', 'admin'), $CFG->wwwroot . '/user/profilesys.php',
214 'moodle/my:configsyspages');
220a90c5 215 $ADMIN->add('appearance', $temp);
216
df997f84 217 // coursecontact is the person responsible for course - usually manages enrolments, receives notification, etc.
e106013f 218 $temp = new admin_settingpage('coursecontact', new lang_string('courses'));
df997f84 219 $temp->add(new admin_setting_special_coursecontact());
7fb46992 220 $temp->add(new admin_setting_configcheckbox('courselistshortnames',
e106013f
SH
221 new lang_string('courselistshortnames', 'admin'),
222 new lang_string('courselistshortnames_desc', 'admin'), 0));
3b7bfbb5
FM
223 $temp->add(new admin_setting_configtext('coursesperpage', new lang_string('coursesperpage', 'admin'), new lang_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
224 $temp->add(new admin_setting_configtext('courseswithsummarieslimit', new lang_string('courseswithsummarieslimit', 'admin'), new lang_string('configcourseswithsummarieslimit', 'admin'), 10, PARAM_INT));
d1f8c1bd
MG
225 $temp->add(new admin_setting_configtext('courseoverviewfileslimit', new lang_string('courseoverviewfileslimit'),
226 new lang_string('configcourseoverviewfileslimit', 'admin'), 1, PARAM_INT));
227 $temp->add(new admin_setting_configtext('courseoverviewfilesext', new lang_string('courseoverviewfilesext'),
228 new lang_string('configcourseoverviewfilesext', 'admin'), '.jpg,.gif,.png'));
220a90c5 229 $ADMIN->add('appearance', $temp);
230
e106013f 231 $temp = new admin_settingpage('ajax', new lang_string('ajaxuse'));
e106013f
SH
232 $temp->add(new admin_setting_configcheckbox('useexternalyui', new lang_string('useexternalyui', 'admin'), new lang_string('configuseexternalyui', 'admin'), 0));
233 $temp->add(new admin_setting_configcheckbox('yuicomboloading', new lang_string('yuicomboloading', 'admin'), new lang_string('configyuicomboloading', 'admin'), 1));
234 $setting = new admin_setting_configcheckbox('cachejs', new lang_string('cachejs', 'admin'), new lang_string('cachejs_help', 'admin'), 1);
2288073a
PS
235 $setting->set_updatedcallback('js_reset_all_caches');
236 $temp->add($setting);
945a81a9 237 $temp->add(new admin_setting_configcheckbox('modchooserdefault', new lang_string('modchooserdefault', 'admin'), new lang_string('configmodchooserdefault', 'admin'), 1));
220a90c5 238 $ADMIN->add('appearance', $temp);
239
ff1fc4d9
TM
240 // Link to tag management interface.
241 $url = new moodle_url('/tag/manage.php');
242 $hidden = empty($CFG->usetags);
243 $page = new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $url, 'moodle/tag:manage', $hidden);
244 $ADMIN->add('appearance', $page);
8f6c1f34 245
e106013f
SH
246 $temp = new admin_settingpage('additionalhtml', new lang_string('additionalhtml', 'admin'));
247 $temp->add(new admin_setting_heading('additionalhtml_heading', new lang_string('additionalhtml_heading', 'admin'), new lang_string('additionalhtml_desc', 'admin')));
248 $temp->add(new admin_setting_configtextarea('additionalhtmlhead', new lang_string('additionalhtmlhead', 'admin'), new lang_string('additionalhtmlhead_desc', 'admin'), '', PARAM_RAW));
249 $temp->add(new admin_setting_configtextarea('additionalhtmltopofbody', new lang_string('additionalhtmltopofbody', 'admin'), new lang_string('additionalhtmltopofbody_desc', 'admin'), '', PARAM_RAW));
250 $temp->add(new admin_setting_configtextarea('additionalhtmlfooter', new lang_string('additionalhtmlfooter', 'admin'), new lang_string('additionalhtmlfooter_desc', 'admin'), '', PARAM_RAW));
90e920c7 251 $ADMIN->add('appearance', $temp);
a559f630 252
253} // end of speedup
78946b9b 254