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
 * A secure layout for the universe theme.
19
 *
20
 * @package   theme_universe
21
 * @copyright 2023 Marcin Czaja (https://rosea.io)
22
 * @license   Commercial https://themeforest.net/licenses
23
 */
24
 
25
defined('MOODLE_INTERNAL') || die();
26
 
27
$extraclasses = [];
28
 
29
// Dark mode.
30
if (isloggedin()) {
31
    $navdraweropen = (get_user_preferences('drawer-open-nav', 'true') == 'true');
32
    $draweropenright = (get_user_preferences('sidepre-open', 'true') == 'true');
33
 
34
    if (theme_universe_get_setting('darkmodetheme') == '1') {
35
        $darkmodeon = get_user_preferences('darkmode-on');
36
        if ($darkmodeon) {
37
            $extraclasses[] = 'theme-dark';
38
        }
39
    } else {
40
        $darkmodeon = false;
41
    }
42
} else {
43
    $navdraweropen = false;
44
}
45
 
46
if (theme_universe_get_setting('darkmodefirst') == '1') {
47
    $extraclasses[] = 'theme-dark';
48
    $darkmodetheme = false;
49
}
50
 
51
$blockshtml = $OUTPUT->blocks('side-pre');
52
$hasblocks = strpos($blockshtml, 'data-block=') !== false;
53
$bodyattributes = $OUTPUT->body_attributes();
54
$siteurl = $CFG->wwwroot;
55
 
56
if (theme_universe_get_setting('backtotop') == '1') {
57
    $extraclasses[] = 'back-to-top-on';
58
}
59
 
60
$bodyattributes = $OUTPUT->body_attributes($extraclasses);
61
 
62
$templatecontext = [
63
    'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
64
    'output' => $OUTPUT,
65
    'sidepreblocks' => $blockshtml,
66
    'hasblocks' => $hasblocks,
67
    'bodyattributes' => $bodyattributes,
68
    'draweropenright' => $draweropenright,
69
    'darkmodeon' => !empty($darkmodeon),
70
    'darkmodetheme' => !empty($darkmodetheme),
71
    'navdraweropen' => $navdraweropen,
72
    'siteurl' => $siteurl
73
];
74
 
75
// Load theme settings.
76
$themesettings = new \theme_universe\util\theme_settings();
77
$templatecontext = array_merge($templatecontext, $themesettings->global_settings());
78
 
79
$PAGE->requires->js_call_amd('theme_universe/rui', 'init');
80
if (theme_universe_get_setting('backtotop') == '1') {
81
    $PAGE->requires->js_call_amd('theme_universe/backtotop', 'init');
82
}
83
 
84
echo $OUTPUT->render_from_template('theme_universe/secure', $templatecontext);