Proyectos de Subversion Moodle

Rev

Rev 912 | Rev 1116 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
256 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
 * A two column 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
 
1115 efrain 25
echo "tmpl-incourse.php";
26
 
256 ariadna 27
defined('MOODLE_INTERNAL') || die();
28
 
29
require_once($CFG->libdir . '/behat/lib.php');
30
require_once($CFG->dirroot . '/course/lib.php');
31
 
32
$draweropenright = false;
33
$extraclasses = [];
34
 
35
// Moodle 4. - Add block button in editing mode.
36
$addblockbutton = $OUTPUT->addblockbutton();
37
if (isloggedin()) {
38
    $courseindexopen = (get_user_preferences('drawer-open-index', true) == true);
39
    $blockdraweropen = (get_user_preferences('drawer-open-block') == true);
40
} else {
41
    $courseindexopen = false;
42
    $blockdraweropen = false;
43
}
44
 
45
if (defined('BEHAT_SITE_RUNNING')) {
46
    $blockdraweropen = true;
47
}
48
 
49
$extraclasses = ['uses-drawers'];
50
// End.
51
 
52
// Dark mode.
53
if (isloggedin()) {
54
    $navdraweropen = get_user_preferences('drawer-open-nav', true);
55
    $draweropenright = (get_user_preferences('sidepre-open', 'true') == 'true');
56
 
57
    if (theme_universe_get_setting('darkmodetheme') == '1') {
58
        $darkmodeon = get_user_preferences('darkmode-on');
59
        if ($darkmodeon) {
60
            $extraclasses[] = 'theme-dark';
61
        }
62
    } else {
63
        $darkmodeon = false;
64
    }
65
} else {
66
    $navdraweropen = false;
67
}
68
 
69
if (theme_universe_get_setting('darkmodefirst') == '1') {
70
    $extraclasses[] = 'theme-dark';
71
    $darkmodetheme = false;
72
    $darkmodeon = true;
73
}
74
 
75
$siteurl = $CFG->wwwroot;
76
 
77
$blockshtml = $OUTPUT->render_statics_blocks();
78
$blockdraweropen = false;
79
 
80
if (theme_universe_get_setting('hidecourseindexnav') == true) {
81
    $hidecourseindexnav = true;
82
} else {
83
    $hidecourseindexnav = false;
84
}
85
 
86
if (theme_universe_get_setting('hidecourseindexnav') == false) {
912 ariadna 87
    $courseindex = $OUTPUT->universe_child_course_drawer();
256 ariadna 88
    if (!$courseindex) {
89
        $courseindexopen = false;
90
    }
91
    if ($courseindexopen == false) {
92
        $extraclasses[] = 'drawer-open-index--closed';
93
    } else {
94
        $extraclasses[] = 'drawer-open-index--open';
95
    }
96
} else {
97
    $courseindex = false;
98
    $courseindexopen = false;
99
}
100
 
101
$sidecourseblocks = $OUTPUT->blocks('sidecourseblocks');
102
$hassidecourseblocks = strpos($sidecourseblocks, 'data-block=') !== false;
103
 
888 ariadna 104
if ($draweropenright && $hasblocks) {
105
    $extraclasses[] = 'drawer-open-right';
106
}
107
 
886 ariadna 108
if ($PAGE->course->enablecompletion == '1') {
109
    $extraclasses[] = 'rui-course--enablecompletion';
110
}
111
 
256 ariadna 112
if ($PAGE->course->showactivitydates == '1') {
113
    $extraclasses[] = 'rui-course--showactivitydates';
114
}
115
 
116
if ($PAGE->course->visible == '1') {
117
    $extraclasses[] = 'rui-course--visible';
118
}
119
 
120
// Moodle 4.
121
$forceblockdraweropen = $OUTPUT->firstview_fakeblocks();
122
 
123
$secondarynavigation = false;
124
$overflow = '';
125
if ($PAGE->has_secondary_navigation()) {
126
    $tablistnav = $PAGE->has_tablist_secondary_navigation();
127
    $moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav);
