Proyectos de Subversion Moodle

Rev

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