4 * Please note that is file is always loaded last - it means that you can inject entries into other categories too.
8 require_once("$CFG->libdir/pluginlib.php");
9 $allplugins = plugin_manager
::instance()->get_plugins();
11 $ADMIN->add('modules', new admin_page_pluginsoverview());
14 $ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules')));
15 $ADMIN->add('modsettings', new admin_page_managemods());
16 foreach ($allplugins['mod'] as $module) {
17 $module->load_settings($ADMIN, 'modsettings', $hassiteconfig);
20 // hidden script for converting journals to online assignments (or something like that) linked from elsewhere
21 $ADMIN->add('modsettings', new admin_externalpage('oacleanup', 'Online Assignment Cleanup', $CFG->wwwroot
.'/'.$CFG->admin
.'/oacleanup.php', 'moodle/site:config', true));
24 $ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks')));
25 $ADMIN->add('blocksettings', new admin_page_manageblocks());
26 foreach ($allplugins['block'] as $block) {
27 $block->load_settings($ADMIN, 'blocksettings', $hassiteconfig);
31 $ADMIN->add('modules', new admin_category('messageoutputs', new lang_string('messageoutputs', 'message')));
32 $ADMIN->add('messageoutputs', new admin_page_managemessageoutputs());
33 $ADMIN->add('messageoutputs', new admin_page_defaultmessageoutputs());
34 foreach ($allplugins['message'] as $processor) {
35 $processor->load_settings($ADMIN, 'messageoutputs', $hassiteconfig);
38 // authentication plugins
39 $ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin')));
41 $temp = new admin_settingpage('manageauths', new lang_string('authsettings', 'admin'));
42 $temp->add(new admin_setting_manageauths());
43 $temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), ''));
44 $temp->add(new admin_setting_special_registerauth());
45 $temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', new lang_string('authpreventaccountcreation', 'admin'), new lang_string('authpreventaccountcreation_help', 'admin'), 0));
46 $temp->add(new admin_setting_configcheckbox('loginpageautofocus', new lang_string('loginpageautofocus', 'admin'), new lang_string('loginpageautofocus_help', 'admin'), 0));
47 $temp->add(new admin_setting_configselect('guestloginbutton', new lang_string('guestloginbutton', 'auth'),
48 new lang_string('showguestlogin', 'auth'), '1', array('0'=>new lang_string('hide'), '1'=>new lang_string('show'))));
49 $temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'),
50 new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url())), ''));
51 $temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'),
52 new lang_string('forgottenpassword', 'auth'), ''));
53 $temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'),
54 new lang_string('authinstructions', 'auth'), ''));
55 $temp->add(new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'), new lang_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS
));
56 $temp->add(new admin_setting_configtext('denyemailaddresses', new lang_string('denyemailaddresses', 'admin'), new lang_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS
));
57 $temp->add(new admin_setting_configcheckbox('verifychangedemail', new lang_string('verifychangedemail', 'admin'), new lang_string('configverifychangedemail', 'admin'), 1));
59 $temp->add(new admin_setting_configtext('recaptchapublickey', new lang_string('recaptchapublickey', 'admin'), new lang_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS
));
60 $temp->add(new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS
));
61 $ADMIN->add('authsettings', $temp);
63 foreach ($allplugins['auth'] as $auth) {
64 $auth->load_settings($ADMIN, 'authsettings', $hassiteconfig);
68 $ADMIN->add('modules', new admin_category('enrolments', new lang_string('enrolments', 'enrol')));
69 $temp = new admin_settingpage('manageenrols', new lang_string('manageenrols', 'enrol'));
70 $temp->add(new admin_setting_manageenrols());
71 $ADMIN->add('enrolments', $temp);
72 foreach($allplugins['enrol'] as $enrol) {
73 $enrol->load_settings($ADMIN, 'enrolments', $hassiteconfig);
78 $ADMIN->add('modules', new admin_category('editorsettings', new lang_string('editors', 'editor')));
79 $temp = new admin_settingpage('manageeditors', new lang_string('editorsettings', 'editor'));
80 $temp->add(new admin_setting_manageeditors());
81 $ADMIN->add('editorsettings', $temp);
82 foreach ($allplugins['editor'] as $editor) {
83 $editor->load_settings($ADMIN, 'editorsettings', $hassiteconfig);
87 $ADMIN->add('modules', new admin_category('licensesettings', new lang_string('licenses')));
88 $temp = new admin_settingpage('managelicenses', new lang_string('managelicenses', 'admin'));
90 require_once($CFG->libdir
. '/licenselib.php');
92 $array = explode(',', $CFG->licenses
);
93 foreach ($array as $value) {
94 $licenses[$value] = new lang_string($value, 'license');
96 $temp->add(new admin_setting_configselect('sitedefaultlicense', new lang_string('configsitedefaultlicense','admin'), new lang_string('configsitedefaultlicensehelp','admin'), 'allrightsreserved', $licenses));
97 $temp->add(new admin_setting_managelicenses());
98 $ADMIN->add('licensesettings', $temp);
101 $ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters')));
103 $ADMIN->add('filtersettings', new admin_page_managefilters());
105 // "filtersettings" settingpage
106 $temp = new admin_settingpage('commonfiltersettings', new lang_string('commonfiltersettings', 'admin'));
107 if ($ADMIN->fulltree
) {
109 604800 => new lang_string('numdays','',7),
110 86400 => new lang_string('numdays','',1),
111 43200 => new lang_string('numhours','',12),
112 10800 => new lang_string('numhours','',3),
113 7200 => new lang_string('numhours','',2),
114 3600 => new lang_string('numhours','',1),
115 2700 => new lang_string('numminutes','',45),
116 1800 => new lang_string('numminutes','',30),
117 900 => new lang_string('numminutes','',15),
118 600 => new lang_string('numminutes','',10),
119 540 => new lang_string('numminutes','',9),
120 480 => new lang_string('numminutes','',8),
121 420 => new lang_string('numminutes','',7),
122 360 => new lang_string('numminutes','',6),
123 300 => new lang_string('numminutes','',5),
124 240 => new lang_string('numminutes','',4),
125 180 => new lang_string('numminutes','',3),
126 120 => new lang_string('numminutes','',2),
127 60 => new lang_string('numminutes','',1),
128 30 => new lang_string('numseconds','',30),
129 0 => new lang_string('no')
132 $items[] = new admin_setting_configselect('cachetext', new lang_string('cachetext', 'admin'), new lang_string('configcachetext', 'admin'), 60, $cachetimes);
133 $items[] = new admin_setting_configselect('filteruploadedfiles', new lang_string('filteruploadedfiles', 'admin'), new lang_string('configfilteruploadedfiles', 'admin'), 0,
134 array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly')));
135 $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0);
136 $items[] = new admin_setting_configcheckbox('filtermatchonepertext', new lang_string('filtermatchonepertext', 'admin'), new lang_string('configfiltermatchonepertext', 'admin'), 0);
137 foreach ($items as $item) {
138 $item->set_updatedcallback('reset_text_filters_cache');
142 $ADMIN->add('filtersettings', $temp);
144 foreach ($allplugins['filter'] as $filter) {
145 $filter->load_settings($ADMIN, 'filtersettings', $hassiteconfig);
149 //== Portfolio settings ==
150 require_once($CFG->libdir
. '/portfoliolib.php');
151 $catname = new lang_string('portfolios', 'portfolio');
152 $manage = new lang_string('manageportfolios', 'portfolio');
153 $url = "$CFG->wwwroot/$CFG->admin/portfolio.php";
155 $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios
)));
157 // Add manage page (with table)
158 $temp = new admin_page_manageportfolios();
159 $ADMIN->add('portfoliosettings', $temp);
161 // Add common settings page
162 $temp = new admin_settingpage('manageportfolioscommon', new lang_string('commonportfoliosettings', 'portfolio'));
163 $temp->add(new admin_setting_heading('manageportfolioscommon', '', new lang_string('commonsettingsdesc', 'portfolio')));
164 $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings
165 $fileoptions = $fileinfo['options'];
166 $temp->add(new admin_setting_configselect(
167 'portfolio_moderate_filesize_threshold',
168 new lang_string('moderatefilesizethreshold', 'portfolio'),
169 new lang_string('moderatefilesizethresholddesc', 'portfolio'),
170 $fileinfo['moderate'], $fileoptions));
171 $temp->add(new admin_setting_configselect(
172 'portfolio_high_filesize_threshold',
173 new lang_string('highfilesizethreshold', 'portfolio'),
174 new lang_string('highfilesizethresholddesc', 'portfolio'),
175 $fileinfo['high'], $fileoptions));
177 $temp->add(new admin_setting_configtext(
178 'portfolio_moderate_db_threshold',
179 new lang_string('moderatedbsizethreshold', 'portfolio'),
180 new lang_string('moderatedbsizethresholddesc', 'portfolio'),
183 $temp->add(new admin_setting_configtext(
184 'portfolio_high_db_threshold',
185 new lang_string('highdbsizethreshold', 'portfolio'),
186 new lang_string('highdbsizethresholddesc', 'portfolio'),
189 $ADMIN->add('portfoliosettings', $temp);
190 $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', new lang_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
191 $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', new lang_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
192 $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', new lang_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true), '', $url);
194 foreach (portfolio_instances(false, false) as $portfolio) {
195 require_once($CFG->dirroot
. '/portfolio/' . $portfolio->get('plugin') . '/lib.php');
196 $classname = 'portfolio_plugin_' . $portfolio->get('plugin');
199 new admin_externalpage(
200 'portfoliosettings' . $portfolio->get('id'),
201 $portfolio->get('name'),
202 $url . '?action=edit&pf=' . $portfolio->get('id'),
205 $portfolio->get('name'),
206 $url . '?action=edit&pf=' . $portfolio->get('id')
210 // repository setting
211 require_once("$CFG->dirroot/repository/lib.php");
212 $catname =new lang_string('repositories', 'repository');
213 $managerepo = new lang_string('manage', 'repository');
214 $url = $CFG->wwwroot
.'/'.$CFG->admin
.'/repository.php';
215 $ADMIN->add('modules', new admin_category('repositorysettings', $catname));
217 // Add main page (with table)
218 $temp = new admin_page_managerepositories();
219 $ADMIN->add('repositorysettings', $temp);
221 // Add common settings page
222 $temp = new admin_settingpage('managerepositoriescommon', new lang_string('commonrepositorysettings', 'repository'));
223 $temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120));
224 $temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', new lang_string('allowexternallinks', 'repository'), new lang_string('configallowexternallinks', 'repository'), 1));
225 $temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', new lang_string('legacyfilesinnewcourses', 'admin'), new lang_string('legacyfilesinnewcourses_help', 'admin'), 0));
226 $ADMIN->add('repositorysettings', $temp);
227 $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew',
228 new lang_string('addplugin', 'repository'), $url, 'moodle/site:config', true),
230 $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete',
231 new lang_string('deleterepository', 'repository'), $url, 'moodle/site:config', true),
233 $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller',
234 new lang_string('manage', 'repository'), $url, 'moodle/site:config', true),
236 $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew',
237 new lang_string('createrepository', 'repository'), $url, 'moodle/site:config', true),
239 $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit',
240 new lang_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true),
242 foreach (repository
::get_types() as $repositorytype) {
243 //display setup page for plugins with: general options or multiple instances (e.g. has instance config)
244 $typeoptionnames = repository
::static_function($repositorytype->get_typename(), 'get_type_option_names');
245 $instanceoptionnames = repository
::static_function($repositorytype->get_typename(), 'get_instance_option_names');
246 if (!empty($typeoptionnames) ||
!empty($instanceoptionnames)) {
248 $params = array('action'=>'edit', 'sesskey'=>sesskey(), 'repos'=>$repositorytype->get_typename());
249 $settingsurl = new moodle_url("/$CFG->admin/repository.php", $params);
250 $repositoryexternalpage = new admin_externalpage('repositorysettings'.$repositorytype->get_typename(), $repositorytype->get_readablename(), $settingsurl);
251 $ADMIN->add('repositorysettings', $repositoryexternalpage);
257 $ADMIN->add('modules', new admin_category('webservicesettings', new lang_string('webservices', 'webservice')));
259 $temp = new admin_settingpage('webservicesoverview', new lang_string('webservicesoverview', 'webservice'));
260 $temp->add(new admin_setting_webservicesoverview());
261 $ADMIN->add('webservicesettings', $temp);
263 $ADMIN->add('webservicesettings', new admin_externalpage('webservicedocumentation', new lang_string('wsdocapi', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/documentation.php", 'moodle/site:config', false));
265 $temp = new admin_settingpage('externalservices', new lang_string('externalservices', 'webservice'));
266 $enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services'));
267 $enablemobiledoclink = html_writer
::link($enablemobiledocurl, new lang_string('documentation'));
268 $temp->add(new admin_setting_enablemobileservice('enablemobilewebservice', new lang_string('enablemobilewebservice', 'admin'), new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), 0));
269 $temp->add(new admin_setting_heading('manageserviceshelpexplaination', new lang_string('information', 'webservice'), new lang_string('servicehelpexplanation', 'webservice')));
270 $temp->add(new admin_setting_manageexternalservices());
271 $ADMIN->add('webservicesettings', $temp);
272 $ADMIN->add('webservicesettings', new admin_externalpage('externalservice', new lang_string('editaservice', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service.php", 'moodle/site:config', true));
273 $ADMIN->add('webservicesettings', new admin_externalpage('externalservicefunctions', new lang_string('externalservicefunctions', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_functions.php", 'moodle/site:config', true));
274 $ADMIN->add('webservicesettings', new admin_externalpage('externalserviceusers', new lang_string('externalserviceusers', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/service_users.php", 'moodle/site:config', true));
275 $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));
276 /// manage protocol page link
277 $temp = new admin_settingpage('webserviceprotocols', new lang_string('manageprotocols', 'webservice'));
278 $temp->add(new admin_setting_managewebserviceprotocols());
279 if (empty($CFG->enablewebservices
)) {
280 $temp->add(new admin_setting_heading('webservicesaredisabled', '', new lang_string('disabledwarning', 'webservice')));
283 // We cannot use $OUTPUT this early, doing so means that we lose the ability
284 // to set the page layout on all admin pages.
285 // $wsdoclink = $OUTPUT->doc_link('How_to_get_a_security_key');
286 $url = new moodle_url(get_docs_url('How_to_get_a_security_key'));
287 $wsdoclink = html_writer
::tag('a', new lang_string('supplyinfo', 'webservice'), array('href'=>$url));
288 $temp->add(new admin_setting_configcheckbox('enablewsdocumentation', new lang_string('enablewsdocumentation',
289 'admin'), new lang_string('configenablewsdocumentation', 'admin', $wsdoclink), false));
290 $ADMIN->add('webservicesettings', $temp);
291 /// links to protocol pages
292 $webservices_available = get_plugin_list('webservice');
293 $active_webservices = empty($CFG->webserviceprotocols
) ?
array() : explode(',', $CFG->webserviceprotocols
);
294 foreach ($webservices_available as $webservice => $location) {
295 if (file_exists("$location/settings.php")) {
296 $name = new lang_string('pluginname', 'webservice_'.$webservice);
297 $settings = new admin_settingpage('webservicesetting'.$webservice, $name, 'moodle/site:config', !in_array($webservice, $active_webservices) or empty($CFG->enablewebservices
));
298 include("$location/settings.php");
300 $ADMIN->add('webservicesettings', $settings);
304 /// manage token page link
305 $ADMIN->add('webservicesettings', new admin_externalpage('addwebservicetoken', new lang_string('managetokens', 'webservice'), "$CFG->wwwroot/$CFG->admin/webservice/tokens.php", 'moodle/site:config', true));
306 $temp = new admin_settingpage('webservicetokens', new lang_string('managetokens', 'webservice'));
307 $temp->add(new admin_setting_managewebservicetokens());
308 if (empty($CFG->enablewebservices
)) {
309 $temp->add(new admin_setting_heading('webservicesaredisabled', '', new lang_string('disabledwarning', 'webservice')));
311 $ADMIN->add('webservicesettings', $temp);
313 // Question type settings
314 if ($hassiteconfig ||
has_capability('moodle/question:config', $systemcontext)) {
315 // Question behaviour settings.
316 $ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin')));
317 $ADMIN->add('qbehavioursettings', new admin_page_manageqbehaviours());
319 // Question type settings.
320 $ADMIN->add('modules', new admin_category('qtypesettings', new lang_string('questiontypes', 'admin')));
321 $ADMIN->add('qtypesettings', new admin_page_manageqtypes());
322 foreach ($allplugins['qtype'] as $qtype) {
323 $qtype->load_settings($ADMIN, 'qtypesettings', $hassiteconfig);
327 // Plagiarism plugin settings
328 if ($hassiteconfig && !empty($CFG->enableplagiarism
)) {
329 $ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism')));
330 $ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'),
331 $CFG->wwwroot
. '/' . $CFG->admin
. '/plagiarism.php'));
333 foreach ($allplugins['plagiarism'] as $plugin) {
334 $plugin->load_settings($ADMIN, 'plagiarism', $hassiteconfig);
337 $ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comments'), $CFG->wwwroot
.'/comment/', 'moodle/site:viewreports'));
339 // Course reports settings
340 if ($hassiteconfig) {
342 foreach (get_plugin_list('coursereport') as $report => $path) {
343 $file = $CFG->dirroot
. '/course/report/' . $report . '/settings.php';
344 if (file_exists($file)) {
345 $settings = new admin_settingpage('coursereport' . $report,
346 new lang_string('pluginname', 'coursereport_' . $report), 'moodle/site:config');
347 // settings.php may create a subcategory or unset the settings completely
350 $pages[] = $settings;
354 if (!empty($pages)) {
355 $ADMIN->add('modules', new admin_category('coursereports', new lang_string('coursereports')));
356 foreach ($pages as $page) {
357 $ADMIN->add('coursereports', $page);
365 foreach (get_plugin_list('report') as $report => $plugindir) {
366 $settings_path = "$plugindir/settings.php";
367 if (file_exists($settings_path)) {
368 $settings = new admin_settingpage('report' . $report,
369 new lang_string('pluginname', 'report_' . $report), 'moodle/site:config');
370 include($settings_path);
372 $pages[] = $settings;
376 $ADMIN->add('modules', new admin_category('reportplugins', new lang_string('reports')));
377 $ADMIN->add('reportplugins', new admin_externalpage('managereports', new lang_string('reportsmanage', 'admin'),
378 $CFG->wwwroot
. '/' . $CFG->admin
. '/reports.php'));
379 foreach ($pages as $page) {
380 $ADMIN->add('reportplugins', $page);
383 /// Add all admin tools
384 if ($hassiteconfig) {
385 $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin')));
386 $ADMIN->add('tools', new admin_externalpage('managetools', new lang_string('toolsmanage', 'admin'),
387 $CFG->wwwroot
. '/' . $CFG->admin
. '/tools.php'));
390 // Now add various admin tools
391 foreach (get_plugin_list('tool') as $plugin => $plugindir) {
392 $settings_path = "$plugindir/settings.php";
393 if (file_exists($settings_path)) {
394 include($settings_path);
398 /// Add all local plugins - must be always last!
399 if ($hassiteconfig) {
400 $ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins')));
401 $ADMIN->add('localplugins', new admin_externalpage('managelocalplugins', new lang_string('localpluginsmanage'),
402 $CFG->wwwroot
. '/' . $CFG->admin
. '/localplugins.php'));
405 foreach (get_plugin_list('local') as $plugin => $plugindir) {
406 $settings_path = "$plugindir/settings.php";
407 if (file_exists($settings_path)) {
408 include($settings_path);