2 // This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 * Classic theme settings file.
20 * @package theme_classic
21 * @copyright 2018 Bas Brands
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
24 defined('MOODLE_INTERNAL') ||
die;
26 if ($ADMIN->fulltree
) {
28 $settings = new theme_boost_admin_settingspage_tabs('themesettingclassic', get_string('configtitle', 'theme_classic'));
29 $page = new admin_settingpage('theme_classic_general', get_string('generalsettings', 'theme_boost'));
31 $name = 'theme_classic/navbardark';
32 $title = get_string('navbardark', 'theme_classic');
33 $description = get_string('navbardarkdesc', 'theme_classic');
34 $setting = new admin_setting_configcheckbox($name, $title, $description, 0);
35 $setting->set_updatedcallback('theme_reset_all_caches');
39 $setting = new admin_setting_configtext('theme_classic/unaddableblocks',
40 get_string('unaddableblocks', 'theme_boost'), get_string('unaddableblocks_desc', 'theme_boost'), '', PARAM_TEXT
);
44 $name = 'theme_classic/preset';
45 $title = get_string('preset', 'theme_classic');
46 $description = get_string('preset_desc', 'theme_classic');
47 $default = 'default.scss';
49 $context = context_system
::instance();
50 $fs = get_file_storage();
51 $files = $fs->get_area_files($context->id
, 'theme_classic', 'preset', 0, 'itemid, filepath, filename', false);
54 foreach ($files as $file) {
55 $choices[$file->get_filename()] = $file->get_filename();
58 // These are the built in presets.
59 $choices['default.scss'] = 'default.scss';
60 $choices['plain.scss'] = 'plain.scss';
62 $setting = new admin_setting_configthemepreset($name, $title, $description, $default, $choices, 'classic');
63 $setting->set_updatedcallback('theme_reset_all_caches');
66 // Preset files setting.
67 $name = 'theme_classic/presetfiles';
68 $title = get_string('presetfiles', 'theme_classic');
69 $description = get_string('presetfiles_desc', 'theme_classic');
71 $setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0,
72 array('maxfiles' => 20, 'accepted_types' => array('.scss')));
75 // Background image setting.
76 $name = 'theme_classic/backgroundimage';
77 $title = get_string('backgroundimage', 'theme_boost');
78 $description = get_string('backgroundimage_desc', 'theme_boost');
79 $setting = new admin_setting_configstoredfile($name, $title, $description, 'backgroundimage');
80 $setting->set_updatedcallback('theme_reset_all_caches');
83 $name = 'theme_classic/loginbackgroundimage';
84 $title = get_string('loginbackgroundimage', 'theme_boost');
85 $description = get_string('loginbackgroundimage_desc', 'theme_boost');
86 $setting = new admin_setting_configstoredfile($name, $title, $description, 'loginbackgroundimage');
87 $setting->set_updatedcallback('theme_reset_all_caches');
90 // Variable $body-color.
91 // We use an empty default value because the default colour should come from the preset.
92 $name = 'theme_classic/brandcolor';
93 $title = get_string('brandcolor', 'theme_boost');
94 $description = get_string('brandcolor_desc', 'theme_boost');
95 $setting = new admin_setting_configcolourpicker($name, $title, $description, '');
96 $setting->set_updatedcallback('theme_reset_all_caches');
99 // Must add the page after definiting all the settings!
100 $settings->add($page);
102 // Advanced settings.
103 $page = new admin_settingpage('theme_classic_advanced', get_string('advancedsettings', 'theme_boost'));
105 // Raw SCSS to include before the content.
106 $setting = new admin_setting_scsscode('theme_classic/scsspre',
107 get_string('rawscsspre', 'theme_boost'), get_string('rawscsspre_desc', 'theme_boost'), '', PARAM_RAW
);
108 $setting->set_updatedcallback('theme_reset_all_caches');
109 $page->add($setting);
111 // Raw SCSS to include after the content.
112 $setting = new admin_setting_scsscode('theme_classic/scss', get_string('rawscss', 'theme_boost'),
113 get_string('rawscss_desc', 'theme_boost'), '', PARAM_RAW
);
114 $setting->set_updatedcallback('theme_reset_all_caches');
115 $page->add($setting);
117 $settings->add($page);