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