MDL-61804 admin: Add setting for course visibility sorting
[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));
88cb8b78 25 $temp->add(new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'), new lang_string('configallowcohortthemes', 'admin'), 0));
e106013f
SH
26 $temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), new lang_string('configallowthemechangeonurl', 'admin'), 0));
27 $temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', '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'),
df8eec52
KO
34 'grades,grades|/grade/report/mygrades.php|t/grades
35messages,message|/message/index.php|t/message
36preferences,moodle|/user/preferences.php|t/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
c5b2ab47
BB
79 // Course colours section.
80 $temp = new admin_settingpage('coursecolors', new lang_string('coursecolorsettings', 'admin'));
81 $temp->add(new admin_setting_heading('coursecolorheading', '',
82 new lang_string('coursecolorheading_desc', 'admin')));
83
84 $basecolors = ['#81ecec', '#74b9ff', '#a29bfe', '#dfe6e9', '#00b894',
85 '#0984e3', '#b2bec3', '#fdcb6e', '#fd79a8', '#6c5ce7'];
86
87 foreach ($basecolors as $key => $color) {
88 $number = $key + 1;
89 $name = 'core_admin/coursecolor' . $number;
90 $title = get_string('coursecolor', 'admin', $number);
91 $setting = new admin_setting_configcolourpicker($name, $title, '', $color);
92 $temp->add($setting);
93 }
94
95 $ADMIN->add('appearance', $temp);
96
8bf0f207 97 // Calendar settings.
e106013f 98 $temp = new admin_settingpage('calendar', new lang_string('calendarsettings','admin'));
8bf0f207
MN
99
100 $temp->add(new admin_setting_configselect('calendartype', new lang_string('calendartype', 'admin'),
101 new lang_string('calendartype_desc', 'admin'), 'gregorian', \core_calendar\type_factory::get_list_of_calendar_types()));
220a90c5 102 $temp->add(new admin_setting_special_adminseesall());
103 //this is hacky because we do not want to include the stuff from calendar/lib.php
e106013f
SH
104 $temp->add(new admin_setting_configselect('calendar_site_timeformat', new lang_string('pref_timeformat', 'calendar'),
105 new lang_string('explain_site_timeformat', 'calendar'), '0',
106 array('0' => new lang_string('default', 'calendar'),
107 '%I:%M %p' => new lang_string('timeformat_12', 'calendar'),
108 '%H:%M' => new lang_string('timeformat_24', 'calendar'))));
f6554146
DP
109 $temp->add(new admin_setting_configselect('calendar_startwday', new lang_string('configstartwday', 'admin'),
110 new lang_string('helpstartofweek', 'admin'), get_string('firstdayofweek', 'langconfig'),
220a90c5 111 array(
e106013f
SH
112 0 => new lang_string('sunday', 'calendar'),
113 1 => new lang_string('monday', 'calendar'),
114 2 => new lang_string('tuesday', 'calendar'),
115 3 => new lang_string('wednesday', 'calendar'),
116 4 => new lang_string('thursday', 'calendar'),
117 5 => new lang_string('friday', 'calendar'),
118 6 => new lang_string('saturday', 'calendar')
220a90c5 119 )));
120 $temp->add(new admin_setting_special_calendar_weekend());
5bc12ca2
SB
121 $options = array(365 => new lang_string('numyear', '', 1),
122 270 => new lang_string('nummonths', '', 9),
123 180 => new lang_string('nummonths', '', 6),
124 150 => new lang_string('nummonths', '', 5),
125 120 => new lang_string('nummonths', '', 4),
126 90 => new lang_string('nummonths', '', 3),
127 60 => new lang_string('nummonths', '', 2),
128 30 => new lang_string('nummonth', '', 1),
129 21 => new lang_string('numweeks', '', 3),
130 14 => new lang_string('numweeks', '', 2),
131 7 => new lang_string('numweek', '', 1),
132 6 => new lang_string('numdays', '', 6),
133 5 => new lang_string('numdays', '', 5),
134 4 => new lang_string('numdays', '', 4),
135 3 => new lang_string('numdays', '', 3),
136 2 => new lang_string('numdays', '', 2),
137 1 => new lang_string('numday', '', 1));
138 $temp->add(new admin_setting_configselect('calendar_lookahead', new lang_string('configlookahead', 'admin'), new lang_string('helpupcominglookahead', 'admin'), 21, $options));
68ec4a27
ARN
139 $options = array();
140 for ($i=1; $i<=20; $i++) {
141 $options[$i] = $i;
142 }
e106013f
SH
143 $temp->add(new admin_setting_configselect('calendar_maxevents',new lang_string('configmaxevents','admin'),new lang_string('helpupcomingmaxevents', 'admin'),10,$options));
144 $temp->add(new admin_setting_configcheckbox('enablecalendarexport', new lang_string('enablecalendarexport', 'admin'), new lang_string('configenablecalendarexport','admin'), 1));
af5d990b
AA
145
146 // Calendar custom export settings.
147 $days = array(365 => new lang_string('numdays', '', 365),
148 180 => new lang_string('numdays', '', 180),
149 150 => new lang_string('numdays', '', 150),
150 120 => new lang_string('numdays', '', 120),
151 90 => new lang_string('numdays', '', 90),
152 60 => new lang_string('numdays', '', 60),
153 30 => new lang_string('numdays', '', 30),
154 5 => new lang_string('numdays', '', 5));
155 $temp->add(new admin_setting_configcheckbox('calendar_customexport', new lang_string('configcalendarcustomexport', 'admin'), new lang_string('helpcalendarcustomexport','admin'), 1));
156 $temp->add(new admin_setting_configselect('calendar_exportlookahead', new lang_string('configexportlookahead','admin'), new lang_string('helpexportlookahead', 'admin'), 365, $days));
157 $temp->add(new admin_setting_configselect('calendar_exportlookback', new lang_string('configexportlookback','admin'), new lang_string('helpexportlookback', 'admin'), 5, $days));
e106013f 158 $temp->add(new admin_setting_configtext('calendar_exportsalt', new lang_string('calendarexportsalt','admin'), new lang_string('configcalendarexportsalt', 'admin'), random_string(60)));
e73b527c 159 $temp->add(new admin_setting_configcheckbox('calendar_showicalsource', new lang_string('configshowicalsource', 'admin'), new lang_string('helpshowicalsource','admin'), 1));
220a90c5 160 $ADMIN->add('appearance', $temp);
161
cae83708 162 // blog
ab996aff
PS
163 $temp = new admin_settingpage('blog', new lang_string('blog','blog'), 'moodle/site:config', empty($CFG->enableblogs));
164 $temp->add(new admin_setting_configcheckbox('useblogassociations', new lang_string('useblogassociations', 'blog'), new lang_string('configuseblogassociations','blog'), 1));
165 $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'),
166 BLOG_SITE_LEVEL => new lang_string('siteblogs','blog'),
167 BLOG_USER_LEVEL => new lang_string('personalblogs','blog'))));
168 $temp->add(new admin_setting_configcheckbox('useexternalblogs', new lang_string('useexternalblogs', 'blog'), new lang_string('configuseexternalblogs','blog'), 1));
169 $temp->add(new admin_setting_configselect('externalblogcrontime', new lang_string('externalblogcrontime', 'blog'), new lang_string('configexternalblogcrontime', 'blog'), 86400,
170 array(43200 => new lang_string('numhours', '', 12),
171 86400 => new lang_string('numhours', '', 24),
172 172800 => new lang_string('numdays', '', 2),
173 604800 => new lang_string('numdays', '', 7))));
174 $temp->add(new admin_setting_configtext('maxexternalblogsperuser', new lang_string('maxexternalblogsperuser','blog'), new lang_string('configmaxexternalblogsperuser', 'blog'), 1));
175 $temp->add(new admin_setting_configcheckbox('blogusecomments', new lang_string('enablecomments', 'admin'), new lang_string('configenablecomments', 'admin'), 1));
176 $temp->add(new admin_setting_configcheckbox('blogshowcommentscount', new lang_string('showcommentscount', 'admin'), new lang_string('configshowcommentscount', 'admin'), 1));
177 $ADMIN->add('appearance', $temp);
cae83708 178
da3ab9c4 179 // Navigation settings
e106013f 180 $temp = new admin_settingpage('navigation', new lang_string('navigation'));
89c51017 181 $choices = array(
e106013f
SH
182 HOMEPAGE_SITE => new lang_string('site'),
183 HOMEPAGE_MY => new lang_string('mymoodle', 'admin'),
184 HOMEPAGE_USER => new lang_string('userpreference', 'admin')
89c51017 185 );
e5cfbeea
AG
186 $temp->add(new admin_setting_configselect('defaulthomepage', new lang_string('defaulthomepage', 'admin'),
187 new lang_string('configdefaulthomepage', 'admin'), HOMEPAGE_MY, $choices));
110831ce 188 $temp->add(new admin_setting_configcheckbox('allowguestmymoodle', new lang_string('allowguestmymoodle', 'admin'), new lang_string('configallowguestmymoodle', 'admin'), 1));
d20337f1 189 $temp->add(new admin_setting_configcheckbox('navshowfullcoursenames', new lang_string('navshowfullcoursenames', 'admin'), new lang_string('navshowfullcoursenames_help', 'admin'), 0));
e106013f 190 $temp->add(new admin_setting_configcheckbox('navshowcategories', new lang_string('navshowcategories', 'admin'), new lang_string('confignavshowcategories', 'admin'), 1));
b0712163 191 $temp->add(new admin_setting_configcheckbox('navshowmycoursecategories', new lang_string('navshowmycoursecategories', 'admin'), new lang_string('navshowmycoursecategories_help', 'admin'), 0));
e106013f 192 $temp->add(new admin_setting_configcheckbox('navshowallcourses', new lang_string('navshowallcourses', 'admin'), new lang_string('confignavshowallcourses', 'admin'), 0));
f87ce4e9
SH
193 $sortoptions = array(
194 'sortorder' => new lang_string('sort_sortorder', 'admin'),
195 'fullname' => new lang_string('sort_fullname', 'admin'),
196 'shortname' => new lang_string('sort_shortname', 'admin'),
197 'idnumber' => new lang_string('sort_idnumber', 'admin'),
198 );
199 $temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
8471a0db
AB
200 $temp->add(new admin_setting_configcheckbox('navsortmycourseshiddenlast',
201 new lang_string('navsortmycourseshiddenlast', 'admin'),
202 new lang_string('navsortmycourseshiddenlast_help', 'admin'),
203 1));
c0a9edbd
MN
204 $temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
205 new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
e106013f 206 $temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
3ae54e04 207 $temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
26f12a35 208 $temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 1));
4037098e 209 $temp->add(new admin_setting_configcheckbox('navshowfrontpagemods', new lang_string('navshowfrontpagemods', 'admin'), new lang_string('navshowfrontpagemods_help', 'admin'), 1));
e106013f 210 $temp->add(new admin_setting_configcheckbox('navadduserpostslinks', new lang_string('navadduserpostslinks', 'admin'), new lang_string('navadduserpostslinks_help', 'admin'), 1));
89c51017 211
da3ab9c4
SH
212 $ADMIN->add('appearance', $temp);
213
5ca3c838 214 // "htmlsettings" settingpage
e106013f
SH
215 $temp = new admin_settingpage('htmlsettings', new lang_string('htmlsettings', 'admin'));
216 $temp->add(new admin_setting_configcheckbox('formatstringstriptags', new lang_string('stripalltitletags', 'admin'), new lang_string('configstripalltitletags', 'admin'), 1));
c3ed4a5a 217 $temp->add(new admin_setting_emoticons());
8eb1d25f 218 $ADMIN->add('appearance', $temp);
e106013f 219 $ADMIN->add('appearance', new admin_externalpage('resetemoticons', new lang_string('emoticonsreset', 'admin'),
7680da6c 220 new moodle_url('/admin/resetemoticons.php'), 'moodle/site:config', true));
8eb1d25f 221
220a90c5 222 // "documentation" settingpage
e106013f 223 $temp = new admin_settingpage('documentation', new lang_string('moodledocs'));
b07f2c46 224 $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
225 $ltemp = array('' => get_string('forceno'));
226 $ltemp += get_string_manager()->get_list_of_translations(true);
227 $temp->add(new admin_setting_configselect('doclang', get_string('doclang', 'admin'), get_string('configdoclang', 'admin'), '', $ltemp));
e106013f 228 $temp->add(new admin_setting_configcheckbox('doctonewwindow', new lang_string('doctonewwindow', 'admin'), new lang_string('configdoctonewwindow', 'admin'), 0));
220a90c5 229 $ADMIN->add('appearance', $temp);
230
823c593f
RT
231 $temp = new admin_externalpage('mypage', new lang_string('mypage', 'admin'), $CFG->wwwroot . '/my/indexsys.php',
232 'moodle/my:configsyspages');
03d9401e
MD
233 $ADMIN->add('appearance', $temp);
234
823c593f
RT
235 $temp = new admin_externalpage('profilepage', new lang_string('myprofile', 'admin'), $CFG->wwwroot . '/user/profilesys.php',
236 'moodle/my:configsyspages');
220a90c5 237 $ADMIN->add('appearance', $temp);
238
df997f84 239 // coursecontact is the person responsible for course - usually manages enrolments, receives notification, etc.
e106013f 240 $temp = new admin_settingpage('coursecontact', new lang_string('courses'));
df997f84 241 $temp->add(new admin_setting_special_coursecontact());
a487a3ed
DK
242 $temp->add(new admin_setting_configcheckbox('coursecontactduplicates',
243 new lang_string('coursecontactduplicates', 'admin'),
244 new lang_string('coursecontactduplicates_desc', 'admin'), 0));
7fb46992 245 $temp->add(new admin_setting_configcheckbox('courselistshortnames',
e106013f
SH
246 new lang_string('courselistshortnames', 'admin'),
247 new lang_string('courselistshortnames_desc', 'admin'), 0));
3b7bfbb5
FM
248 $temp->add(new admin_setting_configtext('coursesperpage', new lang_string('coursesperpage', 'admin'), new lang_string('configcoursesperpage', 'admin'), 20, PARAM_INT));
249 $temp->add(new admin_setting_configtext('courseswithsummarieslimit', new lang_string('courseswithsummarieslimit', 'admin'), new lang_string('configcourseswithsummarieslimit', 'admin'), 10, PARAM_INT));
d1f8c1bd
MG
250 $temp->add(new admin_setting_configtext('courseoverviewfileslimit', new lang_string('courseoverviewfileslimit'),
251 new lang_string('configcourseoverviewfileslimit', 'admin'), 1, PARAM_INT));
252 $temp->add(new admin_setting_configtext('courseoverviewfilesext', new lang_string('courseoverviewfilesext'),
253 new lang_string('configcourseoverviewfilesext', 'admin'), '.jpg,.gif,.png'));
3b31d8c9
CF
254 $temp->add(new admin_setting_configtext('coursegraceperiodbefore', new lang_string('coursegraceperiodbefore', 'admin'),
255 new lang_string('configcoursegraceperiodbefore', 'admin'), 0, PARAM_INT));
256 $temp->add(new admin_setting_configtext('coursegraceperiodafter', new lang_string('coursegraceperiodafter', 'admin'),
257 new lang_string('configcoursegraceperiodafter', 'admin'), 0, PARAM_INT));
220a90c5 258 $ADMIN->add('appearance', $temp);
259
e106013f 260 $temp = new admin_settingpage('ajax', new lang_string('ajaxuse'));
e106013f
SH
261 $temp->add(new admin_setting_configcheckbox('useexternalyui', new lang_string('useexternalyui', 'admin'), new lang_string('configuseexternalyui', 'admin'), 0));
262 $temp->add(new admin_setting_configcheckbox('yuicomboloading', new lang_string('yuicomboloading', 'admin'), new lang_string('configyuicomboloading', 'admin'), 1));
263 $setting = new admin_setting_configcheckbox('cachejs', new lang_string('cachejs', 'admin'), new lang_string('cachejs_help', 'admin'), 1);
2288073a
PS
264 $setting->set_updatedcallback('js_reset_all_caches');
265 $temp->add($setting);
945a81a9 266 $temp->add(new admin_setting_configcheckbox('modchooserdefault', new lang_string('modchooserdefault', 'admin'), new lang_string('configmodchooserdefault', 'admin'), 1));
220a90c5 267 $ADMIN->add('appearance', $temp);
268
ff1fc4d9
TM
269 // Link to tag management interface.
270 $url = new moodle_url('/tag/manage.php');
271 $hidden = empty($CFG->usetags);
272 $page = new admin_externalpage('managetags', new lang_string('managetags', 'tag'), $url, 'moodle/tag:manage', $hidden);
273 $ADMIN->add('appearance', $page);
8f6c1f34 274
e106013f
SH
275 $temp = new admin_settingpage('additionalhtml', new lang_string('additionalhtml', 'admin'));
276 $temp->add(new admin_setting_heading('additionalhtml_heading', new lang_string('additionalhtml_heading', 'admin'), new lang_string('additionalhtml_desc', 'admin')));
277 $temp->add(new admin_setting_configtextarea('additionalhtmlhead', new lang_string('additionalhtmlhead', 'admin'), new lang_string('additionalhtmlhead_desc', 'admin'), '', PARAM_RAW));
278 $temp->add(new admin_setting_configtextarea('additionalhtmltopofbody', new lang_string('additionalhtmltopofbody', 'admin'), new lang_string('additionalhtmltopofbody_desc', 'admin'), '', PARAM_RAW));
279 $temp->add(new admin_setting_configtextarea('additionalhtmlfooter', new lang_string('additionalhtmlfooter', 'admin'), new lang_string('additionalhtmlfooter_desc', 'admin'), '', PARAM_RAW));
90e920c7 280 $ADMIN->add('appearance', $temp);
a559f630 281
5beb3885
MN
282 $setting = new admin_setting_configcheckbox('cachetemplates', new lang_string('cachetemplates', 'admin'),
283 new lang_string('cachetemplates_help', 'admin'), 1);
e63395bb 284 $setting->set_updatedcallback('template_reset_all_caches');
5beb3885
MN
285 $temp = new admin_settingpage('templates', new lang_string('templates', 'admin'));
286 $temp->add($setting);
287 $ADMIN->add('appearance', $temp);
a559f630 288} // end of speedup