Proyectos de Subversion Moodle

Rev

Rev 1338 | Rev 1340 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
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
 
5
// This line protects the file from being accessed by a URL directly.
1335 ariadna 6
defined('MOODLE_INTERNAL') || die();
7
 
1 efrain 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.
1335 ariadna 10
if ($ADMIN->fulltree) {
11
 
1 efrain 12
    // Boost provides a nice setting page which splits settings onto separate tabs. We want to use it here.
1337 ariadna 13
    $settings = new theme_universe_admin_settingspage_tabs('themesettinguniverse_child', get_string('configtitle', 'theme_universe_child'));
1339 ariadna 14
    require('settings/general.php');
15
    require('settings/seo.php');
16
    require('settings/customization.php');
17
    require('settings/topbar.php');
18
    require('settings/login.php');
19
    require('settings/dashboard.php');
20
    require('settings/mycourses.php');
21
    require('settings/course-page.php');
22
    require('settings/course-page-nav.php');
23
    require('settings/footer.php');
24
    require('settings/alert.php');
25
    require('settings/email.php');
26
    require('settings/advanced.php');
27
    require('settings/scb.php');
28
    require('settings/block0.php');
29
    require('settings/block1.php');
30
    require('settings/block2.php');
31
    require('settings/block3.php');
32
    require('settings/block4.php');
33
    require('settings/block5.php');
34
    require('settings/block6.php');
35
    require('settings/block7.php');
36
    require('settings/block8.php');
37
    require('settings/block9.php');
38
    require('settings/block10.php');
39
    require('settings/block11.php');
40
    require('settings/block12.php');
41
    require('settings/block13.php');
42
    require('settings/block14.php');
43
    require('settings/block15.php');
44
    require('settings/block16.php');
45
    require('settings/block17.php');
46
    require('settings/block18.php');
47
    require('settings/block19.php');
48
    require('settings/block20.php');
49
    require('settings/block21.php');
50
    require('settings/block22.php');
1335 ariadna 51
 
1 efrain 52
    // Each page is a tab - the first is the "General" tab.
1335 ariadna 53
    $page = new admin_settingpage('theme_universe_child_general', get_string('generalsettings', 'theme_universe_child'));
54
 
1 efrain 55
    // Replicate the preset setting from boost.
1335 ariadna 56
    $name = 'theme_universe_child/preset';
57
    $title = get_string('preset', 'theme_universe_child');
58
    $description = get_string('preset_desc', 'theme_universe_child');
59
    $default = 'default.scss';
60
 
1 efrain 61
    // We list files in our own file area to add to the drop down. We will provide our own function to
62
    // load all the presets from the correct paths.
1335 ariadna 63
    $context = context_system::instance();
64
    $fs = get_file_storage();
65
    $files = $fs->get_area_files($context->id, 'theme_universe_child', 'preset', 0, 'itemid, filepath, filename', false);
66
 
67
    $choices = [];
68
    foreach ($files as $file) {
69
        $choices[$file->get_filename()] = $file->get_filename();
70
    }
1 efrain 71
    // These are the built in presets from Boost.
1335 ariadna 72
    $choices['default.scss'] = 'default.scss';
73
    $choices['plain.scss'] = 'plain.scss';
74
 
75
    $setting = new admin_setting_configselect($name, $title, $description, $default, $choices);
76
    $setting->set_updatedcallback('theme_reset_all_caches');
77
    $page->add($setting);
78
 
1 efrain 79
    // Preset files setting.
1335 ariadna 80
    $name = 'theme_universe_child/presetfiles';
81
    $title = get_string('presetfiles', 'theme_universe_child');
82
    $description = get_string('presetfiles_desc', 'theme_universe_child');
1 efrain 83
 
1335 ariadna 84
    $setting = new admin_setting_configstoredfile(
85
        $name,
86
        $title,
87
        $description,
88
        'preset',
89
        0,
90
        array('maxfiles' => 20, 'accepted_types' => array('.scss'))
91
    );
92
    $page->add($setting);
93
 
1 efrain 94
    // Variable $brand-color.
95
    // We use an empty default value because the default colour should come from the preset.
1335 ariadna 96
    $name = 'theme_universe_child/brandcolor';
97
    $title = get_string('brandcolor', 'theme_universe_child');
98
    $description = get_string('brandcolor_desc', 'theme_universe_child');
99
    $setting = new admin_setting_configcolourpicker($name, $title, $description, '');
100
    $setting->set_updatedcallback('theme_reset_all_caches');
101
    $page->add($setting);
102
 
1 efrain 103
    // Must add the page after definiting all the settings!
1335 ariadna 104
    $settings->add($page);
105
 
1 efrain 106
    // Advanced settings.
1335 ariadna 107
    $page = new admin_settingpage('theme_universe_child_advanced', get_string('advancedsettings', 'theme_universe_child'));
108
 
1 efrain 109
    // Raw SCSS to include before the content.
1335 ariadna 110
    $setting = new admin_setting_configtextarea(
111
        'theme_universe_child/scsspre',
112
        get_string('rawscsspre', 'theme_universe_child'),
113
        get_string('rawscsspre_desc', 'theme_universe_child'),
114
        '',
115
        PARAM_RAW
116
    );
117
    $setting->set_updatedcallback('theme_reset_all_caches');
118
    $page->add($setting);
119
 
1 efrain 120
    // Raw SCSS to include after the content.
1335 ariadna 121
    $setting = new admin_setting_configtextarea(
122
        'theme_universe_child/scss',
123
        get_string('rawscss', 'theme_universe_child'),
124
        get_string('rawscss_desc', 'theme_universe_child'),
125
        '',
126
        PARAM_RAW
127
    );
128
    $setting->set_updatedcallback('theme_reset_all_caches');
129
    $page->add($setting);
130
 
131
    $settings->add($page);
132
}