Proyectos de Subversion Moodle

Rev

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