Proyectos de Subversion Moodle

Rev

Rev 1343 | Rev 1345 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1343 Rev 1344
Línea 2... Línea 2...
2
 
2
 
Línea 3... Línea 3...
3
// Every file should have GPL and copyright in the header - we skip it in tutorials but you should not skip it for real.
3
// Every file should have GPL and copyright in the header - we skip it in tutorials but you should not skip it for real.
4
 
4
 
5
// This line protects the file from being accessed by a URL directly.                                                               
-
 
Línea 6... Línea 5...
6
defined('MOODLE_INTERNAL') || die();
5
// This line protects the file from being accessed by a URL directly.                                                               
7
require_once($CFG->dirroot . '/theme/universe/lib.php');
6
defined('MOODLE_INTERNAL') || die();
8
 
7
 
Línea 9... Línea 8...
9
// This is used for performance, we don't need to know about these settings on every page in Moodle, only when                      
8
// This is used for performance, we don't need to know about these settings on every page in Moodle, only when                      
-
 
9
// we are looking at the admin settings pages.                                                                                      
-
 
10
if ($ADMIN->fulltree) {
-
 
11
 
-
 
12
    // Boost provides a nice setting page which splits settings onto separate tabs. We want to use it here.                         
-
 
13
    $settings = new theme_universe_admin_settingspage_tabs('themesettinguniverse_child', get_string('configtitle', 'theme_universe_child'));
-
 
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'));
10
// we are looking at the admin settings pages.                                                                                      
18
    require('settings/topbar.php');
-
 
19
 
-
 
20
    // Replicate the preset setting from boost.                                                                                     
-
 
21
    $name = 'theme_universe_child/preset';
-
 
22
    $title = get_string('preset', 'theme_universe_child');
-
 
23
    $description = get_string('preset_desc', 'theme_universe_child');
-
 
24
    $default = 'default.scss';
-
 
25
 
-
 
26
    // We list files in our own file area to add to the drop down. We will provide our own function to                              
-
 
27
    // load all the presets from the correct paths.                                                                                 
-
 
28
    $context = context_system::instance();
-
 
29
    $fs = get_file_storage();
-
 
30
    $files = $fs->get_area_files($context->id, 'theme_universe_child', 'preset', 0, 'itemid, filepath, filename', false);
-
 
31
 
-
 
32
    $choices = [];
-
 
33
    foreach ($files as $file) {
-
 
34
        $choices[$file->get_filename()] = $file->get_filename();
-
 
35
    }
-
 
36
    // These are the built in presets from Boost.                                                                                   
-
 
37
    $choices['default.scss'] = 'default.scss';
-
 
38
    $choices['plain.scss'] = 'plain.scss';
-
 
39
 
-
 
40
    $setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
-
 
41
    $setting->set_updatedcallback('theme_reset_all_caches');
-
 
42
    $page->add($setting);
-
 
43
 
-
 
44
    // Preset files setting.                                                                                                        
-
 
45
    $name = 'theme_universe_child/presetfiles';
-
 
46
    $title = get_string('presetfiles', 'theme_universe_child');
-
 
47
    $description = get_string('presetfiles_desc', 'theme_universe_child');
-
 
48
 
-
 
49
    $setting = new admin_setting_configstoredfile(
-
 
50
        $name,
-
 
51
        $title,
-
 
52
        $description,
-
 
53
        'preset',
-
 
54
        0,
-
 
55
        array('maxfiles' => 20, 'accepted_types' => array('.scss'))
-
 
56
    );
-
 
57
    $page->add($setting);
-
 
58
 
-
 
59
    // Variable $brand-color.                                                                                                       
-
 
60
    // We use an empty default value because the default colour should come from the preset.                                        
-
 
61
    $name = 'theme_universe_child/brandcolor';
-
 
62
    $title = get_string('brandcolor', 'theme_universe_child');
-
 
63
    $description = get_string('brandcolor_desc', 'theme_universe_child');
-
 
64
    $setting = new admin_setting_configcolourpicker($name, $title, $description, '');
-
 
65
    $setting->set_updatedcallback('theme_reset_all_caches');
-
 
66
    $page->add($setting);
-
 
67
 
-
 
68
    // Must add the page after definiting all the settings!                                                                         
-
 
69
    $settings->add($page);
-
 
70
 
-
 
71
    // Advanced settings.                                                                                                           
-
 
72
    $page = new admin_settingpage('theme_universe_child_advanced', get_string('advancedsettings', 'theme_universe_child'));
-
 
73
 
-
 
74
    // Raw SCSS to include before the content.                                                                                      
-
 
75
    $setting = new admin_setting_configtextarea(
-
 
76
        'theme_universe_child/scsspre',
-
 
77
        get_string('rawscsspre', 'theme_universe_child'),
-
 
78
        get_string('rawscsspre_desc', 'theme_universe_child'),
-
 
79
        '',
-
 
80
        PARAM_RAW
-
 
81
    );
-
 
82
    $setting->set_updatedcallback('theme_reset_all_caches');
-
 
83
    $page->add($setting);
-
 
84
 
-
 
85
    // Raw SCSS to include after the content.                                                                                       
-
 
86
    $setting = new admin_setting_configtextarea(
-
 
87
        'theme_universe_child/scss',
-
 
88
        get_string('rawscss', 'theme_universe_child'),
-
 
89
        get_string('rawscss_desc', 'theme_universe_child'),
-
 
90
        '',
-
 
91
        PARAM_RAW
-
 
92
    );
11
if ($ADMIN->fulltree) {
93
    $setting->set_updatedcallback('theme_reset_all_caches');