Proyectos de Subversion Moodle

Rev

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

Rev Autor Línea Nro. Línea
533 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
 
533 ariadna 26
defined('MOODLE_INTERNAL') || die();
27
 
1119 efrain 28
global $CFG, $PAGE, $OUTPUT;
29
 
533 ariadna 30
require_once($CFG->libdir . '/behat/lib.php');
31
require_once($CFG->dirroot . '/course/lib.php');
32
 
1125 efrain 33
if(!empty($PAGE->course->id)) {
1119 efrain 34
    $modules = get_fast_modinfo($PAGE->course->id)->get_cms();
35
    if(!empty($modules))
36
    foreach ($modules as $module)
37
    {
38
        if (!$module->uservisible || $module->is_stealth() || empty($module->url)) {
39
            continue;
40
        }
41
 
42
        $linkurl = new \moodle_url($module->url, array('forceview' => 1));
43
 
44
        echo 'linkurl = ' . $linkurl;
45
        exit;
46
 
47
        $attributes = [];
48
       // $nextlink = new \action_link($linkurl, $OUTPUT->rarrow(), null, $attributes);
49
    }
50
 
51
 
52
 
1120 efrain 53
 
1119 efrain 54
}
1117 efrain 55
exit;
1116 efrain 56
 
57
 
533 ariadna 58
$draweropenright = false;
59
$extraclasses = [];
60
 
61
$courseindexopen = false;
62
$blockdraweropen = false;
63
 
64
// Moodle 4. - Add block button in editing mode.
65
$addblockbutton = $OUTPUT->addblockbutton();
66
if (isloggedin()) {
67
    $courseindexopen = (get_user_preferences('drawer-open-index', true) == true);
68
    $blockdraweropen = (get_user_preferences('drawer-open-block') == true);
69
} else {
70
    $courseindexopen = false;
71
    $blockdraweropen = false;
72
}
73
 
74
if (defined('BEHAT_SITE_RUNNING')) {
75
    $blockdraweropen = true;
76
}
77
 
78
$extraclasses = ['uses-drawers'];
79
// End.
80
 
81
// Dark mode.
82
if (isloggedin()) {
83
    $navdraweropen = get_user_preferences('drawer-open-nav', true);
84
    $draweropenright = (get_user_preferences('sidepre-open', 'true') == 'true');
85
 
86
    if (theme_universe_get_setting('darkmodetheme') == '1') {
87
        $darkmodeon = get_user_preferences('darkmode-on');
88
        if ($darkmodeon) {
89
            $extraclasses[] = 'theme-dark';
90
        }
91
        $darkmodetheme = true;
92
    } else {
93
        $darkmodeon = false;
94
    }
95
} else {
96
    $navdraweropen = false;
97
}
98
 
99
if (theme_universe_get_setting('darkmodefirst') == '1') {
100
    $extraclasses[] = 'theme-dark';
101
    $darkmodetheme = false;
102
    $darkmodeon = true;
103
}
104
 
105
$siteurl = $CFG->wwwroot;
106
 
107
$blockshtml = $OUTPUT->blocks('side-pre');
108
$hasblocks = (strpos($blockshtml, 'data-block=') !== false || !empty($addblockbutton));
109
if (!$hasblocks) {
110
    $blockdraweropen = false;
111
}
112
 
113
if (theme_universe_get_setting('hidecourseindexnav') == true) {
114
    $hidecourseindexnav = true;
115
} else {
116
    $hidecourseindexnav = false;
117
}
118
 
119
if (theme_universe_get_setting('hidecourseindexnav') == false) {
120
    $courseindex = core_course_drawer();
121
    if (!$courseindex) {
122
        $courseindexopen = false;
123
    }
124
    if ($courseindexopen == false) {
125
        $extraclasses[] = 'drawer-open-index--closed';
126
    } else {
127
        $extraclasses[] = 'drawer-open-index--open';
128
    }
129
} else {
130
    $courseindex = false;
131
    $courseindexopen = false;
132
}
133
 
134
$sidecourseblocks = $OUTPUT->blocks('sidecourseblocks');
135
$hassidecourseblocks = strpos($sidecourseblocks, 'data-block=') !== false;
136
 
137
 
138
if ($draweropenright && $hasblocks) {
139
    $extraclasses[] = 'drawer-open-right';
140
}
141
 
142
$ctopbl = $OUTPUT->blocks('ctopbl');
143
$cbottombl = $OUTPUT->blocks('cbottombl');
144
$cstopbl = $OUTPUT->blocks('cstopbl');
145
$csbottombl = $OUTPUT->blocks('csbottombl');
146
$coursetab1 = $OUTPUT->blocks('coursetab-a');
147
$coursetab2 = $OUTPUT->blocks('coursetab-b');
148
$coursetab3 = $OUTPUT->blocks('coursetab-c');
149
$coursetab4 = $OUTPUT->blocks('coursetab-d');
150
$coursetab5 = $OUTPUT->blocks('coursetab-e');
151
 
152
// Moodle 4.
153
$forceblockdraweropen = $OUTPUT->firstview_fakeblocks();
154
 
155
$secondarynavigation = false;
156
$overflow = '';
157
if ($PAGE->has_secondary_navigation()) {
158
    $tablistnav = $PAGE->has_tablist_secondary_navigation();
159
    $moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav);
160
    $secondarynavigation = $moremenu->export_for_template($OUTPUT);
161
    $overflowdata = $PAGE->secondarynav->get_overflow_menu_data();
