Differences Between: [Versions 310 and 400] [Versions 310 and 401] [Versions 310 and 402] [Versions 310 and 403]
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 * @package theme_boost 19 * @copyright 2016 Ryan Wyllie 20 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 21 */ 22 23 defined('MOODLE_INTERNAL') || die(); 24 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')); 28 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'; 34 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); 38 39 $choices = []; 40 foreach ($files as $file) { 41 $choices[$file->get_filename()] = $file->get_filename(); 42 } 43 // These are the built in presets. 44 $choices['default.scss'] = 'default.scss'; 45 $choices['plain.scss'] = 'plain.scss'; 46 47 $setting = new admin_setting_configthemepreset($name, $title, $description, $default, $choices, 'boost'); 48 $setting->set_updatedcallback('theme_reset_all_caches'); 49 $page->add($setting); 50 51 // Preset files setting. 52 $name = 'theme_boost/presetfiles'; 53 $title = get_string('presetfiles','theme_boost'); 54 $description = get_string('presetfiles_desc', 'theme_boost'); 55 56 $setting = new admin_setting_configstoredfile($name, $title, $description, 'preset', 0, 57 array('maxfiles' => 20, 'accepted_types' => array('.scss'))); 58 $page->add($setting); 59 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); 67 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); 76 77 // Must add the page after definiting all the settings! 78 $settings->add($page); 79 80 // Advanced settings. 81 $page = new admin_settingpage('theme_boost_advanced', get_string('advancedsettings', 'theme_boost')); 82 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); 88 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); 94 95 $settings->add($page); 96 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body