diff --git a/admin/settings/competency.php b/admin/settings/competency.php index 1fffa73271e..379895355c7 100644 --- a/admin/settings/competency.php +++ b/admin/settings/competency.php @@ -30,17 +30,15 @@ if (has_capability('moodle/site:config', $systemcontext)) { $parentname = 'competencies'; // Settings page. + $iscompetencyenabled = get_config('core_competency', 'enabled'); $settings = new admin_settingpage('competencysettings', new lang_string('competenciessettings', 'core_competency'), - 'moodle/site:config', false); - $ADMIN->add($parentname, $settings); + 'moodle/site:config', !$iscompetencyenabled); + if ($iscompetencyenabled) { + $ADMIN->add($parentname, $settings); + } // Load the full tree of settings. if ($ADMIN->fulltree) { - $setting = new admin_setting_configcheckbox('core_competency/enabled', - new lang_string('enablecompetencies', 'core_competency'), - new lang_string('enablecompetencies_desc', 'core_competency'), 1); - $settings->add($setting); - $setting = new admin_setting_configcheckbox('core_competency/pushcourseratingstouserplans', new lang_string('pushcourseratingstouserplans', 'core_competency'), new lang_string('pushcourseratingstouserplans_desc', 'core_competency'), 1); diff --git a/admin/settings/messaging.php b/admin/settings/messaging.php index 2221e72a5ae..9248a26f7fd 100644 --- a/admin/settings/messaging.php +++ b/admin/settings/messaging.php @@ -24,11 +24,12 @@ defined('MOODLE_INTERNAL') || die(); if ($hassiteconfig) { - $temp = new admin_settingpage('messages', new lang_string('messagingssettings', 'admin')); - $temp->add(new admin_setting_configcheckbox('messaging', - new lang_string('messaging', 'admin'), - new lang_string('configmessaging', 'admin'), - 1)); + $temp = new admin_settingpage('messages', + new lang_string('messagingssettings', 'admin'), + 'moodle/site:config', + !$CFG->messaging + ); + $temp->add(new admin_setting_configcheckbox('messagingallusers', new lang_string('messagingallusers', 'admin'), new lang_string('configmessagingallusers', 'admin'), diff --git a/admin/settings/subsystems.php b/admin/settings/subsystems.php index 01de61c3e36..10e06c639e9 100644 --- a/admin/settings/subsystems.php +++ b/admin/settings/subsystems.php @@ -52,6 +52,18 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page $optionalsubsystems->add(new admin_setting_configcheckbox('enableanalytics', new lang_string('enableanalytics', 'admin'), new lang_string('configenableanalytics', 'admin'), 1, 1, 0)); + $optionalsubsystems->add(new admin_setting_configcheckbox('core_competency/enabled', + new lang_string('enablecompetencies', 'core_competency'), + new lang_string('enablecompetencies_desc', 'core_competency'), + 1) + ); + + $optionalsubsystems->add(new admin_setting_configcheckbox('messaging', + new lang_string('messaging', 'admin'), + new lang_string('configmessaging', 'admin'), + 1) + ); + $fullunicodesupport = true; if ($DB->get_dbfamily() == 'mysql') { $collation = $DB->get_dbcollation(); diff --git a/admin/tool/lpimportcsv/settings.php b/admin/tool/lpimportcsv/settings.php index 8cc12da850d..c9c32c8360a 100644 --- a/admin/tool/lpimportcsv/settings.php +++ b/admin/tool/lpimportcsv/settings.php @@ -25,22 +25,24 @@ */ defined('MOODLE_INTERNAL') || die; -// Manage competency frameworks page. -$temp = new admin_externalpage( - 'toollpimportcsv', - get_string('pluginname', 'tool_lpimportcsv'), - new moodle_url('/admin/tool/lpimportcsv/index.php'), - 'moodle/competency:competencymanage' -); -$ADMIN->add('competencies', $temp); -// Export competency framework page. -$temp = new admin_externalpage( - 'toollpexportcsv', - get_string('exportnavlink', 'tool_lpimportcsv'), - new moodle_url('/admin/tool/lpimportcsv/export.php'), - 'moodle/competency:competencymanage' -); -$ADMIN->add('competencies', $temp); +if (get_config('core_competency', 'enabled')) { + // Manage competency frameworks page. + $temp = new admin_externalpage( + 'toollpimportcsv', + get_string('pluginname', 'tool_lpimportcsv'), + new moodle_url('/admin/tool/lpimportcsv/index.php'), + 'moodle/competency:competencymanage' + ); + $ADMIN->add('competencies', $temp); + // Export competency framework page. + $temp = new admin_externalpage( + 'toollpexportcsv', + get_string('exportnavlink', 'tool_lpimportcsv'), + new moodle_url('/admin/tool/lpimportcsv/export.php'), + 'moodle/competency:competencymanage' + ); + $ADMIN->add('competencies', $temp); +} // No report settings. $settings = null; diff --git a/admin/tool/mobile/settings.php b/admin/tool/mobile/settings.php index 029390cec65..4f0f17a5f95 100644 --- a/admin/tool/mobile/settings.php +++ b/admin/tool/mobile/settings.php @@ -30,21 +30,30 @@ use core_admin\local\settings\autocomplete; if ($hassiteconfig) { - $ADMIN->add('root', new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile')), 'development'); - - $temp = new admin_settingpage('mobilesettings', new lang_string('mobilesettings', 'tool_mobile'), 'moodle/site:config', false); - // We should wait to the installation to finish since we depend on some configuration values that are set once // the admin user profile is configured. if (!during_initial_install()) { $enablemobiledocurl = new moodle_url(get_docs_url('Enable_mobile_web_services')); $enablemobiledoclink = html_writer::link($enablemobiledocurl, new lang_string('documentation')); $default = is_https() ? 1 : 0; - $temp->add(new admin_setting_enablemobileservice('enablemobilewebservice', + $optionalsubsystems = $ADMIN->locate('optionalsubsystems'); + $optionalsubsystems->add(new admin_setting_enablemobileservice('enablemobilewebservice', new lang_string('enablemobilewebservice', 'admin'), new lang_string('configenablemobilewebservice', 'admin', $enablemobiledoclink), $default)); } + $ismobilewsdisabled = empty($CFG->enablemobilewebservice); + $ADMIN->add('root', + new admin_category('mobileapp', new lang_string('mobileapp', 'tool_mobile'), $ismobilewsdisabled), + 'development' + ); + + $temp = new admin_settingpage('mobilesettings', + new lang_string('mobilesettings', 'tool_mobile'), + 'moodle/site:config', + $ismobilewsdisabled + ); + $temp->add(new admin_setting_configtext('tool_mobile/apppolicy', new lang_string('apppolicy', 'tool_mobile'), new lang_string('apppolicy_help', 'tool_mobile'), '', PARAM_URL)); @@ -60,8 +69,8 @@ if ($hassiteconfig) { $featuresnotice = $OUTPUT->render($notify); } - $hideappsubscription = empty($CFG->enablemobilewebservice); - $hideappsubscription = $hideappsubscription || (isset($CFG->disablemobileappsubscription) && !empty($CFG->disablemobileappsubscription)); + $hideappsubscription = (isset($CFG->disablemobileappsubscription) && !empty($CFG->disablemobileappsubscription)); + $hideappsubscription = $ismobilewsdisabled || $hideappsubscription; $ADMIN->add( 'mobileapp', @@ -79,7 +88,7 @@ if ($hassiteconfig) { 'mobileauthentication', new lang_string('mobileauthentication', 'tool_mobile'), 'moodle/site:config', - empty($CFG->enablemobilewebservice) + $ismobilewsdisabled ); $temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeaturesauth', '', $featuresnotice)); @@ -123,7 +132,7 @@ if ($hassiteconfig) { 'mobileappearance', new lang_string('mobileappearance', 'tool_mobile'), 'moodle/site:config', - empty($CFG->enablemobilewebservice) + $ismobilewsdisabled ); if (!empty($featuresnotice)) { @@ -164,7 +173,7 @@ if ($hassiteconfig) { 'mobilefeatures', new lang_string('mobilefeatures', 'tool_mobile'), 'moodle/site:config', - empty($CFG->enablemobilewebservice) + $ismobilewsdisabled ); if (!empty($featuresnotice)) { diff --git a/admin/tool/moodlenet/settings.php b/admin/tool/moodlenet/settings.php index 1767b241bcf..1eaad7869da 100644 --- a/admin/tool/moodlenet/settings.php +++ b/admin/tool/moodlenet/settings.php @@ -25,22 +25,29 @@ defined('MOODLE_INTERNAL') || die(); if ($hassiteconfig) { + // Add an enable subsystem setting to the "Advanced features" settings page. + $optionalsubsystems = $ADMIN->locate('optionalsubsystems'); + $optionalsubsystems->add(new admin_setting_configcheckbox('tool_moodlenet/enablemoodlenet', + new lang_string('enablemoodlenet', 'tool_moodlenet'), + new lang_string('enablemoodlenet_desc', 'tool_moodlenet'), + 0, 1, 0) + ); + // Create a MoodleNet category. - $ADMIN->add('root', new admin_category('moodlenet', get_string('pluginname', 'tool_moodlenet'))); - // Our settings page. - $settings = new admin_settingpage('tool_moodlenet', get_string('moodlenetsettings', 'tool_moodlenet')); - $ADMIN->add('moodlenet', $settings); + if (get_config('tool_moodlenet', 'enablemoodlenet')) { + $ADMIN->add('root', new admin_category('moodlenet', get_string('pluginname', 'tool_moodlenet'))); + // Our settings page. + $settings = new admin_settingpage('tool_moodlenet', get_string('moodlenetsettings', 'tool_moodlenet')); + $ADMIN->add('moodlenet', $settings); - $temp = new admin_setting_configcheckbox('tool_moodlenet/enablemoodlenet', get_string('enablemoodlenet', 'tool_moodlenet'), - new lang_string('enablemoodlenet_desc', 'tool_moodlenet'), 0, 1, 0); - $settings->add($temp); + $temp = new admin_setting_configtext('tool_moodlenet/defaultmoodlenetname', + get_string('defaultmoodlenetname', 'tool_moodlenet'), new lang_string('defaultmoodlenetname_desc', 'tool_moodlenet'), + new lang_string('defaultmoodlenetnamevalue', 'tool_moodlenet')); + $settings->add($temp); - $temp = new admin_setting_configtext('tool_moodlenet/defaultmoodlenetname', - get_string('defaultmoodlenetname', 'tool_moodlenet'), new lang_string('defaultmoodlenetname_desc', 'tool_moodlenet'), - new lang_string('defaultmoodlenetnamevalue', 'tool_moodlenet')); - $settings->add($temp); + $temp = new admin_setting_configtext('tool_moodlenet/defaultmoodlenet', get_string('defaultmoodlenet', 'tool_moodlenet'), + new lang_string('defaultmoodlenet_desc', 'tool_moodlenet'), 'https://moodle.net'); + $settings->add($temp); - $temp = new admin_setting_configtext('tool_moodlenet/defaultmoodlenet', get_string('defaultmoodlenet', 'tool_moodlenet'), - new lang_string('defaultmoodlenet_desc', 'tool_moodlenet'), 'https://moodle.net'); - $settings->add($temp); + } }