| Línea 9... |
Línea 9... |
| 9 |
// we are looking at the admin settings pages.
|
9 |
// we are looking at the admin settings pages.
|
| 10 |
if ($ADMIN->fulltree) {
|
10 |
if ($ADMIN->fulltree) {
|
| Línea 11... |
Línea 11... |
| 11 |
|
11 |
|
| 12 |
// Boost provides a nice setting page which splits settings onto separate tabs. We want to use it here.
|
12 |
// Boost provides a nice setting page which splits settings onto separate tabs. We want to use it here.
|
| 13 |
require_once($CFG->dirroot . '/theme/universe/settings.php');
|
- |
|
| 14 |
|
- |
|
| 15 |
|
- |
|
| 16 |
// Each page is a tab - the first is the "General" tab.
|
- |
|
| 17 |
$page = new admin_settingpage('theme_universe_child_general', get_string('generalsettings', 'theme_universe_child'));
|
- |
|
| 18 |
|
- |
|
| 19 |
// Replicate the preset setting from boost.
|
- |
|
| 20 |
$name = 'theme_universe_child/preset';
|
- |
|
| 21 |
$title = get_string('preset', 'theme_universe_child');
|
- |
|
| 22 |
$description = get_string('preset_desc', 'theme_universe_child');
|
- |
|
| 23 |
$default = 'default.scss';
|
- |
|
| 24 |
|
- |
|
| 25 |
// We list files in our own file area to add to the drop down. We will provide our own function to
|
- |
|
| 26 |
// load all the presets from the correct paths.
|
- |
|
| 27 |
$context = context_system::instance();
|
- |
|
| 28 |
$fs = get_file_storage();
|
- |
|
| 29 |
$files = $fs->get_area_files($context->id, 'theme_universe_child', 'preset', 0, 'itemid, filepath, filename', false);
|
- |
|
| 30 |
|
- |
|
| 31 |
$choices = [];
|
- |
|
| 32 |
foreach ($files as $file) {
|
- |
|
| 33 |
$choices[$file->get_filename()] = $file->get_filename();
|
- |
|
| 34 |
}
|
- |
|
| 35 |
// These are the built in presets from Boost.
|
- |
|
| 36 |
$choices['default.scss'] = 'default.scss';
|
- |
|
| 37 |
$choices['plain.scss'] = 'plain.scss';
|
- |
|
| 38 |
|
- |
|
| 39 |
$setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
|
- |
|
| 40 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
- |
|
| 41 |
$page->add($setting);
|
- |
|
| 42 |
|
- |
|
| 43 |
// Preset files setting.
|
- |
|
| 44 |
$name = 'theme_universe_child/presetfiles';
|
- |
|
| 45 |
$title = get_string('presetfiles', 'theme_universe_child');
|
- |
|
| 46 |
$description = get_string('presetfiles_desc', 'theme_universe_child');
|
- |
|
| 47 |
|
- |
|
| 48 |
$setting = new admin_setting_configstoredfile(
|
- |
|
| 49 |
$name,
|
- |
|
| 50 |
$title,
|
- |
|
| 51 |
$description,
|
- |
|
| 52 |
'preset',
|
- |
|
| 53 |
0,
|
- |
|
| 54 |
array('maxfiles' => 20, 'accepted_types' => array('.scss'))
|
- |
|
| 55 |
);
|
- |
|
| 56 |
$page->add($setting);
|
- |
|
| 57 |
|
- |
|
| 58 |
// Variable $brand-color.
|
- |
|
| 59 |
// We use an empty default value because the default colour should come from the preset.
|
- |
|
| 60 |
$name = 'theme_universe_child/brandcolor';
|
- |
|
| 61 |
$title = get_string('brandcolor', 'theme_universe_child');
|
- |
|
| 62 |
$description = get_string('brandcolor_desc', 'theme_universe_child');
|
- |
|
| 63 |
$setting = new admin_setting_configcolourpicker($name, $title, $description, '');
|
- |
|
| 64 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
- |
|
| 65 |
$page->add($setting);
|
- |
|
| 66 |
|
- |
|
| 67 |
// Must add the page after definiting all the settings!
|
- |
|
| 68 |
$settings->add($page);
|
- |
|
| 69 |
|
- |
|
| 70 |
// Advanced settings.
|
- |
|
| 71 |
$page = new admin_settingpage('theme_universe_child_advanced', get_string('advancedsettings', 'theme_universe_child'));
|
- |
|
| 72 |
|
- |
|
| 73 |
// Raw SCSS to include before the content.
|
- |
|
| 74 |
$setting = new admin_setting_configtextarea(
|
- |
|
| 75 |
'theme_universe_child/scsspre',
|
- |
|
| 76 |
get_string('rawscsspre', 'theme_universe_child'),
|
- |
|
| 77 |
get_string('rawscsspre_desc', 'theme_universe_child'),
|
- |
|
| 78 |
'',
|
- |
|
| 79 |
PARAM_RAW
|
- |
|
| 80 |
);
|
- |
|
| 81 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
- |
|
| 82 |
$page->add($setting);
|
- |
|
| 83 |
|
- |
|
| 84 |
// Raw SCSS to include after the content.
|
- |
|
| 85 |
$setting = new admin_setting_configtextarea(
|
- |
|
| 86 |
'theme_universe_child/scss',
|
- |
|
| 87 |
get_string('rawscss', 'theme_universe_child'),
|
- |
|
| 88 |
get_string('rawscss_desc', 'theme_universe_child'),
|
- |
|
| 89 |
'',
|
- |
|
| 90 |
PARAM_RAW
|
- |
|
| 91 |
);
|
- |
|
| 92 |
$setting->set_updatedcallback('theme_reset_all_caches');
|
- |
|
| 93 |
$page->add($setting);
|
- |
|
| 94 |
|
- |
|
| 95 |
$settings->add($page);
|
13 |
require_once($CFG->dirroot . '/theme/universe/settings.php');
|