Commit | Line | Data |
---|---|---|
11b749ca | 1 | <?php |
220a90c5 | 2 | |
b63a6a63 | 3 | /* |
4 | * Please note that is file is always loaded last - it means that you can inject entries into other categories too. | |
5 | */ | |
6 | ||
78946b9b | 7 | if ($hassiteconfig) { |
ff4b9fcb | 8 | $ADMIN->add('modules', new admin_category('modsettings', get_string('activitymodules'))); |
220a90c5 | 9 | $ADMIN->add('modsettings', new admin_page_managemods()); |
73d0160f PS |
10 | $modules = $DB->get_records('modules', array(), "name ASC"); |
11 | foreach ($modules as $module) { | |
12 | $modulename = $module->name; | |
13 | if (!file_exists("$CFG->dirroot/mod/$modulename/lib.php")) { | |
14 | continue; | |
220a90c5 | 15 | } |
73d0160f | 16 | $strmodulename = get_string('modulename', 'mod_'.$modulename); |
dbf9e4ba | 17 | if (file_exists($CFG->dirroot.'/mod/'.$modulename.'/settings.php')) { |
73d0160f PS |
18 | // do not show disabled modules in tree, keep only settings link on manage page |
19 | $settings = new admin_settingpage('modsetting'.$modulename, $strmodulename, 'moodle/site:config', !$module->visible); | |
dbf9e4ba PS |
20 | include($CFG->dirroot.'/mod/'.$modulename.'/settings.php'); |
21 | if ($settings) { | |
22 | $ADMIN->add('modsettings', $settings); | |
220a90c5 | 23 | } |
24 | } | |
25 | } | |
26 | ||
b032b490 | 27 | // hidden script for converting journals to online assignments (or something like that) linked from elsewhere |
28 | $ADMIN->add('modsettings', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot.'/'.$CFG->admin.'/oacleanup.php', 'moodle/site:config', true)); | |
220a90c5 | 29 | |
30 | $ADMIN->add('modules', new admin_category('blocksettings', get_string('blocks'))); | |
31 | $ADMIN->add('blocksettings', new admin_page_manageblocks()); | |
73d0160f PS |
32 | $blocks = $DB->get_records('block', array(), "name ASC"); |
33 | foreach ($blocks as $block) { | |
34 | $blockname = $block->name; | |
35 | if (!file_exists("$CFG->dirroot/blocks/$blockname/block_$blockname.php")) { | |
36 | continue; | |
220a90c5 | 37 | } |
73d0160f PS |
38 | $strblockname = get_string('pluginname', 'block_'.$blockname); |
39 | if (file_exists($CFG->dirroot.'/blocks/'.$blockname.'/settings.php')) { | |
40 | $settings = new admin_settingpage('blocksetting'.$blockname, $strblockname, 'moodle/site:config', !$block->visible); | |
dbf9e4ba PS |
41 | include($CFG->dirroot.'/blocks/'.$blockname.'/settings.php'); |
42 | if ($settings) { | |
43 | $ADMIN->add('blocksettings', $settings); | |
220a90c5 | 44 | } |
45 | } | |
46 | } | |
47 | ||
df997f84 PS |
48 | // authentication plugins |
49 | $ADMIN->add('modules', new admin_category('authsettings', get_string('authentication', 'admin'))); | |
50 | ||
51 | $temp = new admin_settingpage('manageauths', get_string('authsettings', 'admin')); | |
52 | $temp->add(new admin_setting_manageauths()); | |
53 | $temp->add(new admin_setting_heading('manageauthscommonheading', get_string('commonsettings', 'admin'), '')); | |
54 | $temp->add(new admin_setting_special_registerauth()); | |
55 | $temp->add(new admin_setting_configselect('guestloginbutton', get_string('guestloginbutton', 'auth'), | |
56 | get_string('showguestlogin', 'auth'), '1', array('0'=>get_string('hide'), '1'=>get_string('show')))); | |
57 | $temp->add(new admin_setting_configtext('alternateloginurl', get_string('alternateloginurl', 'auth'), | |
58 | get_string('alternatelogin', 'auth', htmlspecialchars(get_login_url())), '')); | |
59 | $temp->add(new admin_setting_configtext('forgottenpasswordurl', get_string('forgottenpasswordurl', 'auth'), | |
60 | get_string('forgottenpassword', 'auth'), '')); | |
61 | $temp->add(new admin_setting_confightmleditor('auth_instructions', get_string('instructions', 'auth'), | |
62 | get_string('authinstructions', 'auth'), '')); | |
63 | $temp->add(new admin_setting_configtext('allowemailaddresses', get_string('allowemailaddresses', 'admin'), get_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS)); | |
64 | $temp->add(new admin_setting_configtext('denyemailaddresses', get_string('denyemailaddresses', 'admin'), get_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS)); | |
65 | $temp->add(new admin_setting_configcheckbox('verifychangedemail', get_string('verifychangedemail', 'admin'), get_string('configverifychangedemail', 'admin'), 1)); | |
66 | ||
67 | $temp->add(new admin_setting_configtext('recaptchapublickey', get_string('recaptchapublickey', 'admin'), get_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS)); | |
68 | $temp->add(new admin_setting_configtext('recaptchaprivatekey', get_string('recaptchaprivatekey', 'admin'), get_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS)); | |
69 | $ADMIN->add('authsettings', $temp); | |
70 | ||
71 | ||
dbf9e4ba PS |
72 | $auths = get_plugin_list('auth'); |
73 | $authsenabled = get_enabled_auth_plugins(); | |
74 | foreach ($auths as $authname => $authdir) { | |
75 | $strauthname = get_string('pluginname', "auth_{$authname}"); | |
76 | // do not show disabled auths in tree, keep only settings link on manage page | |
77 | $enabled = in_array($authname, $authsenabled); | |
78 | if (file_exists($authdir.'/settings.php')) { | |
79 | // TODO: finish implementation of common settings - locking, etc. | |
80 | $settings = new admin_settingpage('authsetting'.$authname, $strauthname, 'moodle/site:config', !$enabled); | |
81 | include($authdir.'/settings.php'); | |
82 | if ($settings) { | |
df997f84 | 83 | $ADMIN->add('authsettings', $settings); |
df997f84 | 84 | } |
dbf9e4ba PS |
85 | |
86 | } else { | |
87 | $ADMIN->add('authsettings', new admin_externalpage('authsetting'.$authname, $strauthname, "$CFG->wwwroot/$CFG->admin/auth_config.php?auth=$authname", 'moodle/site:config', !$enabled)); | |
df997f84 PS |
88 | } |
89 | } | |
90 | ||
91 | ||
92 | // Enrolment plugins | |
93 | $ADMIN->add('modules', new admin_category('enrolments', get_string('enrolments', 'enrol'))); | |
94 | $temp = new admin_settingpage('manageenrols', get_string('manageenrols', 'enrol')); | |
95 | $temp->add(new admin_setting_manageenrols()); | |
96 | if (empty($CFG->enrol_plugins_enabled)) { | |
97 | $enabled = array(); | |
98 | } else { | |
99 | $enabled = explode(',', $CFG->enrol_plugins_enabled); | |
100 | } | |
101 | $enrols = get_plugin_list('enrol'); | |
102 | $ADMIN->add('enrolments', $temp); | |
103 | foreach($enrols as $enrol=>$enrolpath) { | |
104 | if (!file_exists("$enrolpath/settings.php")) { | |
105 | continue; | |
106 | } | |
107 | ||
108 | $settings = new admin_settingpage('enrolsettings'.$enrol, get_string('pluginname', 'enrol_'.$enrol), 'moodle/site:config', !in_array($enrol, $enabled)); | |
109 | // settings.php may create a subcategory or unset the settings completely | |
110 | include("$enrolpath/settings.php"); | |
111 | if ($settings) { | |
112 | $ADMIN->add('enrolments', $settings); | |
113 | } | |
114 | ||
115 | } | |
116 | unset($enabled); | |
117 | unset($enrols); | |
118 | ||
c5d2d0dd | 119 | |
a5747cf8 | 120 | /// Editor plugins |
121 | $ADMIN->add('modules', new admin_category('editorsettings', get_string('editors', 'editor'))); | |
122 | $temp = new admin_settingpage('manageeditors', get_string('editorsettings', 'editor')); | |
123 | $temp->add(new admin_setting_manageeditors()); | |
20e5da7d | 124 | $htmleditors = editors_get_available(); |
a5747cf8 | 125 | $ADMIN->add('editorsettings', $temp); |
126 | ||
20e5da7d | 127 | $editors_available = editors_get_available(); |
7a856a93 DC |
128 | foreach ($editors_available as $editor=>$editorstr) { |
129 | if (file_exists($CFG->dirroot . '/lib/editor/'.$editor.'/settings.php')) { | |
6fc67fce PS |
130 | $settings = new admin_settingpage('editorsettings'.$editor, get_string('pluginname', 'editor_'.$editor), 'moodle/site:config'); |
131 | // settings.php may create a subcategory or unset the settings completely | |
132 | include($CFG->dirroot . '/lib/editor/'.$editor.'/settings.php'); | |
133 | if ($settings) { | |
134 | $ADMIN->add('editorsettings', $settings); | |
135 | } | |
df997f84 | 136 | } |
7a856a93 | 137 | } |
6fc67fce | 138 | |
1dce6261 | 139 | /// License types |
7936470a | 140 | $ADMIN->add('modules', new admin_category('licensesettings', get_string('licenses'))); |
47576a5e | 141 | $temp = new admin_settingpage('managelicenses', get_string('managelicenses', 'admin')); |
ba74f517 DC |
142 | |
143 | require_once($CFG->libdir . '/licenselib.php'); | |
144 | $licenses = array(); | |
145 | $array = explode(',', $CFG->licenses); | |
146 | foreach ($array as $value) { | |
147 | $licenses[$value] = get_string($value, 'license'); | |
148 | } | |
149 | $temp->add(new admin_setting_configselect('sitedefaultlicense', get_string('configsitedefaultlicense','admin'), get_string('configsitedefaultlicensehelp','admin'), 'allrightsreserved', $licenses)); | |
1dce6261 DC |
150 | $temp->add(new admin_setting_managelicenses()); |
151 | $ADMIN->add('licensesettings', $temp); | |
a5747cf8 | 152 | |
153 | /// Filter plugins | |
220a90c5 | 154 | $ADMIN->add('modules', new admin_category('filtersettings', get_string('managefilters'))); |
dcdf3b29 | 155 | |
156 | $ADMIN->add('filtersettings', new admin_page_managefilters()); | |
157 | ||
220a90c5 | 158 | // "filtersettings" settingpage |
dcdf3b29 | 159 | $temp = new admin_settingpage('commonfiltersettings', get_string('commonfiltersettings', 'admin')); |
220a90c5 | 160 | if ($ADMIN->fulltree) { |
5b8fa09b | 161 | $cachetimes = array( |
162 | 604800 => get_string('numdays','',7), | |
163 | 86400 => get_string('numdays','',1), | |
164 | 43200 => get_string('numhours','',12), | |
165 | 10800 => get_string('numhours','',3), | |
166 | 7200 => get_string('numhours','',2), | |
167 | 3600 => get_string('numhours','',1), | |
168 | 2700 => get_string('numminutes','',45), | |
169 | 1800 => get_string('numminutes','',30), | |
170 | 900 => get_string('numminutes','',15), | |
171 | 600 => get_string('numminutes','',10), | |
172 | 540 => get_string('numminutes','',9), | |
173 | 480 => get_string('numminutes','',8), | |
174 | 420 => get_string('numminutes','',7), | |
175 | 360 => get_string('numminutes','',6), | |
176 | 300 => get_string('numminutes','',5), | |
177 | 240 => get_string('numminutes','',4), | |
178 | 180 => get_string('numminutes','',3), | |
179 | 120 => get_string('numminutes','',2), | |
180 | 60 => get_string('numminutes','',1), | |
181 | 30 => get_string('numseconds','',30), | |
182 | 0 => get_string('no') | |
183 | ); | |
109e3cb2 | 184 | $items = array(); |
5b8fa09b | 185 | $items[] = new admin_setting_configselect('cachetext', get_string('cachetext', 'admin'), get_string('configcachetext', 'admin'), 60, $cachetimes); |
186 | $items[] = new admin_setting_configselect('filteruploadedfiles', get_string('filteruploadedfiles', 'admin'), get_string('configfilteruploadedfiles', 'admin'), 0, | |
187 | array('0' => get_string('none'), '1' => get_string('allfiles'), '2' => get_string('htmlfilesonly'))); | |
109e3cb2 | 188 | $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', get_string('filtermatchoneperpage', 'admin'), get_string('configfiltermatchoneperpage', 'admin'), 0); |
189 | $items[] = new admin_setting_configcheckbox('filtermatchonepertext', get_string('filtermatchonepertext', 'admin'), get_string('configfiltermatchonepertext', 'admin'), 0); | |
109e3cb2 | 190 | foreach ($items as $item) { |
191 | $item->set_updatedcallback('reset_text_filters_cache'); | |
192 | $temp->add($item); | |
193 | } | |
220a90c5 | 194 | } |
195 | $ADMIN->add('filtersettings', $temp); | |
196 | ||
5b8fa09b | 197 | $activefilters = filter_get_globally_enabled(); |
b810a4d3 | 198 | $filternames = filter_get_all_installed(); |
199 | foreach ($filternames as $filterpath => $strfiltername) { | |
200 | if (file_exists("$CFG->dirroot/$filterpath/filtersettings.php")) { | |
201 | $settings = new admin_settingpage('filtersetting'.str_replace('/', '', $filterpath), | |
5b8fa09b | 202 | $strfiltername, 'moodle/site:config', !isset($activefilters[$filterpath])); |
dbf9e4ba PS |
203 | include("$CFG->dirroot/$filterpath/filtersettings.php"); |
204 | if ($settings) { | |
205 | $ADMIN->add('filtersettings', $settings); | |
220a90c5 | 206 | } |
207 | } | |
208 | } | |
67a87e7d | 209 | |
78946b9b PS |
210 | |
211 | //== Portfolio settings == | |
212 | require_once($CFG->libdir. '/portfoliolib.php'); | |
b810a4d3 | 213 | $catname = get_string('portfolios', 'portfolio'); |
67a87e7d | 214 | $manage = get_string('manageportfolios', 'portfolio'); |
215 | $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; | |
216 | ||
90658eef | 217 | $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios))); |
67a87e7d | 218 | |
9d81733d SM |
219 | // Add manage page (with table) |
220 | $temp = new admin_page_manageportfolios(); | |
221 | $ADMIN->add('portfoliosettings', $temp); | |
222 | ||
223 | // Add common settings page | |
224 | $temp = new admin_settingpage('manageportfolioscommon', get_string('commonportfoliosettings', 'portfolio')); | |
225 | $temp->add(new admin_setting_heading('manageportfolioscommon', '', get_string('commonsettingsdesc', 'portfolio'))); | |
bee4bce2 | 226 | $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings |
227 | $fileoptions = $fileinfo['options']; | |
228 | $temp->add(new admin_setting_configselect( | |
229 | 'portfolio_moderate_filesize_threshold', | |
230 | get_string('moderatefilesizethreshold', 'portfolio'), | |
231 | get_string('moderatefilesizethresholddesc', 'portfolio'), | |
232 | $fileinfo['moderate'], $fileoptions)); | |
233 | $temp->add(new admin_setting_configselect( | |
234 | 'portfolio_high_filesize_threshold', | |
235 | get_string('highfilesizethreshold', 'portfolio'), | |
236 | get_string('highfilesizethresholddesc', 'portfolio'), | |
237 | $fileinfo['high'], $fileoptions)); | |
238 | ||
239 | $temp->add(new admin_setting_configtext( | |
240 | 'portfolio_moderate_db_threshold', | |
241 | get_string('moderatedbsizethreshold', 'portfolio'), | |
242 | get_string('moderatedbsizethresholddesc', 'portfolio'), | |
243 | 20, PARAM_INTEGER, 3)); | |
244 | ||
245 | $temp->add(new admin_setting_configtext( | |
246 | 'portfolio_high_db_threshold', | |
247 | get_string('highdbsizethreshold', 'portfolio'), | |
248 | get_string('highdbsizethresholddesc', 'portfolio'), | |
249 | 50, PARAM_INTEGER, 3)); | |
a50ef3d3 | 250 | |
251 | $ADMIN->add('portfoliosettings', $temp); | |
252 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', get_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); | |
253 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', get_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url); | |
254 | $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', get_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url); | |
255 | ||
08d5e18b | 256 | foreach (portfolio_instances(false, false) as $portfolio) { |
edf1fc35 | 257 | require_once($CFG->dirroot . '/portfolio/' . $portfolio->get('plugin') . '/lib.php'); |
67a87e7d | 258 | $classname = 'portfolio_plugin_' . $portfolio->get('plugin'); |
a50ef3d3 | 259 | $ADMIN->add( |
260 | 'portfoliosettings', | |
08d5e18b | 261 | new admin_externalpage( |
262 | 'portfoliosettings' . $portfolio->get('id'), | |
658837bb | 263 | $portfolio->get('name'), |
6010eda2 MD |
264 | $url . '?action=edit&pf=' . $portfolio->get('id'), |
265 | 'moodle/site:config' | |
08d5e18b | 266 | ), |
a50ef3d3 | 267 | $portfolio->get('name'), |
6010eda2 | 268 | $url . '?action=edit&pf=' . $portfolio->get('id') |
a50ef3d3 | 269 | ); |
67a87e7d | 270 | } |
4a65c39a | 271 | |
272 | // repository setting | |
273 | require_once("$CFG->dirroot/repository/lib.php"); | |
274 | $catname =get_string('repositories', 'repository'); | |
04bd6d2d | 275 | $managerepo = get_string('manage', 'repository'); |
276 | $url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php'; | |
4a65c39a | 277 | $ADMIN->add('modules', new admin_category('repositorysettings', $catname)); |
9d81733d SM |
278 | |
279 | // Add main page (with table) | |
280 | $temp = new admin_page_managerepositories(); | |
281 | $ADMIN->add('repositorysettings', $temp); | |
282 | ||
283 | // Add common settings page | |
284 | $temp = new admin_settingpage('managerepositoriescommon', get_string('commonrepositorysettings', 'repository')); | |
5430f05b | 285 | $temp->add(new admin_setting_configtext('repositorycacheexpire', get_string('cacheexpire', 'repository'), get_string('configcacheexpire', 'repository'), 120)); |
99d52655 | 286 | $temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', get_string('allowexternallinks', 'repository'), get_string('configallowexternallinks', 'repository'), 1)); |
95dbbf3a | 287 | $temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', get_string('legacyfilesinnewcourses', 'admin'), get_string('legacyfilesinnewcourses_help', 'admin'), 0)); |
4a65c39a | 288 | $ADMIN->add('repositorysettings', $temp); |
4f2b9a4f | 289 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', |
0d099914 | 290 | get_string('addplugin', 'repository'), $url, 'moodle/site:config', true), |
4a65c39a | 291 | '', $url); |
292 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', | |
293 | get_string('deleterepository', 'repository'), $url, 'moodle/site:config', true), | |
294 | '', $url); | |
295 | $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', | |
fe9d7318 | 296 | get_string('manage', 'repository'), $url, 'moodle/site:config', true), |
4a65c39a | 297 | '', $url); |
0d099914 | 298 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', |
299 | get_string('createrepository', 'repository'), $url, 'moodle/site:config', true), | |
300 | '', $url); | |
301 | $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', | |
302 | get_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true), | |
303 | '', $url); | |
78946b9b | 304 | foreach (repository::get_types() as $repositorytype) { |
edb50637 | 305 | //display setup page for plugins with: general options or multiple instances (e.g. has instance config) |
dbc01944 | 306 | $typeoptionnames = repository::static_function($repositorytype->get_typename(), 'get_type_option_names'); |
307 | $instanceoptionnames = repository::static_function($repositorytype->get_typename(), 'get_instance_option_names'); | |
edb50637 | 308 | if (!empty($typeoptionnames) || !empty($instanceoptionnames)) { |
4a65c39a | 309 | $ADMIN->add('repositorysettings', |
a6600395 | 310 | new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), |
311 | $repositorytype->get_readablename(), | |
79698344 | 312 | $url . '?action=edit&repos=' . $repositorytype->get_typename()), |
4a65c39a | 313 | 'moodle/site:config'); |
314 | } | |
315 | } | |
78946b9b | 316 | } |
bee4bce2 | 317 | |
5ae9f539 | 318 | /// Web services |
cc93c7da | 319 | $ADMIN->add('modules', new admin_category('webservicesettings', get_string('webservices', 'webservice'))); |
3e6161fb | 320 | /// overview page |
321 | $temp = new admin_settingpage('webservicesoverview', get_string('webservicesoverview', 'webservice')); | |
322 | $temp->add(new admin_setting_webservicesoverview()); | |
323 | $ADMIN->add('webservicesettings', $temp); | |
324 | /// manage service | |
cc93c7da | 325 | $temp = new admin_settingpage('externalservices', get_string('externalservices', 'webservice')); |
8399c714 | 326 | $temp->add(new admin_setting_heading('manageserviceshelpexplaination', get_string('information', 'webservice'), get_string('servicehelpexplanation', 'webservice'))); |
cc93c7da | 327 | $temp->add(new admin_setting_manageexternalservices()); |
328 | $ADMIN->add('webservicesettings', $temp); | |
c25662b0 | 329 | $ADMIN->add('webservicesettings', new admin_externalpage('externalservice', get_string('editaservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service.php", 'moodle/site:config', true)); |
72977b37 | 330 | $ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', get_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_functions.php", 'moodle/site:config', true)); |
331 | $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', get_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_users.php", 'moodle/site:config', true)); | |
86dcc6f0 | 332 | $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusersettings', get_string('serviceusersettings', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_user_settings.php", 'moodle/site:config', true)); |
5ae9f539 | 333 | /// manage protocol page link |
cc93c7da | 334 | $temp = new admin_settingpage('webserviceprotocols', get_string('manageprotocols', 'webservice')); |
da124b5e | 335 | $temp->add(new admin_setting_managewebserviceprotocols()); |
cc93c7da | 336 | if (empty($CFG->enablewebservices)) { |
337 | $temp->add(new admin_setting_heading('webservicesaredisabled', '', get_string('disabledwarning', 'webservice'))); | |
338 | } | |
b4c91012 SH |
339 | |
340 | // We cannot use $OUTPUT this early, doing so means that we lose the ability | |
341 | // to set the page layout on all admin pages. | |
342 | // $wsdoclink = $OUTPUT->doc_link('How_to_get_a_security_key'); | |
343 | $url = new moodle_url(get_docs_url('How_to_get_a_security_key')); | |
344 | $wsdoclink = html_writer::tag('a', get_string('supplyinfo'),array('href'=>$url)); | |
9ef728d6 | 345 | $temp->add(new admin_setting_configcheckbox('enablewsdocumentation', get_string('enablewsdocumentation', |
346 | 'admin'), get_string('configenablewsdocumentation', 'admin', $wsdoclink), false)); | |
cc93c7da | 347 | $ADMIN->add('webservicesettings', $temp); |
5ae9f539 | 348 | /// links to protocol pages |
cc93c7da | 349 | $webservices_available = get_plugin_list('webservice'); |
350 | $active_webservices = empty($CFG->webserviceprotocols) ? array() : explode(',', $CFG->webserviceprotocols); | |
351 | foreach ($webservices_available as $webservice => $location) { | |
352 | if (file_exists("$location/settings.php")) { | |
353 | $name = get_string('pluginname', 'webservice_'.$webservice); | |
354 | $settings = new admin_settingpage('webservicesetting'.$webservice, $name, 'moodle/site:config', !in_array($webservice, $active_webservices) or empty($CFG->enablewebservices)); | |
dbf9e4ba PS |
355 | include("$location/settings.php"); |
356 | if ($settings) { | |
357 | $ADMIN->add('webservicesettings', $settings); | |
cc93c7da | 358 | } |
cc93c7da | 359 | } |
360 | } | |
5ae9f539 | 361 | /// manage token page link |
15e417fe | 362 | $ADMIN->add('webservicesettings', new admin_externalpage('addwebservicetoken', get_string('managetokens', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/tokens.php", 'moodle/site:config', true)); |
5ae9f539 | 363 | $temp = new admin_settingpage('webservicetokens', get_string('managetokens', 'webservice')); |
364 | $temp->add(new admin_setting_managewebservicetokens()); | |
365 | if (empty($CFG->enablewebservices)) { | |
366 | $temp->add(new admin_setting_heading('webservicesaredisabled', '', get_string('disabledwarning', 'webservice'))); | |
367 | } | |
368 | $ADMIN->add('webservicesettings', $temp); | |
df997f84 | 369 | |
cc93c7da | 370 | |
78946b9b | 371 | if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { |
bee4bce2 | 372 | // Question type settings. |
373 | $ADMIN->add('modules', new admin_category('qtypesettings', get_string('questiontypes', 'admin'))); | |
374 | $ADMIN->add('qtypesettings', new admin_page_manageqtypes()); | |
63b5318e TH |
375 | $qtypes = get_plugin_list('qtype'); |
376 | foreach ($qtypes as $qtype => $path) { | |
377 | $settingsfile = $path . '/settings.php'; | |
bee4bce2 | 378 | if (file_exists($settingsfile)) { |
63b5318e TH |
379 | $settings = new admin_settingpage('qtypesetting' . $qtype, |
380 | get_string('pluginname', 'qtype_' . $qtype), 'moodle/question:config'); | |
dbf9e4ba PS |
381 | include($settingsfile); |
382 | if ($settings) { | |
383 | $ADMIN->add('qtypesettings', $settings); | |
bee4bce2 | 384 | } |
bee4bce2 | 385 | } |
386 | } | |
220a90c5 | 387 | } |
bce59524 DM |
388 | if ($hassiteconfig && !empty($CFG->enableplagiarism)) { |
389 | $ADMIN->add('modules', new admin_category('plagiarism', get_string('plagiarism', 'plagiarism'))); | |
390 | $temp = new admin_settingpage('plagiarismsettings', get_string('plagiarismsettings', 'plagiarism')); | |
391 | $temp->add(new admin_setting_manageplagiarism()); | |
392 | $ADMIN->add('plagiarism', $temp); | |
393 | foreach (get_plugin_list('plagiarism') as $plugin => $plugindir) { | |
394 | if (file_exists($plugindir.'/settings.php')) { | |
395 | $ADMIN->add('plagiarism', new admin_externalpage('plagiarism'.$plugin, get_string($plugin, 'plagiarism_'.$plugin), "$CFG->wwwroot/plagiarism/$plugin/settings.php", 'moodle/site:config')); | |
396 | } | |
397 | } | |
398 | } | |
1bcb7eb5 | 399 | $ADMIN->add('reports', new admin_externalpage('comments', get_string('comments'), $CFG->wwwroot.'/comment/', 'moodle/site:viewreports')); |
b63a6a63 | 400 | /// Now add reports |
401 | ||
17da2e6f | 402 | foreach (get_plugin_list('report') as $plugin => $plugindir) { |
403 | $settings_path = "$plugindir/settings.php"; | |
b63a6a63 | 404 | if (file_exists($settings_path)) { |
405 | include($settings_path); | |
406 | continue; | |
407 | } | |
408 | ||
17da2e6f | 409 | $index_path = "$plugindir/index.php"; |
b63a6a63 | 410 | if (!file_exists($index_path)) { |
411 | continue; | |
412 | } | |
413 | // old style 3rd party plugin without settings.php | |
17da2e6f | 414 | $www_path = "$CFG->wwwroot/$CFG->admin/report/$plugin/index.php"; |
c5fce2fa | 415 | $reportname = get_string($plugin, 'report_' . $plugin); |
416 | $ADMIN->add('reports', new admin_externalpage('report'.$plugin, $reportname, $www_path, 'moodle/site:viewreports')); | |
b63a6a63 | 417 | } |
418 | ||
17da2e6f | 419 | |
420 | /// Add all local plugins - must be always last! | |
1ed47309 DM |
421 | if ($hassiteconfig) { |
422 | $ADMIN->add('modules', new admin_category('localplugins', get_string('localplugins'))); | |
423 | $ADMIN->add('localplugins', new admin_externalpage('managelocalplugins', get_string('localpluginsmanage'), | |
424 | $CFG->wwwroot . '/' . $CFG->admin . '/localplugins.php')); | |
425 | } | |
17da2e6f | 426 | |
427 | foreach (get_plugin_list('local') as $plugin => $plugindir) { | |
428 | $settings_path = "$plugindir/settings.php"; | |
429 | if (file_exists($settings_path)) { | |
430 | include($settings_path); | |
431 | continue; | |
432 | } | |
1bcb7eb5 | 433 | } |