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