Skip to content
Snippets Groups Projects
Select Git revision
  • 6940d556a3f602386d83d95328ad34418970d8eb
  • master default protected
  • hsh_v3.11
  • hsh_v3.10-r6
  • hsh_v3.10-r3
  • v3.9-r9
  • v3.10-r6
  • v3.9-r8
  • v3.10-r5
  • v3.9-r7
  • v3.10-r4
  • v3.9-r6
  • v3.10-r3
  • v3.9-r5
  • v3.10-r2
  • v3.9-r4
  • v3.10-r1
  • v3.9-r3
  • v3.9-r2
  • v3.9-r1
  • v3.8-r5
  • v3.8-r4
  • v3.8-r3
  • v3.8-r2
  • v3.8-r1
25 results

settings.php

Blame
  • settings.php 39.99 KiB
    <?php
    // This file is part of Moodle - http://moodle.org/
    //
    // Moodle is free software: you can redistribute it and/or modify
    // it under the terms of the GNU General Public License as published by
    // the Free Software Foundation, either version 3 of the License, or
    // (at your option) any later version.
    //
    // Moodle is distributed in the hope that it will be useful,
    // but WITHOUT ANY WARRANTY; without even the implied warranty of
    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    // GNU General Public License for more details.
    //
    // You should have received a copy of the GNU General Public License
    // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
    
    /**
     * Theme Boost Campus - Settings file
     *
     * @package    theme_boost_campus
     * @copyright  2017 Kathrin Osswald, Ulm University <kathrin.osswald@uni-ulm.de>
     * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
     */
    
    defined('MOODLE_INTERNAL') || die();
    
    if ($ADMIN->fulltree) {
    
        // Create settings page with tabs.
        $settings = new theme_boost_admin_settingspage_tabs('themesettingboost_campus',
            get_string('configtitle', 'theme_boost_campus', null, true));
    
    
        // Create general tab.
        $page = new admin_settingpage('theme_boost_campus_general', get_string('generalsettings', 'theme_boost', null, true));
    
        // Settings title to group preset related settings together with a common heading. We don't want a description here.
        $name = 'theme_boost_campus/presetheading';
        $title = get_string('presetheadingsetting', 'theme_boost_campus', null, true);
        $setting = new admin_setting_heading($name, $title, null);
        $page->add($setting);
    
        // Replicate the preset setting from theme_boost.
        $name = 'theme_boost_campus/preset';
        $title = get_string('preset', 'theme_boost', null, true);
        $description = get_string('preset_desc', 'theme_boost', null, true);
        $default = 'default.scss';
    
        // We list files in our own file area to add to the drop down. We will provide our own function to
        // load all the presets from the correct paths.
        $context = context_system::instance();
        $fs = get_file_storage();
        $files = $fs->get_area_files($context->id, 'theme_boost_campus', 'preset', 0, 'itemid, filepath, filename', false);
    
        $choices = [];
        foreach ($files as $file) {
            $choices[$file->get_filename()] = $file->get_filename();
        }
        // These are the built in presets from Boost.
        $choices['default.scss'] = 'default.scss';
        $choices['plain.scss'] = 'plain.scss';
    
        $setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
        $setting->set_updatedcallback('theme_reset_all_caches');
        $page->add($setting);
    
    
        // Preset files setting.
        $name = 'theme_boost_campus/presetfiles';
        $title = get_string('presetfiles', 'theme_boost', null, true);