69c800fdee07714173d4cbbb1a03b06795204291
[moodle.git] / theme / more / settings.php
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.
13 //
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  * Theme More settings.
19  *
20  * Each setting that is defined in the parent theme Clean should be
21  * defined here too, and use the exact same config name. The reason
22  * is that theme_more does not define any layout files to re-use the
23  * ones from theme_clean. But as those layout files use the function
24  * {@link theme_clean_get_html_for_settings} that belong to Clean,
25  * we have to make sure it works as expected by having the same settings
26  * in our theme.
27  *
28  * @see        theme_clean_get_html_for_settings
29  * @package    theme_more
30  * @copyright  2014 Frédéric Massart
31  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
32  */
34 defined('MOODLE_INTERNAL') || die;
36 if ($ADMIN->fulltree) {
38     // @textColor setting.
39     $name = 'theme_more/textcolor';
40     $title = get_string('textcolor', 'theme_more');
41     $description = get_string('textcolor_desc', 'theme_more');
42     $default = '#333366';
43     $setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
44     $setting->set_updatedcallback('theme_reset_all_caches');
45     $settings->add($setting);
47     // @linkColor setting.
48     $name = 'theme_more/linkcolor';
49     $title = get_string('linkcolor', 'theme_more');
50     $description = get_string('linkcolor_desc', 'theme_more');
51     $default = '#FF6500';
52     $setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
53     $setting->set_updatedcallback('theme_reset_all_caches');
54     $settings->add($setting);
56     // @bodyBackground setting.
57     $name = 'theme_more/bodybackground';
58     $title = get_string('bodybackground', 'theme_more');
59     $description = get_string('bodybackground_desc', 'theme_more');
60     $default = '';
61     $setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
62     $setting->set_updatedcallback('theme_reset_all_caches');
63     $settings->add($setting);
65     // Background image setting.
66     $name = 'theme_more/backgroundimage';
67     $title = get_string('backgroundimage', 'theme_more');
68     $description = get_string('backgroundimage_desc', 'theme_more');
69     $setting = new admin_setting_configstoredfile($name, $title, $description, 'backgroundimage');
70     $setting->set_updatedcallback('theme_reset_all_caches');
71     $settings->add($setting);
73     // Background repeat setting.
74     $name = 'theme_more/backgroundrepeat';
75     $title = get_string('backgroundrepeat', 'theme_more');
76     $description = get_string('backgroundrepeat_desc', 'theme_more');;
77     $default = 'repeat';
78     $choices = array(
79         '0' => get_string('default'),
80         'repeat' => get_string('backgroundrepeatrepeat', 'theme_more'),
81         'repeat-x' => get_string('backgroundrepeatrepeatx', 'theme_more'),
82         'repeat-y' => get_string('backgroundrepeatrepeaty', 'theme_more'),
83         'no-repeat' => get_string('backgroundrepeatnorepeat', 'theme_more'),
84     );
85     $setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
86     $setting->set_updatedcallback('theme_reset_all_caches');
87     $settings->add($setting);
89     // Background position setting.
90     $name = 'theme_more/backgroundposition';
91     $title = get_string('backgroundposition', 'theme_more');
92     $description = get_string('backgroundposition_desc', 'theme_more');
93     $default = '0';
94     $choices = array(
95         '0' => get_string('default'),
96         'left_top' => get_string('backgroundpositionlefttop', 'theme_more'),
97         'left_center' => get_string('backgroundpositionleftcenter', 'theme_more'),
98         'left_bottom' => get_string('backgroundpositionleftbottom', 'theme_more'),
99         'right_top' => get_string('backgroundpositionrighttop', 'theme_more'),
100         'right_center' => get_string('backgroundpositionrightcenter', 'theme_more'),
101         'right_bottom' => get_string('backgroundpositionrightbottom', 'theme_more'),
102         'center_top' => get_string('backgroundpositioncentertop', 'theme_more'),
103         'center_center' => get_string('backgroundpositioncentercenter', 'theme_more'),
104         'center_bottom' => get_string('backgroundpositioncenterbottom', 'theme_more'),
105     );
106     $setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
107     $setting->set_updatedcallback('theme_reset_all_caches');
108     $settings->add($setting);
110     // Background fixed setting.
111     $name = 'theme_more/backgroundfixed';
112     $title = get_string('backgroundfixed', 'theme_more');
113     $description = get_string('backgroundfixed_desc', 'theme_more');
114     $setting = new admin_setting_configcheckbox($name, $title, $description, 0);
115     $setting->set_updatedcallback('theme_reset_all_caches');
116     $settings->add($setting);
118     // Main content background color.
119     $name = 'theme_more/contentbackground';
120     $title = get_string('contentbackground', 'theme_more');
121     $description = get_string('contentbackground_desc', 'theme_more');
122     $default = '#FFFFFF';
123     $setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
124     $setting->set_updatedcallback('theme_reset_all_caches');
125     $settings->add($setting);
127     // Secondary background color.
128     $name = 'theme_more/secondarybackground';
129     $title = get_string('secondarybackground', 'theme_more');
130     $description = get_string('secondarybackground_desc', 'theme_more');
131     $default = '#FFFFFF';
132     $setting = new admin_setting_configcolourpicker($name, $title, $description, $default, null, false);
133     $setting->set_updatedcallback('theme_reset_all_caches');
134     $settings->add($setting);
136     // Invert Navbar to dark background.
137     $name = 'theme_more/invert';
138     $title = get_string('invert', 'theme_more');
139     $description = get_string('invertdesc', 'theme_more');
140     $setting = new admin_setting_configcheckbox($name, $title, $description, 1);
141     $setting->set_updatedcallback('theme_reset_all_caches');
142     $settings->add($setting);
144     // Logo file setting.
145     $name = 'theme_more/logo';
146     $title = get_string('logo','theme_more');
147     $description = get_string('logodesc', 'theme_more');
148     $setting = new admin_setting_configstoredfile($name, $title, $description, 'logo');
149     $setting->set_updatedcallback('theme_reset_all_caches');
150     $settings->add($setting);
152     // Small logo file setting.
153     $name = 'theme_more/smalllogo';
154     $title = get_string('smalllogo', 'theme_more');
155     $description = get_string('smalllogodesc', 'theme_more');
156     $setting = new admin_setting_configstoredfile($name, $title, $description, 'smalllogo');
157     $setting->set_updatedcallback('theme_reset_all_caches');
158     $settings->add($setting);
160     // Show site name along with small logo.
161     $name = 'theme_more/sitename';
162     $title = get_string('sitename', 'theme_more');
163     $description = get_string('sitenamedesc', 'theme_more');
164     $setting = new admin_setting_configcheckbox($name, $title, $description, 1);
165     $setting->set_updatedcallback('theme_reset_all_caches');
166     $settings->add($setting);
168     // Custom CSS file.
169     $name = 'theme_more/customcss';
170     $title = get_string('customcss', 'theme_more');
171     $description = get_string('customcssdesc', 'theme_more');
172     $default = '';
173     $setting = new admin_setting_configtextarea($name, $title, $description, $default);
174     $setting->set_updatedcallback('theme_reset_all_caches');
175     $settings->add($setting);
177     // Footnote setting.
178     $name = 'theme_more/footnote';
179     $title = get_string('footnote', 'theme_more');
180     $description = get_string('footnotedesc', 'theme_more');
181     $default = '';
182     $setting = new admin_setting_confightmleditor($name, $title, $description, $default);
183     $setting->set_updatedcallback('theme_reset_all_caches');
184     $settings->add($setting);