Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]
1 <?php 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 */ 26 27 if ($hassiteconfig) { 28 /* @var admin_root $ADMIN */ 29 $ADMIN->locate('modules')->set_sorting(true); 30 31 $ADMIN->add('modules', new admin_page_pluginsoverview()); 32 33 // activity modules 34 $ADMIN->add('modules', new admin_category('modsettings', new lang_string('activitymodules'))); 35 36 $ADMIN->add('modsettings', new admin_page_managemods()); 37 38 $temp = new admin_settingpage('managemodulescommon', new lang_string('commonactivitysettings', 'admin')); 39 $temp->add(new admin_setting_configcheckbox('requiremodintro', 40 get_string('requiremodintro', 'admin'), get_string('requiremodintro_desc', 'admin'), 0)); 41 $ADMIN->add('modsettings', $temp); 42 43 $plugins = core_plugin_manager::instance()->get_plugins_of_type('mod'); 44 core_collator::asort_objects_by_property($plugins, 'displayname'); 45 foreach ($plugins as $plugin) { 46 /** @var \core\plugininfo\mod $plugin */ 47 $plugin->load_settings($ADMIN, 'modsettings', $hassiteconfig); 48 } 49 50 // course formats 51 $ADMIN->add('modules', new admin_category('formatsettings', new lang_string('courseformats'))); 52 $temp = new admin_settingpage('manageformats', new lang_string('manageformats', 'core_admin')); 53 $temp->add(new admin_setting_manageformats()); 54 $ADMIN->add('formatsettings', $temp); 55 $plugins = core_plugin_manager::instance()->get_plugins_of_type('format'); 56 core_collator::asort_objects_by_property($plugins, 'displayname'); 57 foreach ($plugins as $plugin) { 58 /** @var \core\plugininfo\format $plugin */ 59 $plugin->load_settings($ADMIN, 'formatsettings', $hassiteconfig); 60 } 61 62 // Custom fields. 63 $ADMIN->add('modules', new admin_category('customfieldsettings', new lang_string('customfields', 'core_customfield'))); 64 $temp = new admin_settingpage('managecustomfields', new lang_string('managecustomfields', 'core_admin')); 65 $temp->add(new admin_setting_managecustomfields()); 66 $ADMIN->add('customfieldsettings', $temp); 67 $plugins = core_plugin_manager::instance()->get_plugins_of_type('customfield'); 68 core_collator::asort_objects_by_property($plugins, 'displayname'); 69 foreach ($plugins as $plugin) { 70 /** @var \core\plugininfo\customfield $plugin */ 71 $plugin->load_settings($ADMIN, 'customfieldsettings', $hassiteconfig); 72 } 73 74 // blocks 75 $ADMIN->add('modules', new admin_category('blocksettings', new lang_string('blocks'))); 76 $ADMIN->add('blocksettings', new admin_page_manageblocks()); 77 $plugins = core_plugin_manager::instance()->get_plugins_of_type('block'); 78 core_collator::asort_objects_by_property($plugins, 'displayname'); 79 foreach ($plugins as $plugin) { 80 /** @var \core\plugininfo\block $plugin */ 81 $plugin->load_settings($ADMIN, 'blocksettings', $hassiteconfig); 82 } 83 84 // authentication plugins 85 $ADMIN->add('modules', new admin_category('authsettings', new lang_string('authentication', 'admin'))); 86 87 $temp = new admin_settingpage('manageauths', new lang_string('authsettings', 'admin')); 88 $temp->add(new admin_setting_manageauths()); 89 $temp->add(new admin_setting_heading('manageauthscommonheading', new lang_string('commonsettings', 'admin'), '')); 90 $temp->add(new admin_setting_special_registerauth()); 91 $temp->add(new admin_setting_configcheckbox('authloginviaemail', new lang_string('authloginviaemail', 'core_auth'), new lang_string('authloginviaemail_desc', 'core_auth'), 0)); 92 $temp->add(new admin_setting_configcheckbox('allowaccountssameemail', 93 new lang_string('allowaccountssameemail', 'core_auth'), 94 new lang_string('allowaccountssameemail_desc', 'core_auth'), 0)); 95 $temp->add(new admin_setting_configcheckbox('authpreventaccountcreation', new lang_string('authpreventaccountcreation', 'admin'), new lang_string('authpreventaccountcreation_help', 'admin'), 0)); 96 $temp->add(new admin_setting_configcheckbox('loginpageautofocus', new lang_string('loginpageautofocus', 'admin'), new lang_string('loginpageautofocus_help', 'admin'), 0)); 97 $temp->add(new admin_setting_configselect('guestloginbutton', new lang_string('guestloginbutton', 'auth'), 98 new lang_string('showguestlogin', 'auth'), '1', array('0'=>new lang_string('hide'), '1'=>new lang_string('show')))); 99 $options = array(0 => get_string('no'), 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10, 20 => 20, 50 => 50); 100 $temp->add(new admin_setting_configselect('limitconcurrentlogins', 101 new lang_string('limitconcurrentlogins', 'core_auth'), 102 new lang_string('limitconcurrentlogins_desc', 'core_auth'), 0, $options)); 103 $temp->add(new admin_setting_configtext('alternateloginurl', new lang_string('alternateloginurl', 'auth'), 104 new lang_string('alternatelogin', 'auth', htmlspecialchars(get_login_url(), ENT_COMPAT)), '')); 105 $temp->add(new admin_setting_configtext('forgottenpasswordurl', new lang_string('forgottenpasswordurl', 'auth'), 106 new lang_string('forgottenpassword', 'auth'), '', PARAM_URL)); 107 $temp->add(new admin_setting_confightmleditor('auth_instructions', new lang_string('instructions', 'auth'), 108 new lang_string('authinstructions', 'auth'), '')); 109 $setting = new admin_setting_configtext('allowemailaddresses', new lang_string('allowemailaddresses', 'admin'), 110 new lang_string('configallowemailaddresses', 'admin'), '', PARAM_NOTAGS); 111 $setting->set_force_ltr(true); 112 $temp->add($setting); 113 $setting = new admin_setting_configtext('denyemailaddresses', new lang_string('denyemailaddresses', 'admin'), 114 new lang_string('configdenyemailaddresses', 'admin'), '', PARAM_NOTAGS); 115 $setting->set_force_ltr(true); 116 $temp->add($setting); 117 $temp->add(new admin_setting_configcheckbox('verifychangedemail', new lang_string('verifychangedemail', 'admin'), new lang_string('configverifychangedemail', 'admin'), 1)); 118 119 // ReCaptcha. 120 $temp->add(new admin_setting_configselect('enableloginrecaptcha', 121 new lang_string('auth_loginrecaptcha', 'auth'), 122 new lang_string('auth_loginrecaptcha_desc', 'auth'), 123 0, 124 [ 125 new lang_string('no'), 126 new lang_string('yes'), 127 ], 128 )); 129 130 $setting = new admin_setting_configtext('recaptchapublickey', new lang_string('recaptchapublickey', 'admin'), new lang_string('configrecaptchapublickey', 'admin'), '', PARAM_NOTAGS); 131 $setting->set_force_ltr(true); 132 $temp->add($setting); 133 $setting = new admin_setting_configtext('recaptchaprivatekey', new lang_string('recaptchaprivatekey', 'admin'), new lang_string('configrecaptchaprivatekey', 'admin'), '', PARAM_NOTAGS); 134 $setting->set_force_ltr(true); 135 $temp->add($setting); 136 $ADMIN->add('authsettings', $temp); 137 138 $temp = new admin_externalpage('authtestsettings', get_string('testsettings', 'core_auth'), new moodle_url("/auth/test_settings.php"), 'moodle/site:config', true); 139 $ADMIN->add('authsettings', $temp); 140 141 $plugins = core_plugin_manager::instance()->get_plugins_of_type('auth'); 142 core_collator::asort_objects_by_property($plugins, 'displayname'); 143 foreach ($plugins as $plugin) { 144 /** @var \core\plugininfo\auth $plugin */ 145 $plugin->load_settings($ADMIN, 'authsettings', $hassiteconfig); 146 } 147 148 // Enrolment plugins 149 $ADMIN->add('modules', new admin_category('enrolments', new lang_string('enrolments', 'enrol'))); 150 $temp = new admin_settingpage('manageenrols', new lang_string('manageenrols', 'enrol')); 151 $temp->add(new admin_setting_manageenrols()); 152 $ADMIN->add('enrolments', $temp); 153 154 $temp = new admin_externalpage('enroltestsettings', get_string('testsettings', 'core_enrol'), new moodle_url("/enrol/test_settings.php"), 'moodle/site:config', true); 155 $ADMIN->add('enrolments', $temp); 156 157 $plugins = core_plugin_manager::instance()->get_plugins_of_type('enrol'); 158 core_collator::asort_objects_by_property($plugins, 'displayname'); 159 foreach ($plugins as $plugin) { 160 /** @var \core\plugininfo\enrol $plugin */ 161 $plugin->load_settings($ADMIN, 'enrolments', $hassiteconfig); 162 } 163 164 165 /// Editor plugins 166 $ADMIN->add('modules', new admin_category('editorsettings', new lang_string('editors', 'editor'))); 167 $temp = new admin_settingpage('manageeditors', new lang_string('editorsettings', 'editor')); 168 $temp->add(new \core_admin\admin\admin_setting_plugin_manager( 169 'editor', 170 \core_admin\table\editor_management_table::class, 171 'editorsui', 172 get_string('editorsettings', 'editor'), 173 )); 174 $ADMIN->add('editorsettings', $temp); 175 $plugins = core_plugin_manager::instance()->get_plugins_of_type('editor'); 176 core_collator::asort_objects_by_property($plugins, 'displayname'); 177 foreach ($plugins as $plugin) { 178 /** @var \core\plugininfo\editor $plugin */ 179 $plugin->load_settings($ADMIN, 'editorsettings', $hassiteconfig); 180 } 181 182 // Antivirus plugins. 183 $ADMIN->add('modules', new admin_category('antivirussettings', new lang_string('antiviruses', 'antivirus'))); 184 $temp = new admin_settingpage('manageantiviruses', new lang_string('antivirussettings', 'antivirus')); 185 $temp->add(new admin_setting_manageantiviruses()); 186 187 // Common settings. 188 $temp->add(new admin_setting_heading('antiviruscommonsettings', new lang_string('antiviruscommonsettings', 'antivirus'), '')); 189 190 // Alert email. 191 $temp->add( 192 new admin_setting_configtext( 193 'antivirus/notifyemail', 194 new lang_string('notifyemail', 'antivirus'), 195 new lang_string('notifyemail_help', 'antivirus'), 196 '', 197 PARAM_EMAIL 198 ) 199 ); 200 201 // Notify level. 202 $temp->add(new admin_setting_configselect('antivirus/notifylevel', 203 get_string('notifylevel', 'antivirus'), '', core\antivirus\scanner::SCAN_RESULT_ERROR, [ 204 core\antivirus\scanner::SCAN_RESULT_ERROR => get_string('notifylevelerror', 'antivirus'), 205 core\antivirus\scanner::SCAN_RESULT_FOUND => get_string('notifylevelfound', 'antivirus') 206 ]), 207 ); 208 209 // Threshold for check displayed on the /report/status/index.php page. 210 $url = new moodle_url('/report/status/index.php'); 211 $link = html_writer::link($url, get_string('pluginname', 'report_status')); 212 $temp->add( 213 new admin_setting_configduration( 214 'antivirus/threshold', 215 new lang_string('threshold', 'antivirus'), 216 get_string('threshold_desc', 'antivirus', $link), 217 20 * MINSECS 218 ) 219 ); 220 221 // Enable quarantine. 222 $temp->add( 223 new admin_setting_configcheckbox( 224 'antivirus/enablequarantine', 225 new lang_string('enablequarantine', 'antivirus'), 226 new lang_string('enablequarantine_help', 'antivirus', 227 \core\antivirus\quarantine::DEFAULT_QUARANTINE_FOLDER), 228 0 229 ) 230 ); 231 232 // Quarantine time. 233 $temp->add( 234 new admin_setting_configduration( 235 'antivirus/quarantinetime', 236 new lang_string('quarantinetime', 'antivirus'), 237 new lang_string('quarantinetime_desc', 'antivirus'), 238 \core\antivirus\quarantine::DEFAULT_QUARANTINE_TIME 239 ) 240 ); 241 242 $ADMIN->add('antivirussettings', $temp); 243 $plugins = core_plugin_manager::instance()->get_plugins_of_type('antivirus'); 244 core_collator::asort_objects_by_property($plugins, 'displayname'); 245 foreach ($plugins as $plugin) { 246 /* @var \core\plugininfo\antivirus $plugin */ 247 $plugin->load_settings($ADMIN, 'antivirussettings', $hassiteconfig); 248 } 249 250 // Machine learning backend plugins. 251 $ADMIN->add('modules', new admin_category('mlbackendsettings', new lang_string('mlbackendsettings', 'admin'))); 252 $plugins = core_plugin_manager::instance()->get_plugins_of_type('mlbackend'); 253 foreach ($plugins as $plugin) { 254 $plugin->load_settings($ADMIN, 'mlbackendsettings', $hassiteconfig); 255 } 256 257 /// Filter plugins 258 $ADMIN->add('modules', new admin_category('filtersettings', new lang_string('managefilters'))); 259 260 $ADMIN->add('filtersettings', new admin_page_managefilters()); 261 262 // "filtersettings" settingpage 263 $temp = new admin_settingpage('commonfiltersettings', new lang_string('commonfiltersettings', 'admin')); 264 if ($ADMIN->fulltree) { 265 $items = array(); 266 $items[] = new admin_setting_configselect('filteruploadedfiles', new lang_string('filteruploadedfiles', 'admin'), new lang_string('configfilteruploadedfiles', 'admin'), 0, 267 array('0' => new lang_string('none'), '1' => new lang_string('allfiles'), '2' => new lang_string('htmlfilesonly'))); 268 $items[] = new admin_setting_configcheckbox('filtermatchoneperpage', new lang_string('filtermatchoneperpage', 'admin'), new lang_string('configfiltermatchoneperpage', 'admin'), 0); 269 $items[] = new admin_setting_configcheckbox('filtermatchonepertext', new lang_string('filtermatchonepertext', 'admin'), new lang_string('configfiltermatchonepertext', 'admin'), 0); 270 $items[] = new admin_setting_configcheckbox('filternavigationwithsystemcontext', 271 new lang_string('filternavigationwithsystemcontext', 'admin'), 272 new lang_string('configfilternavigationwithsystemcontext', 'admin'), 0); 273 foreach ($items as $item) { 274 $item->set_updatedcallback('reset_text_filters_cache'); 275 $temp->add($item); 276 } 277 } 278 $ADMIN->add('filtersettings', $temp); 279 280 $plugins = core_plugin_manager::instance()->get_plugins_of_type('filter'); 281 core_collator::asort_objects_by_property($plugins, 'displayname'); 282 foreach ($plugins as $plugin) { 283 /** @var \core\plugininfo\filter $plugin */ 284 $plugin->load_settings($ADMIN, 'filtersettings', $hassiteconfig); 285 } 286 287 // Media players. 288 $ADMIN->add('modules', new admin_category('mediaplayers', new lang_string('type_media_plural', 'plugin'))); 289 $temp = new admin_settingpage('managemediaplayers', new lang_string('managemediaplayers', 'media')); 290 $temp->add(new admin_setting_heading('mediaformats', get_string('mediaformats', 'core_media'), 291 format_text(get_string('mediaformats_desc', 'core_media'), FORMAT_MARKDOWN))); 292 $temp->add(new \core_admin\admin\admin_setting_plugin_manager( 293 'media', 294 \core_admin\table\media_management_table::class, 295 'managemediaplayers', 296 new lang_string('managemediaplayers', 'core_media'), 297 )); 298 $temp->add(new admin_setting_heading('managemediaplayerscommonheading', new lang_string('commonsettings', 'admin'), '')); 299 $temp->add(new admin_setting_configtext('media_default_width', 300 new lang_string('defaultwidth', 'core_media'), new lang_string('defaultwidthdesc', 'core_media'), 301 640, PARAM_INT, 10)); 302 $temp->add(new admin_setting_configtext('media_default_height', 303 new lang_string('defaultheight', 'core_media'), new lang_string('defaultheightdesc', 'core_media'), 304 360, PARAM_INT, 10)); 305 $ADMIN->add('mediaplayers', $temp); 306 307 // Convert plugins. 308 $ADMIN->add('modules', new admin_category('fileconverterplugins', new lang_string('type_fileconverter_plural', 'plugin'))); 309 $temp = new admin_settingpage('managefileconverterplugins', new lang_string('type_fileconvertermanage', 'plugin')); 310 $temp->add(new admin_setting_manage_fileconverter_plugins()); 311 $ADMIN->add('fileconverterplugins', $temp); 312 313 $plugins = core_plugin_manager::instance()->get_plugins_of_type('fileconverter'); 314 core_collator::asort_objects_by_property($plugins, 'displayname'); 315 foreach ($plugins as $plugin) { 316 /** @var \core\plugininfo\media $plugin */ 317 $plugin->load_settings($ADMIN, 'fileconverterplugins', $hassiteconfig); 318 } 319 320 $plugins = core_plugin_manager::instance()->get_plugins_of_type('media'); 321 core_collator::asort_objects_by_property($plugins, 'displayname'); 322 foreach ($plugins as $plugin) { 323 /** @var \core\plugininfo\media $plugin */ 324 $plugin->load_settings($ADMIN, 'mediaplayers', $hassiteconfig); 325 } 326 327 // Payment gateway plugins. 328 $ADMIN->add('modules', new admin_category('paymentgateways', new lang_string('type_paygw_plural', 'plugin'))); 329 $temp = new admin_settingpage('managepaymentgateways', new lang_string('type_paygwmanage', 'plugin')); 330 $temp->add(new \core_admin\local\settings\manage_payment_gateway_plugins()); 331 $temp->add(new admin_setting_description( 332 'managepaymentgatewayspostfix', 333 '', 334 new lang_string('gotopaymentaccounts', 'payment', 335 html_writer::link(new moodle_url('/payment/accounts.php'), get_string('paymentaccounts', 'payment'))) 336 )); 337 $ADMIN->add('paymentgateways', $temp); 338 339 $plugins = core_plugin_manager::instance()->get_plugins_of_type('paygw'); 340 core_collator::asort_objects_by_property($plugins, 'displayname'); 341 foreach ($plugins as $plugin) { 342 /** @var \core\plugininfo\paygw $plugin */ 343 $plugin->load_settings($ADMIN, 'paymentgateways', $hassiteconfig); 344 } 345 346 // Data format settings. 347 $ADMIN->add('modules', new admin_category('dataformatsettings', new lang_string('dataformats'))); 348 $temp = new admin_settingpage('managedataformats', new lang_string('managedataformats')); 349 $temp->add(new admin_setting_managedataformats()); 350 $ADMIN->add('dataformatsettings', $temp); 351 352 $plugins = core_plugin_manager::instance()->get_plugins_of_type('dataformat'); 353 core_collator::asort_objects_by_property($plugins, 'displayname'); 354 foreach ($plugins as $plugin) { 355 /** @var \core\plugininfo\dataformat $plugin */ 356 $plugin->load_settings($ADMIN, 'dataformatsettings', $hassiteconfig); 357 } 358 359 //== Portfolio settings == 360 require_once($CFG->libdir. '/portfoliolib.php'); 361 $catname = new lang_string('portfolios', 'portfolio'); 362 $manage = new lang_string('manageportfolios', 'portfolio'); 363 $url = "$CFG->wwwroot/$CFG->admin/portfolio.php"; 364 365 $ADMIN->add('modules', new admin_category('portfoliosettings', $catname, empty($CFG->enableportfolios))); 366 367 // Add manage page (with table) 368 $temp = new admin_page_manageportfolios(); 369 $ADMIN->add('portfoliosettings', $temp); 370 371 // Add common settings page 372 $temp = new admin_settingpage('manageportfolioscommon', new lang_string('commonportfoliosettings', 'portfolio')); 373 $temp->add(new admin_setting_heading('manageportfolioscommon', '', new lang_string('commonsettingsdesc', 'portfolio'))); 374 $fileinfo = portfolio_filesize_info(); // make sure this is defined in one place since its used inside portfolio too to detect insane settings 375 $fileoptions = $fileinfo['options']; 376 $temp->add(new admin_setting_configselect( 377 'portfolio_moderate_filesize_threshold', 378 new lang_string('moderatefilesizethreshold', 'portfolio'), 379 new lang_string('moderatefilesizethresholddesc', 'portfolio'), 380 $fileinfo['moderate'], $fileoptions)); 381 $temp->add(new admin_setting_configselect( 382 'portfolio_high_filesize_threshold', 383 new lang_string('highfilesizethreshold', 'portfolio'), 384 new lang_string('highfilesizethresholddesc', 'portfolio'), 385 $fileinfo['high'], $fileoptions)); 386 387 $temp->add(new admin_setting_configtext( 388 'portfolio_moderate_db_threshold', 389 new lang_string('moderatedbsizethreshold', 'portfolio'), 390 new lang_string('moderatedbsizethresholddesc', 'portfolio'), 391 20, PARAM_INT, 3)); 392 393 $temp->add(new admin_setting_configtext( 394 'portfolio_high_db_threshold', 395 new lang_string('highdbsizethreshold', 'portfolio'), 396 new lang_string('highdbsizethresholddesc', 'portfolio'), 397 50, PARAM_INT, 3)); 398 399 $ADMIN->add('portfoliosettings', $temp); 400 $ADMIN->add('portfoliosettings', new admin_externalpage('portfolionew', new lang_string('addnewportfolio', 'portfolio'), $url, 'moodle/site:config', true)); 401 $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliodelete', new lang_string('deleteportfolio', 'portfolio'), $url, 'moodle/site:config', true)); 402 $ADMIN->add('portfoliosettings', new admin_externalpage('portfoliocontroller', new lang_string('manageportfolios', 'portfolio'), $url, 'moodle/site:config', true)); 403 404 foreach (portfolio_instances(false, false) as $portfolio) { 405 require_once($CFG->dirroot . '/portfolio/' . $portfolio->get('plugin') . '/lib.php'); 406 $classname = 'portfolio_plugin_' . $portfolio->get('plugin'); 407 $ADMIN->add( 408 'portfoliosettings', 409 new admin_externalpage( 410 'portfoliosettings' . $portfolio->get('id'), 411 $portfolio->get('name'), 412 $url . '?action=edit&pf=' . $portfolio->get('id'), 413 'moodle/site:config' 414 ) 415 ); 416 } 417 418 // repository setting 419 require_once("$CFG->dirroot/repository/lib.php"); 420 $catname =new lang_string('repositories', 'repository'); 421 $managerepo = new lang_string('manage', 'repository'); 422 $url = $CFG->wwwroot.'/'.$CFG->admin.'/repository.php'; 423 $ADMIN->add('modules', new admin_category('repositorysettings', $catname)); 424 425 // Add main page (with table) 426 $temp = new admin_page_managerepositories(); 427 $ADMIN->add('repositorysettings', $temp); 428 429 // Add common settings page 430 $temp = new admin_settingpage('managerepositoriescommon', new lang_string('commonrepositorysettings', 'repository')); 431 $temp->add(new admin_setting_configtext('repositorycacheexpire', new lang_string('cacheexpire', 'repository'), new lang_string('configcacheexpire', 'repository'), 120, PARAM_INT)); 432 $temp->add(new admin_setting_configtext('repositorygetfiletimeout', new lang_string('getfiletimeout', 'repository'), new lang_string('configgetfiletimeout', 'repository'), 30, PARAM_INT)); 433 $temp->add(new admin_setting_configtext('repositorysyncfiletimeout', new lang_string('syncfiletimeout', 'repository'), new lang_string('configsyncfiletimeout', 'repository'), 1, PARAM_INT)); 434 $temp->add(new admin_setting_configtext('repositorysyncimagetimeout', new lang_string('syncimagetimeout', 'repository'), new lang_string('configsyncimagetimeout', 'repository'), 3, PARAM_INT)); 435 $temp->add(new admin_setting_configcheckbox('repositoryallowexternallinks', new lang_string('allowexternallinks', 'repository'), new lang_string('configallowexternallinks', 'repository'), 1)); 436 $temp->add(new admin_setting_configcheckbox('legacyfilesinnewcourses', new lang_string('legacyfilesinnewcourses', 'admin'), new lang_string('legacyfilesinnewcourses_help', 'admin'), 0)); 437 $temp->add(new admin_setting_configcheckbox('legacyfilesaddallowed', new lang_string('legacyfilesaddallowed', 'admin'), new lang_string('legacyfilesaddallowed_help', 'admin'), 1)); 438 $ADMIN->add('repositorysettings', $temp); 439 $ADMIN->add('repositorysettings', new admin_externalpage('repositorynew', 440 new lang_string('addplugin', 'repository'), $url, 'moodle/site:config', true)); 441 $ADMIN->add('repositorysettings', new admin_externalpage('repositorydelete', 442 new lang_string('deleterepository', 'repository'), $url, 'moodle/site:config', true)); 443 $ADMIN->add('repositorysettings', new admin_externalpage('repositorycontroller', 444 new lang_string('manage', 'repository'), $url, 'moodle/site:config', true)); 445 $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstancenew', 446 new lang_string('createrepository', 'repository'), $url, 'moodle/site:config', true)); 447 $ADMIN->add('repositorysettings', new admin_externalpage('repositoryinstanceedit', 448 new lang_string('editrepositoryinstance', 'repository'), $url, 'moodle/site:config', true)); 449 $plugins = core_plugin_manager::instance()->get_plugins_of_type('repository'); 450 core_collator::asort_objects_by_property($plugins, 'displayname'); 451 foreach ($plugins as $plugin) { 452 /** @var \core\plugininfo\repository $plugin */ 453 $plugin->load_settings($ADMIN, 'repositorysettings', $hassiteconfig); 454 } 455 } 456 457 // Question bank settings. 458 if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { 459 $ADMIN->add('modules', new admin_category('qbanksettings', 460 new lang_string('type_qbank_plural', 'plugin'))); 461 $temp = new admin_settingpage('manageqbanks', new lang_string('manageqbanks', 'admin')); 462 $temp->add(new \core_question\admin\manage_qbank_plugins_page()); 463 $ADMIN->add('qbanksettings', $temp); 464 $plugins = core_plugin_manager::instance()->get_plugins_of_type('qbank'); 465 466 foreach ($plugins as $plugin) { 467 /** @var \core\plugininfo\qbank $plugin */ 468 $plugin->load_settings($ADMIN, 'qbanksettings', $hassiteconfig); 469 } 470 } 471 472 // Question type settings 473 if ($hassiteconfig || has_capability('moodle/question:config', $systemcontext)) { 474 475 // Question behaviour settings. 476 $ADMIN->add('modules', new admin_category('qbehavioursettings', new lang_string('questionbehaviours', 'admin'))); 477 $ADMIN->add('qbehavioursettings', new admin_page_manageqbehaviours()); 478 479 // Question type settings. 480 $ADMIN->add('modules', new admin_category('qtypesettings', new lang_string('questiontypes', 'admin'))); 481 $ADMIN->add('qtypesettings', new admin_page_manageqtypes()); 482 483 // Question preview defaults. 484 $settings = new admin_settingpage('qdefaultsetting', 485 get_string('questionpreviewdefaults', 'question'), 486 'moodle/question:config'); 487 $ADMIN->add('qtypesettings', $settings); 488 489 $settings->add(new admin_setting_heading('qdefaultsetting_preview_options', 490 '', get_string('questionpreviewdefaults_desc', 'question'))); 491 492 // These keys are question_display_options::HIDDEN and VISIBLE. 493 $hiddenofvisible = array( 494 0 => get_string('notshown', 'question'), 495 1 => get_string('shown', 'question'), 496 ); 497 498 $settings->add(new admin_setting_question_behaviour('question_preview/behaviour', 499 get_string('howquestionsbehave', 'question'), '', 500 'deferredfeedback')); 501 502 $settings->add(new admin_setting_configselect('question_preview/correctness', 503 get_string('whethercorrect', 'question'), '', 1, $hiddenofvisible)); 504 505 // These keys are question_display_options::HIDDEN, MARK_ONLY and MARK_AND_MAX. 506 $marksoptions = array( 507 0 => get_string('notshown', 'question'), 508 1 => get_string('showmaxmarkonly', 'question'), 509 2 => get_string('showmarkandmax', 'question'), 510 ); 511 $settings->add(new admin_setting_configselect('question_preview/marks', 512 get_string('marks', 'question'), '', 2, $marksoptions)); 513 514 $settings->add(new admin_setting_configselect('question_preview/markdp', 515 get_string('decimalplacesingrades', 'question'), '', 2, array(0, 1, 2, 3, 4, 5, 6, 7))); 516 517 $settings->add(new admin_setting_configselect('question_preview/feedback', 518 get_string('specificfeedback', 'question'), '', 1, $hiddenofvisible)); 519 520 $settings->add(new admin_setting_configselect('question_preview/generalfeedback', 521 get_string('generalfeedback', 'question'), '', 1, $hiddenofvisible)); 522 523 $settings->add(new admin_setting_configselect('question_preview/rightanswer', 524 get_string('rightanswer', 'question'), '', 1, $hiddenofvisible)); 525 526 $settings->add(new admin_setting_configselect('question_preview/history', 527 get_string('responsehistory', 'question'), '', 0, $hiddenofvisible)); 528 529 // Settings for particular question types. 530 $plugins = core_plugin_manager::instance()->get_plugins_of_type('qtype'); 531 core_collator::asort_objects_by_property($plugins, 'displayname'); 532 foreach ($plugins as $plugin) { 533 /** @var \core\plugininfo\qtype $plugin */ 534 $plugin->load_settings($ADMIN, 'qtypesettings', $hassiteconfig); 535 } 536 } 537 538 // Plagiarism plugin settings 539 if ($hassiteconfig && !empty($CFG->enableplagiarism)) { 540 $ADMIN->add('modules', new admin_category('plagiarism', new lang_string('plagiarism', 'plagiarism'))); 541 $ADMIN->add('plagiarism', new admin_externalpage('manageplagiarismplugins', new lang_string('manageplagiarism', 'plagiarism'), 542 $CFG->wwwroot . '/' . $CFG->admin . '/plagiarism.php')); 543 544 $plugins = core_plugin_manager::instance()->get_plugins_of_type('plagiarism'); 545 core_collator::asort_objects_by_property($plugins, 'displayname'); 546 foreach ($plugins as $plugin) { 547 /** @var \core\plugininfo\plagiarism $plugin */ 548 $plugin->load_settings($ADMIN, 'plagiarism', $hassiteconfig); 549 } 550 } 551 552 // Comments report, note this page is really just a means to delete comments so check that. 553 $ADMIN->add('reports', new admin_externalpage('comments', new lang_string('comments'), $CFG->wwwroot . '/comment/index.php', 554 'moodle/comment:delete')); 555 556 // Course reports settings 557 if ($hassiteconfig) { 558 $pages = array(); 559 foreach (core_component::get_plugin_list('coursereport') as $report => $path) { 560 $file = $CFG->dirroot . '/course/report/' . $report . '/settings.php'; 561 if (file_exists($file)) { 562 $settings = new admin_settingpage('coursereport' . $report, 563 new lang_string('pluginname', 'coursereport_' . $report), 'moodle/site:config'); 564 // settings.php may create a subcategory or unset the settings completely 565 include($file); 566 if ($settings) { 567 $pages[] = $settings; 568 } 569 } 570 } 571 if (!empty($pages)) { 572 $ADMIN->add('modules', new admin_category('coursereports', new lang_string('coursereports'))); 573 core_collator::asort_objects_by_property($pages, 'visiblename'); 574 foreach ($pages as $page) { 575 $ADMIN->add('coursereports', $page); 576 } 577 } 578 unset($pages); 579 } 580 581 // Now add reports 582 $pages = array(); 583 foreach (core_component::get_plugin_list('report') as $report => $plugindir) { 584 $settings_path = "$plugindir/settings.php"; 585 if (file_exists($settings_path)) { 586 $settings = new admin_settingpage('report' . $report, 587 new lang_string('pluginname', 'report_' . $report), 'moodle/site:config'); 588 include($settings_path); 589 if ($settings) { 590 $pages[] = $settings; 591 } 592 } 593 } 594 $ADMIN->add('modules', new admin_category('reportplugins', new lang_string('reports'))); 595 $ADMIN->add('reportplugins', new admin_externalpage('managereports', new lang_string('reportsmanage', 'admin'), 596 $CFG->wwwroot . '/' . $CFG->admin . '/reports.php')); 597 core_collator::asort_objects_by_property($pages, 'visiblename'); 598 foreach ($pages as $page) { 599 $ADMIN->add('reportplugins', $page); 600 } 601 602 if ($hassiteconfig) { 603 // Global Search engine plugins. 604 $ADMIN->add('modules', new admin_category('searchplugins', new lang_string('search', 'admin'))); 605 $temp = new admin_settingpage('manageglobalsearch', new lang_string('globalsearchmanage', 'admin')); 606 607 $pages = array(); 608 $engines = array(); 609 foreach (core_component::get_plugin_list('search') as $engine => $plugindir) { 610 $engines[$engine] = new lang_string('pluginname', 'search_' . $engine); 611 $settingspath = "$plugindir/settings.php"; 612 if (file_exists($settingspath)) { 613 $settings = new admin_settingpage('search' . $engine, 614 new lang_string('pluginname', 'search_' . $engine), 'moodle/site:config'); 615 include($settingspath); 616 if ($settings) { 617 $pages[] = $settings; 618 } 619 } 620 } 621 622 // Setup status. 623 $temp->add(new admin_setting_searchsetupinfo()); 624 625 // Search engine selection. 626 $temp->add(new admin_setting_heading('searchengineheading', new lang_string('searchengine', 'admin'), '')); 627 $searchengineselect = new admin_setting_configselect('searchengine', 628 new lang_string('selectsearchengine', 'admin'), '', 'simpledb', $engines); 629 $searchengineselect->set_validate_function(function(string $value): string { 630 global $CFG; 631 632 // Check nobody's setting the indexing and query-only server to the same one. 633 if (isset($CFG->searchenginequeryonly) && $CFG->searchenginequeryonly === $value) { 634 return get_string('searchenginequeryonlysame', 'admin'); 635 } else { 636 return ''; 637 } 638 }); 639 $temp->add($searchengineselect); 640 $temp->add(new admin_setting_heading('searchoptionsheading', new lang_string('searchoptions', 'admin'), '')); 641 $temp->add(new admin_setting_configcheckbox('searchindexwhendisabled', 642 new lang_string('searchindexwhendisabled', 'admin'), new lang_string('searchindexwhendisabled_desc', 'admin'), 643 0)); 644 $temp->add(new admin_setting_configduration('searchindextime', 645 new lang_string('searchindextime', 'admin'), new lang_string('searchindextime_desc', 'admin'), 646 600)); 647 $temp->add(new admin_setting_heading('searchcoursesheading', new lang_string('searchablecourses', 'admin'), '')); 648 $options = [ 649 0 => new lang_string('searchallavailablecourses_off', 'admin'), 650 1 => new lang_string('searchallavailablecourses_on', 'admin') 651 ]; 652 $temp->add(new admin_setting_configselect('searchallavailablecourses', 653 new lang_string('searchallavailablecourses', 'admin'), 654 new lang_string('searchallavailablecoursesdesc', 'admin'), 655 0, $options)); 656 $temp->add(new admin_setting_configcheckbox('searchincludeallcourses', 657 new lang_string('searchincludeallcourses', 'admin'), new lang_string('searchincludeallcourses_desc', 'admin'), 658 0)); 659 660 // Search display options. 661 $temp->add(new admin_setting_heading('searchdisplay', new lang_string('searchdisplay', 'admin'), '')); 662 $temp->add(new admin_setting_configcheckbox('searchenablecategories', 663 new lang_string('searchenablecategories', 'admin'), 664 new lang_string('searchenablecategories_desc', 'admin'), 665 0)); 666 $options = []; 667 foreach (\core_search\manager::get_search_area_categories() as $category) { 668 $options[$category->get_name()] = $category->get_visiblename(); 669 } 670 $temp->add(new admin_setting_configselect('searchdefaultcategory', 671 new lang_string('searchdefaultcategory', 'admin'), 672 new lang_string('searchdefaultcategory_desc', 'admin'), 673 \core_search\manager::SEARCH_AREA_CATEGORY_ALL, $options)); 674 $temp->add(new admin_setting_configcheckbox('searchhideallcategory', 675 new lang_string('searchhideallcategory', 'admin'), 676 new lang_string('searchhideallcategory_desc', 'admin'), 677 0)); 678 679 // Top result options. 680 $temp->add(new admin_setting_heading('searchtopresults', new lang_string('searchtopresults', 'admin'), '')); 681 // Max Top results. 682 $options = range(0, 10); 683 $temp->add(new admin_setting_configselect('searchmaxtopresults', 684 new lang_string('searchmaxtopresults', 'admin'), 685 new lang_string('searchmaxtopresults_desc', 'admin'), 686 3, $options)); 687 // Teacher roles. 688 $options = []; 689 foreach (role_get_names() as $role) { 690 $options[$role->id] = $role->localname; 691 } 692 $temp->add(new admin_setting_configmultiselect('searchteacherroles', 693 new lang_string('searchteacherroles', 'admin'), 694 new lang_string('searchteacherroles_desc', 'admin'), 695 [], $options)); 696 697 $temp->add(new admin_setting_heading('searchmanagement', new lang_string('searchmanagement', 'admin'), 698 new lang_string('searchmanagement_desc', 'admin'))); 699 700 // Get list of search engines including those with alternate settings. 701 $searchenginequeryonlyselect = new admin_setting_configselect('searchenginequeryonly', 702 new lang_string('searchenginequeryonly', 'admin'), 703 new lang_string('searchenginequeryonly_desc', 'admin'), '', function() use($engines) { 704 $options = ['' => new lang_string('searchenginequeryonly_none', 'admin')]; 705 foreach ($engines as $name => $display) { 706 $options[$name] = $display; 707 708 $classname = '\search_' . $name . '\engine'; 709 $engine = new $classname; 710 if ($engine->has_alternate_configuration()) { 711 $options[$name . '-alternate'] = 712 new lang_string('searchenginealternatesettings', 'admin', $display); 713 } 714 } 715 return $options; 716 }); 717 $searchenginequeryonlyselect->set_validate_function(function(string $value): string { 718 global $CFG; 719 720 // Check nobody's setting the indexing and query-only server to the same one. 721 if (isset($CFG->searchengine) && $CFG->searchengine === $value) { 722 return get_string('searchenginequeryonlysame', 'admin'); 723 } else { 724 return ''; 725 } 726 }); 727 $temp->add($searchenginequeryonlyselect); 728 $temp->add(new admin_setting_configcheckbox('searchbannerenable', 729 new lang_string('searchbannerenable', 'admin'), new lang_string('searchbannerenable_desc', 'admin'), 730 0)); 731 $temp->add(new admin_setting_confightmleditor('searchbanner', 732 new lang_string('searchbanner', 'admin'), '', '')); 733 734 $ADMIN->add('searchplugins', $temp); 735 $ADMIN->add('searchplugins', new admin_externalpage('searchareas', new lang_string('searchareas', 'admin'), 736 new moodle_url('/admin/searchareas.php'))); 737 738 core_collator::asort_objects_by_property($pages, 'visiblename'); 739 foreach ($pages as $page) { 740 $ADMIN->add('searchplugins', $page); 741 } 742 } 743 744 /// Add all admin tools 745 if ($hassiteconfig) { 746 $ADMIN->add('modules', new admin_category('tools', new lang_string('tools', 'admin'))); 747 $settingspage = new admin_settingpage('toolsmanagement', new lang_string('toolsmanage', 'admin')); 748 $ADMIN->add('tools', $settingspage); 749 $settingspage->add(new \core_admin\admin\admin_setting_plugin_manager( 750 'tool', 751 \core_admin\table\tool_plugin_management_table::class, 752 'managetools', 753 new lang_string('toolsmanage', 'admin') 754 )); 755 } 756 757 // Now add various admin tools. 758 $plugins = core_plugin_manager::instance()->get_plugins_of_type('tool'); 759 core_collator::asort_objects_by_property($plugins, 'displayname'); 760 foreach ($plugins as $plugin) { 761 /** @var \core\plugininfo\tool $plugin */ 762 $plugin->load_settings($ADMIN, null, $hassiteconfig); 763 } 764 765 // Now add the Cache plugins 766 if ($hassiteconfig) { 767 $ADMIN->add('modules', new admin_category('cache', new lang_string('caching', 'cache'))); 768 $ADMIN->add('cache', new admin_externalpage('cacheconfig', new lang_string('cacheconfig', 'cache'), $CFG->wwwroot .'/cache/admin.php')); 769 $ADMIN->add('cache', new admin_externalpage('cachetestperformance', new lang_string('testperformance', 'cache'), $CFG->wwwroot . '/cache/testperformance.php')); 770 $ADMIN->add('cache', new admin_externalpage('cacheusage', 771 new lang_string('cacheusage', 'cache'), $CFG->wwwroot . '/cache/usage.php')); 772 $ADMIN->add('cache', new admin_category('cachestores', new lang_string('cachestores', 'cache'))); 773 $ADMIN->locate('cachestores')->set_sorting(true); 774 foreach (core_component::get_plugin_list('cachestore') as $plugin => $path) { 775 $settingspath = $path.'/settings.php'; 776 if (file_exists($settingspath)) { 777 $settings = new admin_settingpage('cachestore_'.$plugin.'_settings', new lang_string('pluginname', 'cachestore_'.$plugin), 'moodle/site:config'); 778 include($settingspath); 779 $ADMIN->add('cachestores', $settings); 780 } 781 } 782 } 783 784 // Add Calendar type settings. 785 if ($hassiteconfig) { 786 $ADMIN->add('modules', new admin_category('calendartype', new lang_string('calendartypes', 'calendar'))); 787 $plugins = core_plugin_manager::instance()->get_plugins_of_type('calendartype'); 788 core_collator::asort_objects_by_property($plugins, 'displayname'); 789 foreach ($plugins as $plugin) { 790 /** @var \core\plugininfo\calendartype $plugin */ 791 $plugin->load_settings($ADMIN, 'calendartype', $hassiteconfig); 792 } 793 } 794 795 // Communication plugins. 796 if ($hassiteconfig && core_communication\api::is_available()) { 797 $ADMIN->add('modules', new admin_category('communicationsettings', new lang_string('communication', 'core_communication'))); 798 $temp = new admin_settingpage('managecommunicationproviders', 799 new lang_string('managecommunicationproviders', 'core_communication')); 800 $temp->add(new \core_communication\admin\manage_communication_providers_page()); 801 $ADMIN->add('communicationsettings', $temp); 802 $plugins = core_plugin_manager::instance()->get_plugins_of_type('communication'); 803 foreach ($plugins as $plugin) { 804 /** @var \core\plugininfo\communication $plugin */ 805 $plugin->load_settings($ADMIN, 'communicationsettings', $hassiteconfig); 806 } 807 } 808 809 // Content bank content types. 810 if ($hassiteconfig) { 811 $ADMIN->add('modules', new admin_category('contentbanksettings', new lang_string('contentbank'))); 812 $temp = new admin_settingpage('managecontentbanktypes', new lang_string('managecontentbanktypes')); 813 $temp->add(new admin_setting_managecontentbankcontenttypes()); 814 $ADMIN->add('contentbanksettings', $temp); 815 $plugins = core_plugin_manager::instance()->get_plugins_of_type('contenttype'); 816 foreach ($plugins as $plugin) { 817 /** @var \core\plugininfo\contentbank $plugin */ 818 $plugin->load_settings($ADMIN, 'contentbanksettings', $hassiteconfig); 819 } 820 } 821 822 /// Add all local plugins - must be always last! 823 if ($hassiteconfig) { 824 $ADMIN->add('modules', new admin_category('localplugins', new lang_string('localplugins'))); 825 $ADMIN->add('localplugins', new admin_externalpage('managelocalplugins', new lang_string('localpluginsmanage'), 826 $CFG->wwwroot . '/' . $CFG->admin . '/localplugins.php')); 827 } 828 829 // Extend settings for each local plugin. Note that their settings may be in any part of the 830 // settings tree and may be visible not only for administrators. 831 $plugins = core_plugin_manager::instance()->get_plugins_of_type('local'); 832 core_collator::asort_objects_by_property($plugins, 'displayname'); 833 foreach ($plugins as $plugin) { 834 /** @var \core\plugininfo\local $plugin */ 835 $plugin->load_settings($ADMIN, null, $hassiteconfig); 836 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body