128
    $secondarynavigation = $moremenu->export_for_template($OUTPUT);
129
    $overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
130
    if (!is_null($overflowdata)) {
131
        $overflow = $overflowdata->export_for_template($OUTPUT);
132
    }
133
}
134
 
135
$primary = new core\navigation\output\primary($PAGE);
136
$renderer = $PAGE->get_renderer('core');
137
$primarymenu = $primary->export_for_template($renderer);
138
$buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions() && !$PAGE->has_secondary_navigation();
139
// If the settings menu will be included in the header then don't add it here.
140
$regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false;
141
 
876 ariadna 142
$header = $PAGE->activityheader;
143
$headercontent = $header->export_for_template($renderer);
144
 
256 ariadna 145
// RUI.
146
$iscoursepage = true;
147
 
148
if ($hassidecourseblocks) {
149
    $extraclasses[] = 'page-has-blocks';
150
}
151
 
152
if (!isloggedin() || isguestuser()) {
153
    $isnotloggedin = true;
154
} else {
155
    $isnotloggedin = false;
156
}
157
 
158
// Check if guest user.
159
if (isguestuser()) {
160
    $extraclasses[] = 'moodle-guest-user';
161
}
162
 
163
if (theme_universe_get_setting('backtotop') == '1') {
164
    $extraclasses[] = 'back-to-top-on';
165
}
166
 
167
$bodyattributes = $OUTPUT->body_attributes($extraclasses);
168
 
169
$templatecontext = [
170
    'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
171
    'output' => $OUTPUT,
172
    'bodyattributes' => $bodyattributes,
173
    'darkmodeon' => !empty($darkmodeon),
174
    'darkmodetheme' => !empty($darkmodetheme),
175
    'siteurl' => $siteurl,
176
    'staticblocks' => $staticblocks,
177
    'sidepreblocks' => $blockshtml,
178
    'hasblocks' => true,
179
    'navdraweropen' => $navdraweropen,
180
    'draweropenright' => $draweropenright,
181
    'isnotloggedin' => $isnotloggedin,
182
    'iscoursepage' => $iscoursepage,
183
    // Moodle 4.
184
    'courseindexopen' => $courseindexopen,
185
    'blockdraweropen' => $blockdraweropen,
186
    'courseindex' => $courseindex,
187
    'primarymoremenu' => $primarymenu['moremenu'],
188
    'secondarymoremenu' => $secondarynavigation ?: false,
189
    'forceblockdraweropen' => $forceblockdraweropen,
190
    'regionmainsettingsmenu' => $regionmainsettingsmenu,
191
    'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
192
    'overflow' => $overflow,
193
    'headercontent' => $headercontent,
194
    'addblockbutton' => $addblockbutton,
195
    'hidecourseindexnav' => $hidecourseindexnav,
196
];
197
 
198
// Get and use the course page information banners HTML code, if any course page hints are configured.
199
$coursepageinformationbannershtml = theme_universe_get_course_information_banners();
200
if ($coursepageinformationbannershtml) {
201
    $templatecontext['coursepageinformationbanners'] = $coursepageinformationbannershtml;
202
}
203
// End.
204
 
205
// Load theme settings.
532 ariadna 206
$themesettings = new \theme_universe\util\theme_settings();
256 ariadna 207
 
208
$templatecontext = array_merge($templatecontext, $themesettings->global_settings());
209
 
544 ariadna 210
$PAGE->requires->js_call_amd('theme_universe/rui', 'init');
256 ariadna 211
if (theme_universe_get_setting('backtotop') == '1') {
544 ariadna 212
    $PAGE->requires->js_call_amd('theme_universe/backtotop', 'init');
256 ariadna 213
}
214
 
315 ariadna 215
echo $OUTPUT->render_from_template('theme_universe_child/tmpl-incourse', $templatecontext);