Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 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
 *
19
 * @package   theme_universe
20
 * @copyright 2023 Marcin Czaja (https://rosea.io)
21
 * @license   Commercial https://themeforest.net/licenses
22
 *
23
 */
24
 
25
 
26
defined('MOODLE_INTERNAL') || die();
27
 
28
// Advanced settings.
29
$page = new admin_settingpage(
30
    'theme_universe_advanced',
31
    get_string('advancedsettings', 'theme_universe')
32
);
33
 
34
// H5P custom CSS.
35
$setting = new admin_setting_configtextarea(
36
    'theme_universe/hvpcss',
37
    get_string('hvpcss', 'theme_universe'),
38
    get_string('hvpcss_desc', 'theme_universe'), '');
39
$page->add($setting);
40
 
41
// Raw SCSS to include before the content.
42
$setting = new admin_setting_scsscode(
43
    'theme_universe/scsspre',
44
    get_string('rawscsspre', 'theme_universe'),
45
    get_string('rawscsspre_desc', 'theme_universe'),
46
    '',
47
    PARAM_RAW
48
);
49
$setting->set_updatedcallback('theme_reset_all_caches');
50
$page->add($setting);
51
 
52
// Raw SCSS to include after the content.
53
$setting = new admin_setting_scsscode(
54
    'theme_universe/scss',
55
    get_string('rawscss', 'theme_universe'),
56
    get_string('rawscss_desc', 'theme_universe'),
57
    '',
58
    PARAM_RAW
59
);
60
$setting->set_updatedcallback('theme_reset_all_caches');
61
$page->add($setting);
62
 
63
// Font files upload.
64
// Setting: Custom fonts.
65
$name = 'theme_universe/fontfiles';
66
$title = get_string('customfontssetting', 'theme_universe', null, true);
67
$description = get_string('customfontssetting_desc', 'theme_universe', null, true);
68
if ($registerfontsresult == true) {
69
    $setting = new admin_setting_configstoredfile($name, $title, $description, 'fontfiles', 0,
70
            ['maxfiles' => -1, 'accepted_types' => theme_universe_get_webfonts_extensions()]);
71
} else {
72
    $setting = new admin_setting_configstoredfile($name, $title, $description, 'fontfiles', 0,
73
            ['maxfiles' => -1]);
74
}
75
$page->add($setting);
76
 
77
// Information: Custom fonts list.
78
// Credits: Boost_Union
79
// If there is at least one file uploaded.
80
if (!empty(get_config('theme_universe', 'fontfiles'))) {
81
    // Prepare the widget.
82
    $name = 'theme_universe/customfontslist';
83
    $title = get_string('customfontslistsetting', 'theme_universe', null, true);
84
    $description = get_string('customfontslistsetting_desc', 'theme_universe', null, true);
85
 
86
    // Append the file list to the description.
87
    $templatecontext = ['files' => theme_universe_get_customfonts_templatecontext()];
88
    $description .= $OUTPUT->render_from_template('theme_universe/settings-customfonts-filelist', $templatecontext);
89
 
90
    // Finish the widget.
91
    $setting = new admin_setting_description($name, $title, $description);
92
    $page->add($setting);
93
}
94
 
95
// Additional files
96
$name = 'theme_universe/additionalresources';
97
$title = get_string('additionalresourcessetting', 'theme_universe', null, true);
98
$description = get_string('additionalresourcessetting_desc', 'theme_universe', null, true);
99
$setting = new admin_setting_configstoredfile($name, $title, $description, 'additionalresources', 0,
100
        ['maxfiles' => -1]);
101
$page->add($setting);
102
 
103
// Information: Additional resources list.
104
// If there is at least one file uploaded.
105
if (!empty(get_config('theme_universe', 'additionalresources'))) {
106
    // Prepare the widget.
107
    $name = 'theme_universe/additionalresourceslist';
108
    $title = get_string('additionalresourceslistsetting', 'theme_universe', null, true);
109
    $description = get_string('additionalresourceslistsetting_desc', 'theme_universe', null, true).'<br /><br />'.
110
            get_string('resourcescachecontrolnote', 'theme_universe', null, true);
111
 
112
    // Append the file list to the description.
113
    $templatecontext = ['files' => theme_universe_get_additionalresources_templatecontext()];
114
    $description .= $OUTPUT->render_from_template('theme_universe/settings-additionalresources-filelist',
115
            $templatecontext);
116
 
117
    // Finish the widget.
118
    $setting = new admin_setting_description($name, $title, $description);
119
    $page->add($setting);
120
}
121
 
122
$settings->add($page);