MDL-69228 tool_mobile: Hide dependant settings

This commit is contained in:
Andrew Nicols 2020-07-08 11:43:31 +08:00
parent 49a9e8b07d
commit 0bf024e48a

View file

@ -48,9 +48,6 @@ if ($hassiteconfig) {
$ADMIN->add('mobileapp', $temp);
// Show only mobile settings if the mobile service is enabled.
if (!empty($CFG->enablemobilewebservice)) {
$featuresnotice = null;
if (empty($CFG->disablemobileappsubscription)) {
// General notification about limited features due to app restrictions.
@ -59,14 +56,29 @@ if ($hassiteconfig) {
get_string('moodleappsportalfeatureswarning', 'tool_mobile', $subscriptionurl),
\core\output\notification::NOTIFY_WARNING);
$featuresnotice = $OUTPUT->render($notify);
$ADMIN->add('mobileapp', new admin_externalpage('mobileappsubscription',
new lang_string('mobileappsubscription', 'tool_mobile'),
"$CFG->wwwroot/$CFG->admin/tool/mobile/subscription.php"));
}
$hideappsubscription = empty($CFG->enablemobilewebservice);
$hideappsubscription = $hideappsubscription || (isset($CFG->disablemobileappsubscription) && !empty($CFG->disablemobileappsubscription));
$ADMIN->add(
'mobileapp',
new admin_externalpage(
'mobileappsubscription',
new lang_string('mobileappsubscription', 'tool_mobile'),
"$CFG->wwwroot/$CFG->admin/tool/mobile/subscription.php",
'moodle/site:config',
$hideappsubscription
)
);
// Type of login.
$temp = new admin_settingpage('mobileauthentication', new lang_string('mobileauthentication', 'tool_mobile'));
$temp = new admin_settingpage(
'mobileauthentication',
new lang_string('mobileauthentication', 'tool_mobile'),
'moodle/site:config',
empty($CFG->enablemobilewebservice)
);
$temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeaturesauth', '', $featuresnotice));
@ -99,7 +111,12 @@ if ($hassiteconfig) {
$ADMIN->add('mobileapp', $temp);
// Appearance related settings.
$temp = new admin_settingpage('mobileappearance', new lang_string('mobileappearance', 'tool_mobile'));
$temp = new admin_settingpage(
'mobileappearance',
new lang_string('mobileappearance', 'tool_mobile'),
'moodle/site:config',
empty($CFG->enablemobilewebservice)
);
if (!empty($featuresnotice)) {
$temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeaturesappearance', '', $featuresnotice));
@ -135,7 +152,12 @@ if ($hassiteconfig) {
$ADMIN->add('mobileapp', $temp);
// Features related settings.
$temp = new admin_settingpage('mobilefeatures', new lang_string('mobilefeatures', 'tool_mobile'));
$temp = new admin_settingpage(
'mobilefeatures',
new lang_string('mobilefeatures', 'tool_mobile'),
'moodle/site:config',
empty($CFG->enablemobilewebservice)
);
if (!empty($featuresnotice)) {
$temp->add(new admin_setting_heading('tool_mobile/moodleappsportalfeatures', '', $featuresnotice));
@ -168,5 +190,4 @@ if ($hassiteconfig) {
new lang_string('customlangstrings_desc', 'tool_mobile'), '', PARAM_RAW, '50', '10'));
$ADMIN->add('mobileapp', $temp);
}
}