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 |
* Classic theme settings file.
|
|
|
19 |
*
|
|
|
20 |
* @package theme_classic
|
|
|
21 |
* @copyright 2018 Bas Brands
|
|
|
22 |
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
|
23 |
*/
|
|
|
24 |
defined('MOODLE_INTERNAL') || die;
|
|
|
25 |
|
|
|
26 |
if ($ADMIN->fulltree) {
|
|
|
27 |
|
|
|
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'));
|
|
|
30 |
|
|
|
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');
|
|
|
36 |
$page->add($setting);
|
|
|
37 |
|
|
|
38 |
// Unaddable blocks.
|
|
|
39 |
$setting = new admin_setting_configtext('theme_classic/unaddableblocks',
|
|
|
40 |
get_string('unaddableblocks', 'theme_boost'), get_string('unaddableblocks_desc', 'theme_boost'), '', PARAM_TEXT);
|
|
|
41 |
$page->add($setting);
|
|
|
42 |
|
|
|
43 |
// Preset.
|
|
|
44 |
$name = 'theme_classic/preset';
|
|
|
45 |
$title = get_string('preset', 'theme_classic');
|
|
|
46 |
$description = get_string('preset_desc', 'theme_classic');
|
|
|
47 |
$default = 'default.scss';
|
|
|
48 |
|
|
|
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);
|
|
|
52 |
|
|
|
53 |
$choices = [];
|
|
|
54 |
foreach ($files as $file) {
|
|
|
55 |
$choices[$file->get_filename()] = $file->get_filename();
|
|
|
56 |
}
|
|
|
57 |
|
|
|
58 |
// These are the built in presets.
|
|
|
59 |
$choices['default.scss'] = 'default.scss';
|
|
|
60 |
$choices['plain.scss'] = 'plain.scss';
|
|
|
61 |
|
|
|
62 |
$setting = new admin_setting_configthemepreset($name, $title, $description, $default, $choices, 'classic');
|
|
|
63 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
|
|
64 |
$page->add($setting);
|
|
|
65 |
|
|
|
66 |
// Preset files setting.
|
|
|
67 |
$name = 'theme_classic/presetfiles';
|
|
|
68 |
$title = get_string('presetfiles', 'theme_classic');
|
|
|
69 |
$description = get_string('presetfiles_desc', 'theme_classic');
|
|
|
70 |
|
|
|
71 |
$setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0,
|
|
|
72 |
array('maxfiles' => 20, 'accepted_types' => array('.scss')));
|
|
|
73 |
$page->add($setting);
|
|
|
74 |
|
|
|
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');
|
|
|
81 |
$page->add($setting);
|
|
|
82 |
|
|
|
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');
|
|
|
88 |
$page->add($setting);
|
|
|
89 |
|
|
|
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');
|
|
|
97 |
$page->add($setting);
|
|
|
98 |
|
|
|
99 |
// Must add the page after definiting all the settings!
|
|
|
100 |
$settings->add($page);
|
|
|
101 |
|
|
|
102 |
// Advanced settings.
|
|
|
103 |
$page = new admin_settingpage('theme_classic_advanced', get_string('advancedsettings', 'theme_boost'));
|
|
|
104 |
|
|
|
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);
|
|
|
110 |
|
|
|
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);
|
|
|
116 |
|
|
|
117 |
$settings->add($page);
|
|
|
118 |
}
|