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 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_settingscoursesnav', get_string('settingscoursesnav', 'theme_universe'));
28
 
29
$name = 'theme_universe/secnavgroupitem';
30
$title = get_string('secnavgroupitem', 'theme_universe');
31
$description = get_string('secnavgroupitem_desc', 'theme_universe', $a);
32
$default = 1;
33
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
34
$page->add($setting);
35
 
36
$name = 'theme_universe/secnavitems';
37
$title = get_string('secnavitems', 'theme_universe');
38
$description = get_string('secnavitems_desc', 'theme_universe');
39
$default = 0;
40
$setting = new admin_setting_configcheckbox($name, $title, $description, $default);
41
$page->add($setting);
42
 
43
if (get_config('theme_universe', 'secnavitems')) {
44
    $name = 'theme_universe/secnavitemscount';
45
    $title = get_string('secnavitemscount', 'theme_universe');
46
    $description = get_string('secnavitemscount_desc', 'theme_universe');
47
    $default = 0;
48
    $options = array();
49
    for ($i = 1; $i <= 10; $i++) {
50
        $options[$i] = $i;
51
    }
52
    $setting = new admin_setting_configselect($name, $title, $description, $default, $options);
53
    $setting->set_updatedcallback('theme_reset_all_caches');
54
    $page->add($setting);
55
    $navitems = get_config('theme_universe', 'secnavitemscount');
56
    if (!$navitems) {
57
        $navitems = 1;
58
    }
59
    for ($secnavindex = 1; $secnavindex <= $navitems; $secnavindex++) {
60
        $name = 'theme_universe/hsecnavitem' . $secnavindex;
61
        $heading = get_string('hsecnavitem', 'theme_universe');
62
        $setting = new admin_setting_heading($name, '<span class="rui-admin-no">' .
63
            $secnavindex .
64
            '</span>' .
65
            $heading, format_text(get_string('hsecnavitem_desc', 'theme_universe'), FORMAT_MARKDOWN));
66
        $page->add($setting);
67
 
68
        $name = 'theme_universe/secnavcustomnavlabel' . $secnavindex;
69
        $title = get_string('secnavcustomnavlabel', 'theme_universe');
70
        $description = get_string('secnavcustomnavlabel_desc', 'theme_universe');
71
        $setting = new admin_setting_configtext($name, '<span class="rui-admin-no">' .
72
            $secnavindex .
73
            '</span>' .
74
            $title, $description, '', PARAM_TEXT);
75
        $page->add($setting);
76
 
77
        $name = 'theme_universe/secnavcustomnavurl' . $secnavindex;
78
        $title = get_string('secnavcustomnavurl', 'theme_universe');
79
        $description = get_string('secnavcustomnavurl_desc', 'theme_universe');
80
        $setting = new admin_setting_configtext($name, '<span class="rui-admin-no">' .
81
            $secnavindex .
82
            '</span>' .
83
            $title, $description, '', PARAM_TEXT);
84
        $page->add($setting);
85
 
86
        $name = 'theme_universe/secnavuserroles' . $secnavindex;
87
        $title = get_string('secnavuserroles', 'theme_universe');
88
        $description = get_string('secnavuserroles_desc', 'theme_universe');
89
        $options = [];
90
        $options[0] = get_string('all', 'moodle');
91
        $options[1] = get_string('rolemanager', 'theme_universe');
92
        $options[2] = get_string('rolecoursecreator', 'theme_universe');
93
        $options[3] = get_string('roleeditingteacher', 'theme_universe');
94
        $options[4] = get_string('rolenoneditingteacher', 'theme_universe');
95
        $options[5] = get_string('rolestudent', 'theme_universe');
96
        $options[6] = get_string('roleguest', 'theme_universe');
97
        $options[7] = get_string('roleauthenticateduser', 'theme_universe');
98
        $setting = new admin_setting_configselect($name, '<span class="rui-admin-no">' .
99
        $secnavindex .
100
        '</span>' .
101
        $title, $description, '0', $options);
102
        $page->add($setting);
103
 
104
    }
105
}
106
 
107
// Must add the page after definiting all the settings!
108
$settings->add($page);