diff --git a/admin/settings/appearance.php b/admin/settings/appearance.php index 3c583443235cc..7804f64ebdb9a 100644 --- a/admin/settings/appearance.php +++ b/admin/settings/appearance.php @@ -8,60 +8,6 @@ ); if ($hassiteconfig or has_any_capability($capabilities, $systemcontext)) { // speedup for non-admins, add all caps used on this page - - $ADMIN->add('appearance', new admin_category('themes', new lang_string('themes'))); - // "themesettings" settingpage - $temp = new admin_settingpage('themesettings', new lang_string('themesettings', 'admin')); - $setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'), - new lang_string('configthemelist', 'admin'), '', PARAM_NOTAGS); - $setting->set_force_ltr(true); - $temp->add($setting); - $setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'), new lang_string('configthemedesignermode', 'admin'), 0); - $setting->set_updatedcallback('theme_reset_all_caches'); - $temp->add($setting); - $temp->add(new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'), new lang_string('configallowuserthemes', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'), new lang_string('configallowcoursethemes', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'), new lang_string('configallowcategorythemes', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'), new lang_string('configallowcohortthemes', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), new lang_string('configallowthemechangeonurl', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), new lang_string('configallowuserblockhiding', 'admin'), 1)); - $temp->add(new admin_setting_configcheckbox('langmenuinsecurelayout', - new lang_string('langmenuinsecurelayout', 'admin'), - new lang_string('langmenuinsecurelayout_desc', 'admin'), 0)); - $temp->add(new admin_setting_configcheckbox('logininfoinsecurelayout', - new lang_string('logininfoinsecurelayout', 'admin'), - new lang_string('logininfoinsecurelayout_desc', 'admin'), 0)); - $temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'), - new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10')); - $temp->add(new admin_setting_configtextarea( - 'customusermenuitems', - new lang_string('customusermenuitems', 'admin'), - new lang_string('configcustomusermenuitems', 'admin'), - 'profile,moodle|/user/profile.php -grades,grades|/grade/report/mygrades.php -calendar,core_calendar|/calendar/view.php?view=month -privatefiles,moodle|/user/files.php -reports,core_reportbuilder|/reportbuilder/index.php', - PARAM_RAW, - '50', - '10' - )); - $ADMIN->add('themes', $temp); - $ADMIN->add('themes', new admin_externalpage('themeselector', - new lang_string('themeselector', 'admin'), $CFG->wwwroot . '/admin/themeselector.php')); - - // settings for each theme - foreach (core_component::get_plugin_list('theme') as $theme => $themedir) { - $settings_path = "$themedir/settings.php"; - if (file_exists($settings_path)) { - $settings = new admin_settingpage('themesetting'.$theme, new lang_string('pluginname', 'theme_'.$theme)); - include($settings_path); - if ($settings) { - $ADMIN->add('themes', $settings); - } - } - } - // Logos section. $temp = new admin_settingpage('logos', new lang_string('logossettings', 'admin')); @@ -337,4 +283,69 @@ $temp = new admin_settingpage('templates', new lang_string('templates', 'admin')); $temp->add($setting); $ADMIN->add('appearance', $temp); + + // Advanced theme settings page. + $temp = new admin_settingpage('themesettingsadvanced', new lang_string('themesettingsadvanced', 'admin')); + $setting = new admin_setting_configtext('themelist', new lang_string('themelist', 'admin'), + new lang_string('configthemelist', 'admin'), '', PARAM_NOTAGS); + $setting->set_force_ltr(true); + $temp->add($setting); + $setting = new admin_setting_configcheckbox('themedesignermode', new lang_string('themedesignermode', 'admin'), + new lang_string('configthemedesignermode', 'admin'), 0); + $setting->set_updatedcallback('theme_reset_all_caches'); + $temp->add($setting); + $temp->add(new admin_setting_configcheckbox('allowuserthemes', new lang_string('allowuserthemes', 'admin'), + new lang_string('configallowuserthemes', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('allowcoursethemes', new lang_string('allowcoursethemes', 'admin'), + new lang_string('configallowcoursethemes', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('allowcategorythemes', new lang_string('allowcategorythemes', 'admin'), + new lang_string('configallowcategorythemes', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('allowcohortthemes', new lang_string('allowcohortthemes', 'admin'), + new lang_string('configallowcohortthemes', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('allowthemechangeonurl', new lang_string('allowthemechangeonurl', 'admin'), + new lang_string('configallowthemechangeonurl', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('allowuserblockhiding', new lang_string('allowuserblockhiding', 'admin'), + new lang_string('configallowuserblockhiding', 'admin'), 1)); + $temp->add(new admin_setting_configcheckbox('langmenuinsecurelayout', + new lang_string('langmenuinsecurelayout', 'admin'), + new lang_string('langmenuinsecurelayout_desc', 'admin'), 0)); + $temp->add(new admin_setting_configcheckbox('logininfoinsecurelayout', + new lang_string('logininfoinsecurelayout', 'admin'), + new lang_string('logininfoinsecurelayout_desc', 'admin'), 0)); + $temp->add(new admin_setting_configtextarea('custommenuitems', new lang_string('custommenuitems', 'admin'), + new lang_string('configcustommenuitems', 'admin'), '', PARAM_RAW, '50', '10')); + $defaultsettingcustomusermenuitems = [ + 'profile,moodle|/user/profile.php', + 'grades,grades|/grade/report/mygrades.php', + 'calendar,core_calendar|/calendar/view.php?view=month', + 'privatefiles,moodle|/user/files.php', + 'reports,core_reportbuilder|/reportbuilder/index.php', + ]; + $temp->add(new admin_setting_configtextarea( + 'customusermenuitems', + new lang_string('customusermenuitems', 'admin'), + new lang_string('configcustomusermenuitems', 'admin'), + implode("\n", $defaultsettingcustomusermenuitems), + PARAM_RAW, + '50', + '10' + )); + $ADMIN->add('appearance', $temp); + + // Theme selector page. + $ADMIN->add('appearance', new admin_externalpage('themeselector', + new lang_string('themeselector', 'admin'), $CFG->wwwroot . '/admin/themeselector.php')); + + // Settings page for each theme. + foreach (core_component::get_plugin_list('theme') as $theme => $themedir) { + $settingspath = "$themedir/settings.php"; + if (file_exists($settingspath)) { + $settings = new admin_externalpage('themesetting' . $theme, new lang_string('pluginname', 'theme_'.$theme), + new moodle_url($settingspath), 'moodle/site:config', true); + include($settingspath); + if ($settings) { + $ADMIN->add('appearance', $settings); + } + } + } } // end of speedup diff --git a/admin/templates/themeselector/theme_card.mustache b/admin/templates/themeselector/theme_card.mustache index 9cb3bb6fea7a4..2e302adef54a3 100644 --- a/admin/templates/themeselector/theme_card.mustache +++ b/admin/templates/themeselector/theme_card.mustache @@ -26,7 +26,8 @@ "image": "http://moodlesite/theme/image.php?theme=boost&image=screenshot&component=theme", "current": true, "actionurl": "http://moodlesite/admin/themeselector.php", - "sesskey": "123XYZ" + "sesskey": "123XYZ", + "settingsurl": "http://moodlesite/admin/settings.php?section=themesettingboost" } }}