Proyectos de Subversion Moodle

Rev

Rev 1342 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1342 ariadna 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(
1344 ariadna 30
    'theme_universe_child_advanced',
31
    get_string('advancedsettings', 'theme_universe_child')
1342 ariadna 32
);
33
 
34
// H5P custom CSS.
35
$setting = new admin_setting_configtextarea(
1344 ariadna 36
    'theme_universe_child/hvpcss',
37
    get_string('hvpcss', 'theme_universe_child'),
38
    get_string('hvpcss_desc', 'theme_universe_child'),
39
    ''
40
);
1342 ariadna 41
$page->add($setting);
42
 
43
// Raw SCSS to include before the content.
44
$setting = new admin_setting_scsscode(
1344 ariadna 45
    'theme_universe_child/scsspre',
46
    get_string('rawscsspre', 'theme_universe_child'),
47
    get_string('rawscsspre_desc', 'theme_universe_child'),
1342 ariadna 48
    '',
49
    PARAM_RAW
50
);
51
$setting->set_updatedcallback('theme_reset_all_caches');
52
$page->add($setting);
53
 
54
// Raw SCSS to include after the content.
55
$setting = new admin_setting_scsscode(
1344 ariadna 56
    'theme_universe_child/scss',
57
    get_string('rawscss', 'theme_universe_child'),
58
    get_string('rawscss_desc', 'theme_universe_child'),
1342 ariadna 59
    '',
60
    PARAM_RAW
61
);
62
$setting->set_updatedcallback('theme_reset_all_caches');
63
$page->add($setting);
64
 
65
// Font files upload.
66
// Setting: Custom fonts.
1344 ariadna 67
$name = 'theme_universe_child/fontfiles';
1342 ariadna 68
$title = get_string('customfontssetting', 'theme_universe', null, true);
69
$description = get_string('customfontssetting_desc', 'theme_universe', null, true);
70
if ($registerfontsresult == true) {
1344 ariadna 71
    $setting = new admin_setting_configstoredfile(
72
        $name,
73
        $title,
74
        $description,
75
        'fontfiles',
76
        0,
77
        ['maxfiles' => -1, 'accepted_types' => theme_universe_get_webfonts_extensions()]
78
    );
1342 ariadna 79
} else {
1344 ariadna 80
    $setting = new admin_setting_configstoredfile(
81
        $name,
82
        $title,
83
        $description,
84
        'fontfiles',
85
        0,
86
        ['maxfiles' => -1]
87
    );
1342 ariadna 88
}
89
$page->add($setting);
90
 
91
// Information: Custom fonts list.
92
// Credits: Boost_Union
93
// If there is at least one file uploaded.
94
if (!empty(get_config('theme_universe', 'fontfiles'))) {
95
    // Prepare the widget.
96
    $name = 'theme_universe/customfontslist';
97
    $title = get_string('customfontslistsetting', 'theme_universe', null, true);
98
    $description = get_string('customfontslistsetting_desc', 'theme_universe', null, true);
99
 
100
    // Append the file list to the description.
101
    $templatecontext = ['files' => theme_universe_get_customfonts_templatecontext()];
102
    $description .= $OUTPUT->render_from_template('theme_universe/settings-customfonts-filelist', $templatecontext);
103
 
104
    // Finish the widget.
105
    $setting = new admin_setting_description($name, $title, $description);
106
    $page->add($setting);
107
}
108
 
109
// Additional files
110
$name = 'theme_universe/additionalresources';
111
$title = get_string('additionalresourcessetting', 'theme_universe', null, true);
112
$description = get_string('additionalresourcessetting_desc', 'theme_universe', null, true);
1344 ariadna 113
$setting = new admin_setting_configstoredfile(
114
    $name,
115
    $title,
116
    $description,
117
    'additionalresources',
118
    0,
119
    ['maxfiles' => -1]
120
);
1342 ariadna 121
$page->add($setting);
122
 
123
// Information: Additional resources list.
124
// If there is at least one file uploaded.
125
if (!empty(get_config('theme_universe', 'additionalresources'))) {
126
    // Prepare the widget.
127
    $name = 'theme_universe/additionalresourceslist';
128
    $title = get_string('additionalresourceslistsetting', 'theme_universe', null, true);
1344 ariadna 129
    $description = get_string('additionalresourceslistsetting_desc', 'theme_universe', null, true) . '<br /><br />' .
130
        get_string('resourcescachecontrolnote', 'theme_universe', null, true);
1342 ariadna 131
 
132
    // Append the file list to the description.
133
    $templatecontext = ['files' => theme_universe_get_additionalresources_templatecontext()];
1344 ariadna 134
    $description .= $OUTPUT->render_from_template(
135
        'theme_universe/settings-additionalresources-filelist',
136
        $templatecontext
137
    );
1342 ariadna 138
 
139
    // Finish the widget.
140
    $setting = new admin_setting_description($name, $title, $description);
141
    $page->add($setting);
142
}
143
 
144
$settings->add($page);