162
    if (!is_null($overflowdata)) {
163
        $overflow = $overflowdata->export_for_template($OUTPUT);
164
    }
165
}
166
 
167
$primary = new core\navigation\output\primary($PAGE);
168
$renderer = $PAGE->get_renderer('core');
169
$primarymenu = $primary->export_for_template($renderer);
170
$buildregionmainsettings = !$PAGE->include_region_main_settings_in_header_actions() && !$PAGE->has_secondary_navigation();
171
// If the settings menu will be included in the header then don't add it here.
172
$regionmainsettingsmenu = $buildregionmainsettings ? $OUTPUT->region_main_settings_menu() : false;
173
 
174
$header = $PAGE->activityheader;
175
$headercontent = $header->export_for_template($renderer);
176
 
177
// RUI.
178
$iscoursepage = true;
179
 
180
if ($hassidecourseblocks) {
181
    $extraclasses[] = 'page-has-blocks';
182
}
183
 
184
if (!isloggedin() || isguestuser()) {
185
    $isnotloggedin = true;
186
} else {
187
    $isnotloggedin = false;
188
}
189
 
190
// Check if guest user.
191
if (isguestuser()) {
192
    $extraclasses[] = 'moodle-guest-user';
193
}
194
 
195
// Start - Course Image Position (theme settings).
196
$courseimage = theme_universe_get_setting('ipcourseimage');
197
 
198
if ($hassidecourseblocks) {
199
    $extraclasses[] = 'page-has-blocks';
200
}
201
 
202
if ($PAGE->course->enablecompletion == '1') {
203
    $extraclasses[] = 'rui-course--enablecompletion';
204
}
205
 
206
if ($PAGE->course->showactivitydates == '1') {
207
    $extraclasses[] = 'rui-course--showactivitydates';
208
}
209
 
210
if ($PAGE->course->visible == '1') {
211
    $extraclasses[] = 'rui-course--visible';
212
}
213
 
214
$iscoursepage = true;
215
 
216
if (theme_universe_get_setting('backtotop') == '1') {
217
    $extraclasses[] = 'back-to-top-on';
218
}
219
 
220
$bodyattributes = $OUTPUT->body_attributes($extraclasses);
221
 
222
$templatecontext = [
223
    'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
224
    'output' => $OUTPUT,
225
    'bodyattributes' => $bodyattributes,
226
    'darkmodeon' => !empty($darkmodeon),
227
    'darkmodetheme' => !empty($darkmodetheme),
228
    'siteurl' => $siteurl,
229
    'sidepreblocks' => $blockshtml,
230
    'hasblocks' => $hasblocks,
231
    'navdraweropen' => $navdraweropen,
232
    'draweropenright' => $draweropenright,
233
    'isnotloggedin' => $isnotloggedin,
234
    'ctopbl' => $ctopbl,
235
    'cbottombl' => $cbottombl,
236
    'cstopbl' => $cstopbl,
237
    'csbottombl' => $csbottombl,
238
    'coursetab-a' => $coursetab1,
239
    'coursetab-b' => $coursetab2,
240
    'coursetab-c' => $coursetab3,
241
    'coursetab-d' => $coursetab4,
242
    'coursetab-e' => $coursetab5,
243
    'hasctopbl' => !empty($ctopbl),
244
    'hascbottombl' => !empty($cbottombl),
245
    'hascstopbl' => !empty($cstopbl),
246
    'hascsbottombl' => !empty($csbottombl),
247
    'sidecourseblocks' => $sidecourseblocks,
248
    'hassidecourseblocks' => $hassidecourseblocks,
249
    'ipcourseimage' => $courseimage,
250
    'iscoursepage' => $iscoursepage,
251
    // Moodle 4.
252
    'courseindexopen' => $courseindexopen,
253
    'blockdraweropen' => $blockdraweropen,
254
    'courseindex' => $courseindex,
255
    'primarymoremenu' => $primarymenu['moremenu'],
256
    'secondarymoremenu' => $secondarynavigation ?: false,
257
    'headercontent' => $headercontent,
258
    'forceblockdraweropen' => $forceblockdraweropen,
259
    'regionmainsettingsmenu' => $regionmainsettingsmenu,
260
    'hasregionmainsettingsmenu' => !empty($regionmainsettingsmenu),
261
    'overflow' => $overflow,
262
    'addblockbutton' => $addblockbutton,
263
    'hidecourseindexnav' => $hidecourseindexnav,
264
];
265
 
266
// Get and use the course page information banners HTML code, if any course page hints are configured.
267
$coursepageinformationbannershtml = theme_universe_get_course_information_banners();
268
if ($coursepageinformationbannershtml) {
269
    $templatecontext['coursepageinformationbanners'] = $coursepageinformationbannershtml;
270
}
271
// End.
272
 
273
// Load theme settings.
274
$themesettings = new \theme_universe\util\theme_settings();
275
 
276
$templatecontext = array_merge($templatecontext, $themesettings->global_settings());
277
$templatecontext = array_merge($templatecontext, $themesettings->course_settings());
278
 
544 ariadna 279
$PAGE->requires->js_call_amd('theme_universe/rui', 'init');
533 ariadna 280
if (theme_universe_get_setting('backtotop') == '1') {
544 ariadna 281
    $PAGE->requires->js_call_amd('theme_universe/backtotop', 'init');
533 ariadna 282
}
283
 
284
echo $OUTPUT->render_from_template('theme_universe_child/tmpl-course', $templatecontext);