Automatically generated installer lang files
[moodle.git] / theme / boost / settings.php
blobc7cde2b20171ac1b0e4d247f3c9621823567bcb0
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.
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/>.
17 /**
18 * @package theme_boost
19 * @copyright 2016 Ryan Wyllie
20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 defined('MOODLE_INTERNAL') || die();
25 if ($ADMIN->fulltree) {
26 $settings = new theme_boost_admin_settingspage_tabs('themesettingboost', get_string('configtitle', 'theme_boost'));
27 $page = new admin_settingpage('theme_boost_general', get_string('generalsettings', 'theme_boost'));
29 // Preset.
30 $name = 'theme_boost/preset';
31 $title = get_string('preset', 'theme_boost');
32 $description = get_string('preset_desc', 'theme_boost');
33 $default = 'default.scss';
35 $context = context_system::instance();
36 $fs = get_file_storage();
37 $files = $fs->get_area_files($context->id, 'theme_boost', 'preset', 0, 'itemid, filepath, filename', false);
39 $choices = [];
40 foreach ($files as $file) {
41 $choices[$file->get_filename()] = $file->get_filename();
43 // These are the built in presets.
44 $choices['default.scss'] = 'default.scss';
45 $choices['plain.scss'] = 'plain.scss';
47 $setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
48 $setting->set_updatedcallback('theme_reset_all_caches');
49 $page->add($setting);
51 // Preset files setting.
52 $name = 'theme_boost/presetfiles';
53 $title = get_string('presetfiles','theme_boost');
54 $description = get_string('presetfiles_desc', 'theme_boost');
56 $setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0,
57 array('maxfiles' => 20, 'accepted_types' => array('.scss')));
58 $page->add($setting);
60 // Background image setting.
61 $name = 'theme_boost/backgroundimage';
62 $title = get_string('backgroundimage', 'theme_boost');
63 $description = get_string('backgroundimage_desc', 'theme_boost');
64 $setting = new admin_setting_configstoredfile($name, $title, $description, 'backgroundimage');
65 $setting->set_updatedcallback('theme_reset_all_caches');
66 $page->add($setting);
68 // Variable $body-color.
69 // We use an empty default value because the default colour should come from the preset.
70 $name = 'theme_boost/brandcolor';
71 $title = get_string('brandcolor', 'theme_boost');
72 $description = get_string('brandcolor_desc', 'theme_boost');
73 $setting = new admin_setting_configcolourpicker($name, $title, $description, '');
74 $setting->set_updatedcallback('theme_reset_all_caches');
75 $page->add($setting);
77 // Must add the page after definiting all the settings!
78 $settings->add($page);
80 // Advanced settings.
81 $page = new admin_settingpage('theme_boost_advanced', get_string('advancedsettings', 'theme_boost'));
83 // Raw SCSS to include before the content.
84 $setting = new admin_setting_scsscode('theme_boost/scsspre',
85 get_string('rawscsspre', 'theme_boost'), get_string('rawscsspre_desc', 'theme_boost'), '', PARAM_RAW);
86 $setting->set_updatedcallback('theme_reset_all_caches');
87 $page->add($setting);
89 // Raw SCSS to include after the content.
90 $setting = new admin_setting_scsscode('theme_boost/scss', get_string('rawscss', 'theme_boost'),
91 get_string('rawscss_desc', 'theme_boost'), '', PARAM_RAW);
92 $setting->set_updatedcallback('theme_reset_all_caches');
93 $page->add($setting);
95 $settings->add($page);