1 |
efrain |
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/>.
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
*
|
|
|
19 |
* @package theme_monocolor
|
|
|
20 |
* @copyright 2023 Marcin Czaja (https://rosea.io)
|
|
|
21 |
* @license Commercial https://themeforest.net/licenses
|
|
|
22 |
*
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
|
|
|
26 |
defined('MOODLE_INTERNAL') || die();
|
|
|
27 |
|
|
|
28 |
$page = new admin_settingpage('theme_monocolor_block1', get_string('settingsblock1', 'theme_monocolor'));
|
|
|
29 |
|
|
|
30 |
$name = 'theme_monocolor/displayblock1';
|
|
|
31 |
$title = get_string('turnon', 'theme_monocolor');
|
|
|
32 |
$description = get_string('displayblock1_desc', 'theme_monocolor');
|
|
|
33 |
$default = 0;
|
|
|
34 |
$setting = new admin_setting_configcheckbox($name, $title .
|
|
|
35 |
'<span class="badge badge-sq badge-dark ml-2">Block #1 (Slider)</span>', $description, $default);
|
|
|
36 |
$page->add($setting);
|
|
|
37 |
|
|
|
38 |
$name = 'theme_monocolor/block1fw';
|
|
|
39 |
$title = get_string('blockfw', 'theme_monocolor');
|
|
|
40 |
$description = get_string('blockfw_desc', 'theme_monocolor');
|
|
|
41 |
$default = 1;
|
|
|
42 |
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
|
|
|
43 |
$page->add($setting);
|
|
|
44 |
|
|
|
45 |
$name = 'theme_monocolor/block1id';
|
|
|
46 |
$title = get_string('additionalid', 'theme_monocolor');
|
|
|
47 |
$description = get_string('additionalid_desc', 'theme_monocolor');
|
|
|
48 |
$default = '';
|
|
|
49 |
$setting = new admin_setting_configtext($name, $title, $description, $default);
|
|
|
50 |
$page->add($setting);
|
|
|
51 |
|
|
|
52 |
$name = 'theme_monocolor/block1class';
|
|
|
53 |
$title = get_string('additionalclass', 'theme_monocolor');
|
|
|
54 |
$description = get_string('additionalclass_desc', 'theme_monocolor');
|
|
|
55 |
$default = '';
|
|
|
56 |
$setting = new admin_setting_configtext($name, $title, $description, $default);
|
|
|
57 |
$page->add($setting);
|
|
|
58 |
|
|
|
59 |
$name = 'theme_monocolor/block1wrapperalign';
|
|
|
60 |
$title = get_string('block1wrapperalign', 'theme_monocolor');
|
|
|
61 |
$description = get_string('block1wrapperalign_desc', 'theme_monocolor');
|
|
|
62 |
$default = 1;
|
|
|
63 |
$choices = array(0 => 'Left', 1 => 'Middle', 2 => 'Right');
|
|
|
64 |
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
|
|
|
65 |
$page->add($setting);
|
|
|
66 |
|
|
|
67 |
$name = 'theme_monocolor/block1herotitlesize';
|
|
|
68 |
$title = get_string('blocktitlesize', 'theme_monocolor');
|
|
|
69 |
$description = get_string('blocktitlesize_desc', 'theme_monocolor');
|
|
|
70 |
$default = 1;
|
|
|
71 |
$choices = array(0 => 'Normal', 1 => 'Large', 2 => 'Extra Large');
|
|
|
72 |
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
|
|
|
73 |
$page->add($setting);
|
|
|
74 |
|
|
|
75 |
$name = 'theme_monocolor/block1herotitlecolor';
|
|
|
76 |
$title = get_string('blocktitlecolor', 'theme_monocolor');
|
|
|
77 |
$description = get_string('blocktitlecolor_desc', 'theme_monocolor');
|
|
|
78 |
$default = 1;
|
|
|
79 |
$choices = array(0 => 'White', 1 => 'Black', 2 => 'Gradient');
|
|
|
80 |
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
|
|
|
81 |
$page->add($setting);
|
|
|
82 |
|
|
|
83 |
$name = 'theme_monocolor/block1herotitleweight';
|
|
|
84 |
$title = get_string('blocktitleweight', 'theme_monocolor');
|
|
|
85 |
$description = get_string('blocktitleweight_desc', 'theme_monocolor');
|
|
|
86 |
$default = 1;
|
|
|
87 |
$choices = array(0 => 'Normal', 1 => 'Medium', 2 => 'Bold');
|
|
|
88 |
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
|
|
|
89 |
$page->add($setting);
|
|
|
90 |
|
|
|
91 |
$name = 'theme_monocolor/showblock1sliderwrapper';
|
|
|
92 |
$title = get_string('showblock1sliderwrapper', 'theme_monocolor');
|
|
|
93 |
$description = get_string('showblock1sliderwrapper_desc', 'theme_monocolor');
|
|
|
94 |
$default = 1;
|
|
|
95 |
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
|
|
|
96 |
$page->add($setting);
|
|
|
97 |
|
|
|
98 |
$name = 'theme_monocolor/block1sliderwrapperbg';
|
|
|
99 |
$title = get_string('block1sliderwrapperbg', 'theme_monocolor');
|
|
|
100 |
$description = get_string('block1sliderwrapperbg_desc', 'theme_monocolor');
|
|
|
101 |
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
|
|
|
102 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
|
|
103 |
$page->add($setting);
|
|
|
104 |
|
|
|
105 |
$name = 'theme_monocolor/block1sliderinterval';
|
|
|
106 |
$title = get_string('sliderinterval', 'theme_monocolor');
|
|
|
107 |
$description = get_string('sliderinterval_desc', 'theme_monocolor');
|
|
|
108 |
$default = '6000';
|
|
|
109 |
$setting = new admin_setting_configtext($name, $title, $description, $default);
|
|
|
110 |
$page->add($setting);
|
|
|
111 |
|
|
|
112 |
$name = 'theme_monocolor/block1count';
|
|
|
113 |
$title = get_string('block1count', 'theme_monocolor');
|
|
|
114 |
$description = get_string('block1count_desc', 'theme_monocolor');
|
|
|
115 |
$default = 1;
|
|
|
116 |
$options = array();
|
|
|
117 |
for ($i = 1; $i <= 7; $i++) {
|
|
|
118 |
$options[$i] = $i;
|
|
|
119 |
}
|
|
|
120 |
$setting = new admin_setting_configselect($name, $title, $description, $default, $options);
|
|
|
121 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
|
|
122 |
$page->add($setting);
|
|
|
123 |
|
|
|
124 |
// If we don't have an slide yet, default to the preset.
|
|
|
125 |
$slidercount = get_config('theme_monocolor', 'block1count');
|
|
|
126 |
|
|
|
127 |
if (!$slidercount) {
|
|
|
128 |
$slidercount = 1;
|
|
|
129 |
}
|
|
|
130 |
|
|
|
131 |
for ($sliderindex = 1; $sliderindex <= $slidercount; $sliderindex++) {
|
|
|
132 |
$name = 'theme_monocolor/hblock1slide' . $sliderindex;
|
|
|
133 |
$heading = get_string('hblock1slide', 'theme_monocolor');
|
|
|
134 |
$title = get_string('hblock1slide_desc', 'theme_monocolor');
|
|
|
135 |
$setting = new admin_setting_heading($name, '<span class="rui-admin-no">' .
|
|
|
136 |
$sliderindex .
|
|
|
137 |
'</span>' .
|
|
|
138 |
$heading, format_text($title, FORMAT_MARKDOWN));
|
|
|
139 |
$page->add($setting);
|
|
|
140 |
|
|
|
141 |
$fileid = 'block1slideimg' . $sliderindex;
|
|
|
142 |
$name = 'theme_monocolor/block1slideimg' . $sliderindex;
|
|
|
143 |
$title = get_string('block1slideimg', 'theme_monocolor');
|
|
|
144 |
$description = get_string('block1slideimg_desc', 'theme_monocolor');
|
|
|
145 |
$opts = array('accepted_types' => array('.png', '.jpg', '.gif', '.webp', '.tiff', '.svg'), 'maxfiles' => 1);
|
|
|
146 |
$setting = new admin_setting_configstoredfile($name, '<span class="rui-admin-no">' .
|
|
|
147 |
$sliderindex .
|
|
|
148 |
'</span>' .
|
|
|
149 |
$title, $description, $fileid, 0, $opts);
|
|
|
150 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
|
|
151 |
$page->add($setting);
|
|
|
152 |
|
|
|
153 |
$name = 'theme_monocolor/block1slidesubtitle' . $sliderindex;
|
|
|
154 |
$title = get_string('blockintrosubtitle', 'theme_monocolor');
|
|
|
155 |
$description = get_string('blockintrosubtitle_desc', 'theme_monocolor');
|
|
|
156 |
$setting = new admin_setting_configtext($name, '<span class="rui-admin-no">' .
|
|
|
157 |
$sliderindex .
|
|
|
158 |
'</span>' .
|
|
|
159 |
$title, $description, '', PARAM_TEXT);
|
|
|
160 |
$page->add($setting);
|
|
|
161 |
|
|
|
162 |
$name = 'theme_monocolor/block1slidetitle' . $sliderindex;
|
|
|
163 |
$title = get_string('block1slidetitle', 'theme_monocolor');
|
|
|
164 |
$description = get_string('block1slidetitle_desc', 'theme_monocolor');
|
|
|
165 |
$setting = new admin_setting_configtext($name, '<span class="rui-admin-no">' .
|
|
|
166 |
$sliderindex .
|
|
|
167 |
'</span>' .
|
|
|
168 |
$title, $description, '', PARAM_TEXT);
|
|
|
169 |
$page->add($setting);
|
|
|
170 |
|
|
|
171 |
$name = 'theme_monocolor/block1slidecaption' . $sliderindex;
|
|
|
172 |
$title = get_string('block1slidecaption', 'theme_monocolor');
|
|
|
173 |
$description = get_string('block1slidecaption_desc', 'theme_monocolor');
|
|
|
174 |
$default = '';
|
|
|
175 |
$setting = new admin_setting_confightmleditor($name, '<span class="rui-admin-no">' .
|
|
|
176 |
$sliderindex .
|
|
|
177 |
'</span>' .
|
|
|
178 |
$title, $description, $default);
|
|
|
179 |
$page->add($setting);
|
|
|
180 |
|
|
|
181 |
$name = 'theme_monocolor/block1slidecss' . $sliderindex;
|
|
|
182 |
$title = get_string('block1slidecss', 'theme_monocolor');
|
|
|
183 |
$description = get_string('block1slidecss_desc', 'theme_monocolor');
|
|
|
184 |
$setting = new admin_setting_configtextarea($name, '<span class="rui-admin-no">' .
|
|
|
185 |
$sliderindex .
|
|
|
186 |
'</span>' .
|
|
|
187 |
$title, $description, '', PARAM_TEXT);
|
|
|
188 |
$page->add($setting);
|
|
|
189 |
}
|
|
|
190 |
|
|
|
191 |
$settings->add($page);
|