1441 |
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 2022 - 2023 Marcin Czaja (https://rosea.io)
|
|
|
21 |
* @license Commercial https://themeforest.net/licenses
|
|
|
22 |
*
|
|
|
23 |
*/
|
|
|
24 |
|
|
|
25 |
defined('MOODLE_INTERNAL') || die();
|
|
|
26 |
|
|
|
27 |
$page = new admin_settingpage('theme_universe_settingsfiles', get_string('settingsfiles', 'theme_universe'));
|
|
|
28 |
|
|
|
29 |
$name = 'theme_universe/additionalresheading';
|
|
|
30 |
$title = get_string('additionalresheading', 'theme_universe');
|
|
|
31 |
$description = get_string('additionalresheading_desc', 'theme_universe');
|
|
|
32 |
$setting = new universe_setting_specialsettingheading($name, $title, $description);
|
|
|
33 |
$page->add($setting);
|
|
|
34 |
|
|
|
35 |
// Additional files
|
|
|
36 |
$name = 'theme_universe/additionalresources';
|
|
|
37 |
$title = get_string('additionalresourcessetting', 'theme_universe', null, true);
|
|
|
38 |
$description = get_string('additionalresourcessetting_desc', 'theme_universe', null, true);
|
|
|
39 |
$setting = new admin_setting_configstoredfile($name, $title, $description, 'additionalresources', 0,
|
|
|
40 |
['maxfiles' => -1]);
|
|
|
41 |
$page->add($setting);
|
|
|
42 |
|
|
|
43 |
// Information: Additional resources list.
|
|
|
44 |
// If there is at least one file uploaded.
|
|
|
45 |
if (!empty(get_config('theme_universe', 'additionalresources'))) {
|
|
|
46 |
// Prepare the widget.
|
|
|
47 |
$name = 'theme_universe/additionalresourceslist';
|
|
|
48 |
$title = get_string('additionalresourceslistsetting', 'theme_universe', null, true);
|
|
|
49 |
$description = get_string('additionalresourceslistsetting_desc', 'theme_universe', null, true).'<br /><br />'.
|
|
|
50 |
get_string('resourcescachecontrolnote', 'theme_universe', null, true);
|
|
|
51 |
|
|
|
52 |
// Append the file list to the description.
|
|
|
53 |
$templatecontext = ['files' => theme_universe_get_additionalresources_templatecontext()];
|
|
|
54 |
$description .= $OUTPUT->render_from_template('theme_universe/settings-additionalresources-filelist',
|
|
|
55 |
$templatecontext);
|
|
|
56 |
|
|
|
57 |
// Finish the widget.
|
|
|
58 |
$setting = new universe_setting_specialsettingheading($name, $title, $description);
|
|
|
59 |
$page->add($setting);
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
// Must add the page after definiting all the settings!
|
|
|
63 |
$settings->add($page);
|