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