Commit | Line | Data |
---|---|---|
11b749ca | 1 | <?php |
e87214bd PS |
2 | // This file is part of Moodle - http://moodle.org/ |
3 | // | |
4 | // Moodle is free software: you can redistribute it and/or modify | |
5 | // it under the terms of the GNU General Public License as published by | |
6 | // the Free Software Foundation, either version 3 of the License, or | |
7 | // (at your option) any later version. | |
8 | // | |
9 | // Moodle is distributed in the hope that it will be useful, | |
10 | // but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | // GNU General Public License for more details. | |
13 | // | |
14 | // You should have received a copy of the GNU General Public License | |
15 | // along with Moodle. If not, see <http://www.gnu.org/licenses/>. | |
16 | ||
17 | /** | |
18 | * Load all plugins into the admin tree. | |
19 | * | |
20 | * Please note that is file is always loaded last - it means that you can inject entries into other categories too. | |
21 | * | |
22 | * @package core | |
23 | * @copyright 2007 Petr Skoda {@link http://skodak.org} | |
24 | * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later | |
25 | */ | |
b63a6a63 | 26 | |
78946b9b | 27 | if ($hassiteconfig) { |
e5e0d397 SH |
28 | /* @var admin_root $ADMIN */ |
29 | $ADMIN->locate('modules')->set_sorting(true); | |
30 | ||
b9934a17 | 31 | $ADMIN->add('modules', new admin_page_pluginsoverview()); |
fde6f79f MG |
32 | |
33 | // activity modules | |
e106013f | 34 | $ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules'))); |
220a90c5 | 35 | $ADMIN->add('modsettings', new admin_page_managemods()); |
e87214bd PS |
36 | foreach (core_plugin_manager::instance()->get_plugins_of_type('mod') as $plugin) { |
37 | /** @var \core\plugininfo\mod $plugin */ | |
38 | $plugin->load_settings($ADMIN, 'modsettings', $hassiteconfig); | |
220a90c5 | 39 | } |
40 | ||
3776335c MG |
41 | // course formats |
42 | $ADMIN->add('modules', new admin_category('formatsettings', new lang_string('courseformats'))); | |
43 | $temp = new admin_settingpage('manageformats', new lang_string('manageformats', 'core_admin')); | |
44 | $temp->add(new admin_setting_manageformats()); | |
45 | $ADMIN->add('formatsettings', $temp); | |
e87214bd PS |
46 | foreach (core_plugin_manager::instance()->get_plugins_of_type('format') as $plugin) { |
47 | /** @var \core\plugininfo\format $plugin */ | |
48 | $plugin->load_settings($ADMIN, 'formatsettings', $hassiteconfig); | |
3776335c MG |
49 | } |
50 | ||
870d4280 | 51 | // blocks |
e106013f | 52 | $ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks'))); |
220a90c5 | 53 | $ADMIN->add('blocksettings', new admin_page_manageblocks()); |
e87214bd PS |
54 | foreach (core_plugin_manager::instance()->get_plugins_of_type('block') as $plugin) { |
55 | /** @var \core\plugininfo\block $plugin */ | |
56 | $plugin->load_settings($ADMIN, 'blocksettings', $hassiteconfig); | |
220a90c5 | 57 | } |
58 | ||
75c34c23 | 59 | // message outputs |
e106013f | 60 | $ADMIN->add('modules', new admin_category('messageoutputs', new lang_string('messageoutputs', 'message'))); |
75c34c23 | 61 | $ADMIN->add('messageoutputs', new admin_page_managemessageoutputs()); |
1d72e9d4 | 62 | $ADMIN->add('messageoutputs', new admin_page_defaultmessageoutputs()); |
e87214bd PS |
63 | foreach (core_plugin_manager::instance()->get_plugins_of_type('message') as $plugin) { |
64 | /** @var \core\plugininfo\message $plugin */ | |
65 | $plugin->load_settings($ADMIN, 'messageoutputs', $hassiteconfig); | |
2f2137fc | 66 | } |
75c34c23 | 67 | |
df997f84 | 68 | // authentication plugins |
e106013f | 69 | $ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin'))); |
df997f84 | 70 | |
e106013f | 71 | $temp = new admin_settingpage('manageauths', new lang_string('authsettings', 'admin')); |
df997f84 | 72 | $temp->add(new admin_setting_manageauths()); |
e106013f | 73 | $temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), '')); |
df997f84 | 74 | $temp->add(new admin_setting_special_registerauth()); |
e106013f SH |
75 | $temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', new lang_string('authpreventaccountcreation', 'admin'), new lang_string('authpreventaccountcreation_help', 'admin'), 0)); |
76 | $temp->add(new admin_setting_configcheckbox('loginpageautofocus', new lang_string('loginpageautofocus', 'admin'), new lang_string('loginpageautofocus_help', 'admin'), 0)); | |
77 | $temp->add(new admin_setting_configselect('guestloginbutton', new lang_string('guestloginbutton', 'auth'), | |
78 | new lang_string('showguestlogin', 'auth'), '1', array('0'=>new lang_string('hide'), '1'=>new lang_string('show')))); | |
79 | $temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'), | |
80 | new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url())), '')); | |
81 | $temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'), | |
82 | new lang_string('forgottenpassword', 'auth'), '')); | |
83 | $temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'), | |
84 | new lang_string('authinstructions', 'auth'), '')); | |
85 | $temp->add(new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'), new lang_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS)); | |
86 | $temp->add(new admin_setting_configtext('denyemailaddresses', new lang_string('denyemailaddresses', 'admin'), new lang_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS)); | |
87 | $temp->add(new admin_setting_configcheckbox('verifychangedemail', new lang_string('verifychangedemail', 'admin'), new lang_string('configverifychangedemail', 'admin'), 1)); | |
88 | ||
89 | $temp->add(new admin_setting_configtext('recaptchapublickey', new lang_string('recaptchapublickey', 'admin'), new lang_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS)); | |
90 | $temp->add(new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS)); | |
df997f84 PS |
91 | $ADMIN->add('authsettings', $temp); |
92 | ||
6cf20915 PS |
93 | $temp = new admin_externalpage('authtestsettings', get_string('testsettings', 'core_auth'), new moodle_url("/auth/test_settings.php"), 'moodle/site:config', true); |
94 | $ADMIN->add('authsettings', $temp); | |
95 | ||
e87214bd PS |
96 | foreach (core_plugin_manager::instance()->get_plugins_of_type('auth') as $plugin) { |
97 | /** @var \core\plugininfo\auth $plugin */ | |
98 | $plugin->load_settings($ADMIN, 'authsettings', $hassiteconfig); | |
df997f84 PS |
99 | } |
100 | ||
df997f84 | 101 | // Enrolment plugins |
e106013f SH |
102 | $ADMIN->add('modules', new admin_category('enrolments', new lang_string('enrolments', 'enrol'))); |
103 | $temp = new admin_settingpage('manageenrols', new lang_string('manageenrols', 'enrol')); | |
df997f84 | 104 | $temp->add(new admin_setting_manageenrols()); |
df997f84 | 105 | $ADMIN->add('enrolments', $temp); |
6cf20915 PS |
106 | |
107 | $temp = new admin_externalpage('enroltestsettings', get_string('testsettings', 'core_enrol'), new moodle_url("/enrol/test_settings.php"), 'moodle/site:config', true); | |
108 | $ADMIN->add('enrolments', $temp); | |
109 | ||
e87214bd PS |
110 | foreach(core_plugin_manager::instance()->get_plugins_of_type('enrol') as $plugin) { |
111 | /** @var \core\plugininfo\enrol $plugin */ | |
112 | $plugin->load_settings($ADMIN, 'enrolments', $hassiteconfig); | |
df997f84 | 113 | } |
df997f84 | 114 | |
c5d2d0dd | 115 | |
a5747cf8 | 116 | /// Editor plugins |
e106013f SH |
117 | $ADMIN->add('modules', new admin_category('editorsettings', new lang_string('editors', 'editor'))); |
118 | $temp = new admin_settingpage('manageeditors', new lang_string('editorsettings', 'editor')); | |
a5747cf8 | 119 | $temp->add(new admin_setting_manageeditors()); |
120 | $ADMIN->add('editorsettings', $temp); | |
e87214bd PS |
121 | foreach (core_plugin_manager::instance()->get_plugins_of_type('editor') as $plugin) { |
122 | /** @var \core\plugininfo\editor $plugin */ | |
123 | $plugin->load_settings($ADMIN, 'editorsettings', $hassiteconfig); | |
7a856a93 | 124 | } |
6fc67fce | 125 | |
1dce6261 | 126 | /// License types |
e106013f SH |
127 | $ADMIN->add('modules', new admin_category('licensesettings', new lang_string('licenses'))); |
128 | $temp = new admin_settingpage('managelicenses', new lang_string('managelicenses', 'admin')); | |
ba74f517 DC |
129 | |
130 | require_once($CFG->libdir . '/licenselib.php'); | |
131 | $licenses = array(); | |
132 | $array = explode(',', $CFG->licenses); | |
133 | foreach ($array as $value) { | |
e106013f | 134 | $licenses[$value] = new lang_string($value, 'license'); |
ba74f517 | 135 | } |
e106013f | 136 | $temp->add(new admin_setting_configselect('sitedefaultlicense', new lang_string('configsitedefaultlicense','admin'), new lang_string('configsitedefaultlicensehelp','admin'), 'allrightsreserved', $licenses)); |
1dce6261 DC |
137 | $temp->add(new admin_setting_managelicenses()); |
138 | $ADMIN->add('licensesettings', $temp); | |
a5747cf8 | 139 | |
140 | /// Filter plugins | |
e106013f | 141 | $ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters'))); |
dcdf3b29 | 142 | |
143 | $ADMIN->add('filtersettings', new admin_page_managefilters()); | |
144 | ||
220a90c5 | 145 | // "filtersettings" settingpage |
e106013f | 146 | $temp = new admin_settingpage('commonfiltersettings', new lang_string('commonfiltersettings', 'admin')); |
220a90c5 | 147 | if ($ADMIN->fulltree) { |
5b8fa09b | 148 | $cachetimes = array( |
e106013f SH |
149 | 604800 => new lang_string('numdays','',7), |
150 | 86400 => new lang_string('numdays','',1), | |
151 | 43200 => new lang_string('numhours','',12), | |
152 | 10800 => new lang_string('numhours','',3), | |
153 | 7200 => new lang_string('numhours','',2), | |
154 | 3600 => new lang_string('numhours','',1), | |
155 | 2700 => new lang_string('numminutes','',45), | |
156 | 1800 => new lang_string('numminutes','',30), | |
157 | 900 => new lang_string('numminutes','',15), | |
158 | 600 => new lang_string('numminutes','',10), | |
159 | 540 => new lang_string('numminutes','',9), | |
160 | 480 => new lang_string('numminutes','',8), | |
161 | 420 => new lang_string('numminutes','',7), | |
162 | 360 => new lang_string('numminutes','',6), | |
163 | 300 => new lang_string('numminutes','',5), | |
164 | 240 => new lang_string('numminutes','',4), | |
165 | 180 => new lang_string('numminutes','',3), | |
166 | 120 => new lang_string('numminutes','',2), | |
167 | 60 => new lang_string('numminutes','',1), | |
168 | 30 => new lang_string('numseconds','',30), | |
169 | 0 => new lang_string('no') | |
5b8fa09b | 170 | ); |
109e3cb2 | 171 | $items = array(); |
e106013f SH |
172 | $items[] = new admin_setting_configselect('cachetext', new lang_string('cachetext', 'admin'), new lang_string('configcachetext', 'admin'), 60, $cachetimes); |
173 | $items[] = new admin_setting_configselect('filteruploadedfiles', new lang_string('filteruploadedfiles', 'admin'), new lang_string('configfilteruploadedfiles', 'admin'), 0, | |
174 | array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly'))); | |
175 | $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0); | |
176 | $items[] = new admin_setting_configcheckbox('filtermatchonepertext', new lang_string('filtermatchonepertext', 'admin'), new lang_string('configfiltermatchonepertext', 'admin'), 0); | |
109e3cb2 | 177 | foreach ($items as $item) { |
178 | $item->set_updatedcallback('reset_text_filters_cache'); | |
179 | $temp->add($item); | |
180 | } | |
220a90c5 | 181 | } |
182 | $ADMIN->add('filtersettings', $temp); | |
183 | ||
e87214bd PS |
184 | foreach (core_plugin_manager::instance()->get_plugins_of_type('filter') as $plugin) { |
185 | /** @var \core\plugininfo\filter $plugin */ | |
186 | $plugin->load_settings($ADMIN, 'filtersettings', $hassiteconfig); | |
220a90c5 | 187 | } |
67a87e7d | 188 | |
78946b9b PS |
189 | |
190 | //== Portfolio settings == | |
191 | require_once($CFG->libdir. '/portfoliolib.php'); | |
e106013f SH |
192 | $catname = new lang_string('portfolios', 'portfolio'); |
193 | $manage = new lang_string('manageportfolios', 'portfolio'); | |
67a87e7d | 194 | $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; |
195 | ||
90658eef | 196 | $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios))); |
67a87e7d | 197 | |
9d81733d SM |
198 | // Add manage page (with table) |
199 | $temp = new admin_page_manageportfolios(); | |
200 | $ADMIN->add('portfoliosettings', $temp); | |
201 | ||
202 | // Add common settings page | |
e106013f SH |
203 | $temp = new admin_settingpage('manageportfolioscommon', new lang_string('commonportfoliosettings', 'portfolio')); |
204 | $temp->add(new admin_setting_heading('manageportfolioscommon', '', new lang_string('commonsettingsdesc', 'portfolio'))); | |
bee4bce2 | 205 | $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings |
206 | $fileoptions = $fileinfo['options']; | |
207 | $temp->add(new admin_setting_configselect( | |
208 | 'portfolio_moderate_filesize_threshold', | |
e106013f SH |
209 | new lang_string('moderatefilesizethreshold', 'portfolio'), |
210 | new lang_string('moderatefilesizethresholddesc', 'portfolio'), | |
bee4bce2 | 211 | $fileinfo['moderate'], $fileoptions)); |
212 | $temp->add(new admin_setting_configselect( | |
213 | 'portfolio_high_filesize_threshold', | |
e106013f SH |
214 | new lang_string('highfilesizethreshold', 'portfolio'), |
215 | new lang_string('highfilesizethresholddesc', 'portfolio'), | |
bee4bce2 | 216 | $fileinfo['high'], $fileoptions)); |
217 | ||
218 | $temp->add(new admin_setting_configtext( | |
219 | 'portfolio_moderate_db_threshold', | |
e106013f SH |
220 | new lang_string('moderatedbsizethreshold', 'portfolio'), |
221 | new lang_string('moderatedbsizethresholddesc', 'portfolio'), | |
1e12c120 | 222 | 20, PARAM_INT, 3)); |
bee4bce2 | 223 | |
224 | $temp->add(new admin_setting_configtext( | |
225 | 'portfolio_high_db_threshold', | |
e106013f SH |
226 | new lang_string('highdbsizethreshold', 'portfolio'), |
227 | new lang_string('highdbsizethresholddesc', 'portfolio'), | |
1e12c120 | 228 | 50, PARAM_INT, 3)); |
a50ef3d3 | 229 | |
230 | $ADMIN->add('portfoliosettings', $temp); | |
56aee7c2 DM |
231 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', new lang_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true)); |
232 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', new lang_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true)); | |
233 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', new lang_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true)); | |
a50ef3d3 | 234 | |
08d5e18b | 235 | foreach (portfolio_instances(false, false) as $portfolio) { |
edf1fc35 | 236 | require_once($CFG->dirroot . '/portfolio/' . $portfolio->get('plugin') . '/lib.php'); |
67a87e7d | 237 | $classname = 'portfolio_plugin_' . $portfolio->get('plugin'); |
a50ef3d3 | 238 | $ADMIN->add( |
239 | 'portfoliosettings', | |
08d5e18b | 240 | new admin_externalpage( |
241 | 'portfoliosettings' . $portfolio->get('id'), | |
658837bb | 242 | $portfolio->get('name'), |
6010eda2 MD |
243 | $url . '?action=edit&pf=' . $portfolio->get('id'), |
244 | 'moodle/site:config' | |
0a94e4a9 | 245 | ) |
a50ef3d3 | 246 | ); |
67a87e7d | 247 | } |
4a65c39a | 248 | |
249 | // repository setting | |
250 | require_once("$CFG->dirroot/repository/lib.php"); | |
e106013f SH |
251 | $catname =new lang_string('repositories', 'repository'); |
252 | $managerepo = new lang_string('manage', 'repository'); | |
04bd6d2d | 253 | $url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php'; |
4a65c39a | 254 | $ADMIN->add('modules', new admin_category('repositorysettings', $catname)); |
9d81733d SM |
255 | |
256 | // Add main page (with table) | |
257 | $temp = new admin_page_managerepositories(); | |
258 | $ADMIN->add('repositorysettings', $temp); | |
259 | ||
260 | // Add common settings page | |
e106013f | 261 | $temp = new admin_settingpage('managerepositoriescommon', new lang_string('commonrepositorysettings', 'repository')); |
c1b3ac43 RT |
262 | $temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120, PARAM_INT)); |
263 | $temp->add(new admin_setting_configtext('repositorygetfiletimeout', new lang_string('getfiletimeout', 'repository'), new lang_string('configgetfiletimeout', 'repository'), 30, PARAM_INT)); | |
264 | $temp->add(new admin_setting_configtext('repositorysyncfiletimeout', new lang_string('syncfiletimeout', 'repository'), new lang_string('configsyncfiletimeout', 'repository'), 1, PARAM_INT)); | |
265 | $temp->add(new admin_setting_configtext('repositorysyncimagetimeout', new lang_string('syncimagetimeout', 'repository'), new lang_string('configsyncimagetimeout', 'repository'), 3, PARAM_INT)); | |
e106013f SH |
266 | $temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', new lang_string('allowexternallinks', 'repository'), new lang_string('configallowexternallinks', 'repository'), 1)); |
267 | $temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', new lang_string('legacyfilesinnewcourses', 'admin'), new lang_string('legacyfilesinnewcourses_help', 'admin'), 0)); | |
cc0bb815 | 268 | $temp->add(new admin_setting_configcheckbox('legacyfilesaddallowed', new lang_string('legacyfilesaddallowed', 'admin'), new lang_string('legacyfilesaddallowed_help', 'admin'), 1)); |
4a65c39a | 269 | $ADMIN->add('repositorysettings', $temp); |
4f2b9a4f | 270 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', |
56aee7c2 | 271 | new lang_string('addplugin', 'repository'), $url, 'moodle/site:config', true)); |
4a65c39a | 272 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', |
56aee7c2 | 273 | new lang_string('deleterepository', 'repository'), $url, 'moodle/site:config', true)); |
4a65c39a | 274 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', |
56aee7c2 | 275 | new lang_string('manage', 'repository'), $url, 'moodle/site:config', true)); |
0d099914 | 276 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', |
56aee7c2 | 277 | new lang_string('createrepository', 'repository'), $url, 'moodle/site:config', true)); |
0d099914 | 278 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', |
56aee7c2 | 279 | new lang_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true)); |
e87214bd PS |
280 | foreach (core_plugin_manager::instance()->get_plugins_of_type('repository') as $plugin) { |
281 | /** @var \core\plugininfo\repository $plugin */ | |
282 | $plugin->load_settings($ADMIN, 'repositorysettings', $hassiteconfig); | |
4a65c39a | 283 | } |
bee4bce2 | 284 | |
5ae9f539 | 285 | /// Web services |
e106013f | 286 | $ADMIN->add('modules', new admin_category('webservicesettings', new lang_string('webservices', 'webservice'))); |
489987af JM |
287 | // Mobile |
288 | $temp = new admin_settingpage('mobile', new lang_string('mobile','admin'), 'moodle/site:config', false); | |
289 | $enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services')); | |
290 | $enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation')); | |
291 | $temp->add(new admin_setting_enablemobileservice('enablemobilewebservice', | |
292 | new lang_string('enablemobilewebservice', 'admin'), | |
293 | new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0)); | |
294 | $temp->add(new admin_setting_configtext('mobilecssurl', new lang_string('mobilecssurl', 'admin'), new lang_string('configmobilecssurl','admin'), '', PARAM_URL)); | |
295 | $ADMIN->add('webservicesettings', $temp); | |
3e6161fb | 296 | /// overview page |
e106013f | 297 | $temp = new admin_settingpage('webservicesoverview', new lang_string('webservicesoverview', 'webservice')); |
3e6161fb | 298 | $temp->add(new admin_setting_webservicesoverview()); |
299 | $ADMIN->add('webservicesettings', $temp); | |
cde291ed | 300 | //API documentation |
e106013f | 301 | $ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', new lang_string('wsdocapi', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/documentation.php", 'moodle/site:config', false)); |
3e6161fb | 302 | /// manage service |
e106013f | 303 | $temp = new admin_settingpage('externalservices', new lang_string('externalservices', 'webservice')); |
489987af JM |
304 | $temp->add(new admin_setting_enablemobileservice('enablemobilewebservice', |
305 | new lang_string('enablemobilewebservice', 'admin'), | |
306 | new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0)); | |
e106013f | 307 | $temp->add(new admin_setting_heading('manageserviceshelpexplaination', new lang_string('information', 'webservice'), new lang_string('servicehelpexplanation', 'webservice'))); |
cc93c7da | 308 | $temp->add(new admin_setting_manageexternalservices()); |
309 | $ADMIN->add('webservicesettings', $temp); | |
e106013f SH |
310 | $ADMIN->add('webservicesettings', new admin_externalpage('externalservice', new lang_string('editaservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service.php", 'moodle/site:config', true)); |
311 | $ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', new lang_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_functions.php", 'moodle/site:config', true)); | |
312 | $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', new lang_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_users.php", 'moodle/site:config', true)); | |
313 | $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusersettings', new lang_string('serviceusersettings', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_user_settings.php", 'moodle/site:config', true)); | |
5ae9f539 | 314 | /// manage protocol page link |
e106013f | 315 | $temp = new admin_settingpage('webserviceprotocols', new lang_string('manageprotocols', 'webservice')); |
da124b5e | 316 | $temp->add(new admin_setting_managewebserviceprotocols()); |
cc93c7da | 317 | if (empty($CFG->enablewebservices)) { |
e106013f | 318 | $temp->add(new admin_setting_heading('webservicesaredisabled', '', new lang_string('disabledwarning', 'webservice'))); |
cc93c7da | 319 | } |
b4c91012 SH |
320 | |
321 | // We cannot use $OUTPUT this early, doing so means that we lose the ability | |
322 | // to set the page layout on all admin pages. | |
323 | // $wsdoclink = $OUTPUT->doc_link('How_to_get_a_security_key'); | |
324 | $url = new moodle_url(get_docs_url('How_to_get_a_security_key')); | |
5e963820 | 325 | $wsdoclink = html_writer::tag('a', new lang_string('supplyinfo', 'webservice'), array('href'=>$url)); |
e106013f SH |
326 | $temp->add(new admin_setting_configcheckbox('enablewsdocumentation', new lang_string('enablewsdocumentation', |
327 | 'admin'), new lang_string('configenablewsdocumentation', 'admin', $wsdoclink), false)); | |
cc93c7da | 328 | $ADMIN->add('webservicesettings', $temp); |
5ae9f539 | 329 | /// links to protocol pages |
e87214bd PS |
330 | foreach (core_plugin_manager::instance()->get_plugins_of_type('webservice') as $plugin) { |
331 | /** @var \core\plugininfo\webservice $plugin */ | |
332 | $plugin->load_settings($ADMIN, 'webservicesettings', $hassiteconfig); | |
cc93c7da | 333 | } |
5ae9f539 | 334 | /// manage token page link |
e106013f SH |
335 | $ADMIN->add('webservicesettings', new admin_externalpage('addwebservicetoken', new lang_string('managetokens', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/tokens.php", 'moodle/site:config', true)); |
336 | $temp = new admin_settingpage('webservicetokens', new lang_string('managetokens', 'webservice')); | |
5ae9f539 | 337 | $temp->add(new admin_setting_managewebservicetokens()); |
338 | if (empty($CFG->enablewebservices)) { | |
e106013f | 339 | $temp->add(new admin_setting_heading('webservicesaredisabled', '', new lang_string('disabledwarning', 'webservice'))); |
5ae9f539 | 340 | } |
341 | $ADMIN->add('webservicesettings', $temp); | |
2567584d | 342 | } |
df997f84 | 343 | |
b6eb984a | 344 | // Question type settings |
78946b9b | 345 | if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { |
4125ded1 | 346 | |
fde4560d | 347 | // Question behaviour settings. |
e106013f | 348 | $ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin'))); |
fde4560d TH |
349 | $ADMIN->add('qbehavioursettings', new admin_page_manageqbehaviours()); |
350 | ||
bee4bce2 | 351 | // Question type settings. |
e106013f | 352 | $ADMIN->add('modules', new admin_category('qtypesettings', new lang_string('questiontypes', 'admin'))); |
bee4bce2 | 353 | $ADMIN->add('qtypesettings', new admin_page_manageqtypes()); |
4125ded1 TH |
354 | |
355 | // Question preview defaults. | |
356 | $settings = new admin_settingpage('qdefaultsetting', | |
357 | get_string('questionpreviewdefaults', 'question'), | |
358 | 'moodle/question:config'); | |
359 | $ADMIN->add('qtypesettings', $settings); | |
360 | ||
361 | $settings->add(new admin_setting_heading('qdefaultsetting_preview_options', | |
362 | '', get_string('questionpreviewdefaults_desc', 'question'))); | |
363 | ||
364 | // These keys are question_display_options::HIDDEN and VISIBLE. | |
365 | $hiddenofvisible = array( | |
366 | 0 => get_string('notshown', 'question'), | |
367 | 1 => get_string('shown', 'question'), | |
368 | ); | |
369 | ||
370 | $settings->add(new admin_setting_question_behaviour('question_preview/behaviour', | |
371 | get_string('howquestionsbehave', 'question'), '', | |
372 | 'deferredfeedback')); | |
373 | ||
374 | $settings->add(new admin_setting_configselect('question_preview/correctness', | |
375 | get_string('whethercorrect', 'question'), '', 1, $hiddenofvisible)); | |
376 | ||
377 | // These keys are question_display_options::HIDDEN, MARK_ONLY and MARK_AND_MAX. | |
378 | $marksoptions = array( | |
379 | 0 => get_string('notshown', 'question'), | |
380 | 1 => get_string('showmaxmarkonly', 'question'), | |
381 | 2 => get_string('showmarkandmax', 'question'), | |
382 | ); | |
383 | $settings->add(new admin_setting_configselect('question_preview/marks', | |
384 | get_string('marks', 'question'), '', 1, $marksoptions)); | |
385 | ||
386 | $settings->add(new admin_setting_configselect('question_preview/markdp', | |
387 | get_string('decimalplacesingrades', 'question'), '', 2, array(0, 1, 2, 3, 4, 5, 6, 7))); | |
388 | ||
389 | $settings->add(new admin_setting_configselect('question_preview/feedback', | |
390 | get_string('specificfeedback', 'question'), '', 1, $hiddenofvisible)); | |
391 | ||
392 | $settings->add(new admin_setting_configselect('question_preview/generalfeedback', | |
393 | get_string('generalfeedback', 'question'), '', 1, $hiddenofvisible)); | |
394 | ||
395 | $settings->add(new admin_setting_configselect('question_preview/rightanswer', | |
396 | get_string('rightanswer', 'question'), '', 1, $hiddenofvisible)); | |
397 | ||
398 | $settings->add(new admin_setting_configselect('question_preview/history', | |
399 | get_string('responsehistory', 'question'), '', 0, $hiddenofvisible)); | |
400 | ||
401 | // Settings for particular question types. | |
e87214bd PS |
402 | foreach (core_plugin_manager::instance()->get_plugins_of_type('qtype') as $plugin) { |
403 | /** @var \core\plugininfo\qtype $plugin */ | |
404 | $plugin->load_settings($ADMIN, 'qtypesettings', $hassiteconfig); | |
bee4bce2 | 405 | } |
220a90c5 | 406 | } |
b6eb984a TH |
407 | |
408 | // Plagiarism plugin settings | |
bce59524 | 409 | if ($hassiteconfig && !empty($CFG->enableplagiarism)) { |
e106013f | 410 | $ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism'))); |
760007a2 DM |
411 | $ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'), |
412 | $CFG->wwwroot . '/' . $CFG->admin . '/plagiarism.php')); | |
413 | ||
e87214bd PS |
414 | foreach (core_plugin_manager::instance()->get_plugins_of_type('plagiarism') as $plugin) { |
415 | /** @var \core\plugininfo\plagiarism $plugin */ | |
d98305bd | 416 | $plugin->load_settings($ADMIN, 'plagiarism', $hassiteconfig); |
bce59524 DM |
417 | } |
418 | } | |
e106013f | 419 | $ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comments'), $CFG->wwwroot.'/comment/', 'moodle/site:viewreports')); |
b63a6a63 | 420 | |
b6eb984a TH |
421 | // Course reports settings |
422 | if ($hassiteconfig) { | |
423 | $pages = array(); | |
bd3b3bba | 424 | foreach (core_component::get_plugin_list('coursereport') as $report => $path) { |
b6eb984a TH |
425 | $file = $CFG->dirroot . '/course/report/' . $report . '/settings.php'; |
426 | if (file_exists($file)) { | |
427 | $settings = new admin_settingpage('coursereport' . $report, | |
e106013f | 428 | new lang_string('pluginname', 'coursereport_' . $report), 'moodle/site:config'); |
b6eb984a TH |
429 | // settings.php may create a subcategory or unset the settings completely |
430 | include($file); | |
431 | if ($settings) { | |
432 | $pages[] = $settings; | |
433 | } | |
434 | } | |
435 | } | |
436 | if (!empty($pages)) { | |
e106013f | 437 | $ADMIN->add('modules', new admin_category('coursereports', new lang_string('coursereports'))); |
b6eb984a TH |
438 | foreach ($pages as $page) { |
439 | $ADMIN->add('coursereports', $page); | |
440 | } | |
441 | } | |
e30cc24c | 442 | unset($pages); |
b6eb984a TH |
443 | } |
444 | ||
445 | // Now add reports | |
e30cc24c | 446 | $pages = array(); |
bd3b3bba | 447 | foreach (core_component::get_plugin_list('report') as $report => $plugindir) { |
17da2e6f | 448 | $settings_path = "$plugindir/settings.php"; |
b63a6a63 | 449 | if (file_exists($settings_path)) { |
e30cc24c | 450 | $settings = new admin_settingpage('report' . $report, |
e106013f | 451 | new lang_string('pluginname', 'report_' . $report), 'moodle/site:config'); |
b63a6a63 | 452 | include($settings_path); |
e30cc24c PS |
453 | if ($settings) { |
454 | $pages[] = $settings; | |
455 | } | |
b63a6a63 | 456 | } |
e30cc24c | 457 | } |
e106013f SH |
458 | $ADMIN->add('modules', new admin_category('reportplugins', new lang_string('reports'))); |
459 | $ADMIN->add('reportplugins', new admin_externalpage('managereports', new lang_string('reportsmanage', 'admin'), | |
4f6bba20 PS |
460 | $CFG->wwwroot . '/' . $CFG->admin . '/reports.php')); |
461 | foreach ($pages as $page) { | |
462 | $ADMIN->add('reportplugins', $page); | |
b63a6a63 | 463 | } |
464 | ||
b33e6d8e JG |
465 | /// Add all admin tools |
466 | if ($hassiteconfig) { | |
467 | $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin'))); | |
468 | $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'), | |
469 | $CFG->wwwroot . '/' . $CFG->admin . '/tools.php')); | |
470 | } | |
471 | ||
e87214bd PS |
472 | // Now add various admin tools. |
473 | foreach (core_plugin_manager::instance()->get_plugins_of_type('tool') as $plugin) { | |
474 | /** @var \core\plugininfo\tool $plugin */ | |
475 | $plugin->load_settings($ADMIN, null, $hassiteconfig); | |
11b24ce7 | 476 | } |
17da2e6f | 477 | |
f23fbfd8 SH |
478 | // Now add the Cache plugins |
479 | if ($hassiteconfig) { | |
480 | $ADMIN->add('modules', new admin_category('cache', new lang_string('caching', 'cache'))); | |
481 | $ADMIN->add('cache', new admin_externalpage('cacheconfig', new lang_string('cacheconfig', 'cache'), $CFG->wwwroot .'/cache/admin.php')); | |
482 | $ADMIN->add('cache', new admin_externalpage('cachetestperformance', new lang_string('testperformance', 'cache'), $CFG->wwwroot . '/cache/testperformance.php')); | |
483 | $ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache'))); | |
bd3b3bba | 484 | foreach (core_component::get_plugin_list('cachestore') as $plugin => $path) { |
f23fbfd8 SH |
485 | $settingspath = $path.'/settings.php'; |
486 | if (file_exists($settingspath)) { | |
6fec1820 | 487 | $settings = new admin_settingpage('cachestore_'.$plugin.'_settings', new lang_string('pluginname', 'cachestore_'.$plugin), 'moodle/site:config'); |
f23fbfd8 SH |
488 | include($settingspath); |
489 | $ADMIN->add('cachestores', $settings); | |
490 | } | |
491 | } | |
492 | } | |
493 | ||
b404b1f4 AG |
494 | // Add Calendar type settings. |
495 | if ($hassiteconfig) { | |
496 | $ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar'))); | |
497 | foreach (core_component::get_plugin_list_with_file('calendartype', 'settings.php') as $plugin => $settingspath) { | |
498 | $settings = new admin_settingpage('calendartype_' . $plugin . '_settings', new lang_string('pluginname', 'calendartype_' . $plugin), 'moodle/site:config'); | |
499 | include($settingspath); | |
500 | $ADMIN->add('calendartype', $settings); | |
501 | } | |
502 | } | |
503 | ||
17da2e6f | 504 | /// Add all local plugins - must be always last! |
1ed47309 | 505 | if ($hassiteconfig) { |
e106013f SH |
506 | $ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins'))); |
507 | $ADMIN->add('localplugins', new admin_externalpage('managelocalplugins', new lang_string('localpluginsmanage'), | |
1ed47309 DM |
508 | $CFG->wwwroot . '/' . $CFG->admin . '/localplugins.php')); |
509 | } | |
17da2e6f | 510 | |
e87214bd PS |
511 | // Extend settings for each local plugin. Note that their settings may be in any part of the |
512 | // settings tree and may be visible not only for administrators. | |
513 | foreach (core_plugin_manager::instance()->get_plugins_of_type('local') as $plugin) { | |
514 | /** @var \core\plugininfo\local $plugin */ | |
515 | $plugin->load_settings($ADMIN, null, $hassiteconfig); | |
1bcb7eb5 | 516 | } |