Proyectos de Subversion Moodle

Rev

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

Rev Autor Línea Nro. Línea
1 efrain 1
{{!
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
    Context variables required for this template:
19
    * sitename - The name of the site
20
    * output - The core renderer for the page
21
    * bodyattributes - attributes for the body tag as a string of html attributes
22
    * sidepreblocks - HTML for the blocks
23
    * hasblocks - true if there are blocks on this page
24
    * navdraweropen - true if the nav drawer should be open on page load
25
    * regionmainsettingsmenu - HTML for the region main settings menu
26
    * hasregionmainsettingsmenu - There is a region main settings menu on this page.
27
 
28
    Example context (json):
29
    {
30
        "sitename": "Moodle",
31
        "output": {
32
            "doctype": "<!DOCTYPE html>",
33
            "page_title": "Test page",
34
            "favicon": "favicon.ico",
35
            "main_content": "<h1>Headings make html validators happier</h1>"
36
         },
37
        "bodyattributes":"",
38
        "sidepreblocks": "<h2>Blocks html goes here</h2>",
39
        "hasblocks":true,
40
        "navdraweropen":true,
41
        "regionmainsettingsmenu": "",
42
        "hasregionmainsettingsmenu": false
43
    }
44
}}
45
{{> theme_universe/head }}
46
 
47
<body {{{ bodyattributes }}}>
48
{{> core/local/toast/wrapper}}
49
 
50
<div id="page-wrapper" class="d-print-block {{#output.courseheadermenu}}rui--course-with-nav{{/output.courseheadermenu}} {{^output.courseheadermenu}}rui--course-witout-nav{{/output.courseheadermenu}}">
51
 
52
    {{{ output.standard_top_of_body_html }}}
53
 
910 ariadna 54
        {{{output.cesa_navigation_course_menu_lateral_output}}}
55
 
1 efrain 56
        {{^hidecourseindexnav}}
57
        {{#courseindex}}
910 ariadna 58
            {{< theme_universe_child/drawer }}
904 ariadna 59
                {{$id}}universe-drawers-courseindex{{/id}}
60
                {{$drawerheadercontent}}
61
                    {{> theme_universe/courseindexdrawercontrols}}
62
                {{/drawerheadercontent}}
63
                {{$drawerclasses}}drawer drawer-left {{#courseindexopen}}show{{/courseindexopen}}{{/drawerclasses}}
64
                {{$drawercontent}}
65
                    {{{ output.display_course_progress }}}
66
                    {{{courseindex}}}
67
                {{/drawercontent}}
68
                {{$drawerpreferencename}}drawer-open-index{{/drawerpreferencename}}
69
                {{$drawerstate}}show-drawer-left{{/drawerstate}}
70
                {{$tooltipplacement}}right{{/tooltipplacement}}
71
                {{$drawercloseonresize}}1{{/drawercloseonresize}}
72
                {{$closebuttontext}}{{#str}}closecourseindex, core{{/str}}{{/closebuttontext}}
910 ariadna 73
            {{/ theme_universe_child/drawer}}
1 efrain 74
        {{/courseindex}}
75
        {{/hidecourseindexnav}}
76
 
520 ariadna 77
    {{> theme_universe_child/navbar }}
1 efrain 78
    <div id="page" data-region="mainpage" data-usertour="scroller" class="drawers {{#topbarcustomhtml}}topbar--ext{{/topbarcustomhtml}} {{#courseindexopen}}show-drawer-left{{/courseindexopen}} {{#blockdraweropen}}show-hidden-drawer show-drawer-right{{/blockdraweropen}} drag-container">
79
 
80
        <div id="topofscroll" class="main-inner">
81
            <div id="page-content" class="page-content wrapper-fw">
82
 
83
                <div class="drawer-toggles d-flex">
84
                    {{#courseindex}}
85
                        <div class="drawer-toggler drawer-left-toggle open-nav d-print-none">
86
                            <button
87
                                class="btn-drawer btn-drawer--left drawertoggle"
88
                                data-toggler="drawers"
89
                                data-action="toggle"
90
                                data-target="universe-drawers-courseindex"
91
                                data-toggle="tooltip"
92
                                data-placement="right"
93
                                title="{{#str}}opendrawerindex, core{{/str}}"
94
                            >
95
                                <span class="sr-only">{{#str}}opendrawerindex, core{{/str}}</span>
96
                                <svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M2 5.99519C2 5.44556 2.44556 5 2.99519 5H11.0048C11.5544 5 12 5.44556 12 5.99519C12 6.54482 11.5544 6.99039 11.0048 6.99039H2.99519C2.44556 6.99039 2 6.54482 2 5.99519Z" fill="currentColor" /><path d="M2 11.9998C2 11.4501 2.44556 11.0046 2.99519 11.0046H21.0048C21.5544 11.0046 22 11.4501 22 11.9998C22 12.5494 21.5544 12.9949 21.0048 12.9949H2.99519C2.44556 12.9949 2 12.5494 2 11.9998Z" fill="currentColor" /><path d="M2.99519 17.0096C2.44556 17.0096 2 17.4552 2 18.0048C2 18.5544 2.44556 19 2.99519 19H15.0048C15.5544 19 16 18.5544 16 18.0048C16 17.4552 15.5544 17.0096 15.0048 17.0096H2.99519Z" fill="currentColor" /></svg>
97
                            </button>
98
                        </div>
99
                    {{/courseindex}}
100
 
101
                </div>
102
 
103
                <div id="region-main-box" class="region-main-course-wrapper">
104
 
105
                    <section id="region-main" aria-label="{{#str}}content{{/str}}">
106
                        <div class="wrapper-fw">
107
                            {{{ output.simple_header }}}
108
                        </div>
109
                        <div class="wrapper-fw">
743 ariadna 110
 
880 ariadna 111
                            {{{ output.main_content }}}
112
 
113
                        </div>
114
                        {{#headercontent}}
889 ariadna 115
                            {{> core/activity_header }}
883 ariadna 116
                        {{/headercontent}}
888 ariadna 117
 
891 ariadna 118
                        {{{ output.activity_navigation }}}
119
 
1 efrain 120
                        <div class="rui-blocks-wrapper wrapper--with-margin wrapper-xl">
121
 
122
                            <div class="wrapper-page-withblocks">
148 ariadna 123
                                {{#hasblocks}}
910 ariadna 124
                                    {{< theme_universe_child/drawer }}
1 efrain 125
                                        {{$id}}universe-drawers-blocks{{/id}}
126
                                        {{$drawerclasses}}drawer drawer-right{{#blockdraweropen}} show{{/blockdraweropen}}{{/drawerclasses}}
127
                                        {{$drawercontent}}
695 ariadna 128
                                        <div class="card text-center incourse-menu">
1 efrain 129
                                                <div class="card-header">
130
                                                    <div class="nav btn-group d-inline-flex mx-auto" id="blocks_buttons"></div>
131
                                                </div>
132
                                                <div class="card-body">
336 ariadna 133
                                                    <section class="d-print-none block-region" aria-label="{{#str}}blocks{{/str}}">
148 ariadna 134
                                                        {{{ sidepreblocks }}}
1 efrain 135
                                                    </section>
136
                                                </div>
137
                                        </div>
138
                                        {{/drawercontent}}
139
                                        {{$drawerpreferencename}}drawer-open-block{{/drawerpreferencename}}
140
                                        {{$forceopen}}{{#forceblockdraweropen}}1{{/forceblockdraweropen}}{{/forceopen}}
141
                                        {{$drawerstate}}show-drawer-right{{/drawerstate}}
142
                                        {{$tooltipplacement}}left{{/tooltipplacement}}
143
                                        {{$drawercloseonresize}}1{{/drawercloseonresize}}
144
                                        {{$closebuttontext}}{{#str}}closeblockdrawer, core{{/str}}{{/closebuttontext}}
910 ariadna 145
                                    {{/ theme_universe_child/drawer}}
1 efrain 146
 
148 ariadna 147
                                {{/hasblocks}}
1 efrain 148
                        </div>
149
                    </section>
150
                </div>
151
            </div>
152
        </div>
153
        {{> theme_universe/footer }}
154
    </div>
842 ariadna 155
 
1 efrain 156
    {{{ output.standard_after_main_region_html }}}
157
 
158
</div>
159
 
160
</body>
161
</html>
162
{{#js}}
910 ariadna 163
M.util.js_pending('theme_universe_child/loader');
164
require(['theme_universe_child/loader', 'theme_universe_child/drawer', 'jquery'], function(Loader, Drawer, $) {
1 efrain 165
    Drawer.init();
910 ariadna 166
    M.util.js_complete('theme_universe_child/loader');
1 efrain 167
 
594 ariadna 168
    function resizeVideoIframe(){
169
         // Seleccionamos el iframe
170
        const $iframe = $('iframe');
1 efrain 171
 
594 ariadna 172
        // Verificamos si el iframe existe
173
        if ($iframe.length) {
174
            // Obtenemos el contenido del iframe
175
            const $iframeContents = $iframe.contents();
176
 
177
            // Seleccionamos el primer contenedor de vídeo H5P dentro del contenido del iframe
178
            const $h5pVideoWrapper = $iframeContents.find('.h5p-video').first();
179
 
180
            // Verificamos si el contenedor del vídeo H5P existe
181
            if ($h5pVideoWrapper.length) {
182
                // Seleccionamos el primer vídeo con la clase 'h5p-video' dentro del contenedor
183
                const $h5Video = $h5pVideoWrapper.find('video.h5p-video').first();
184
 
185
                // Verificamos si el vídeo existe
186
                if ($h5Video.length) {
187
                    // Aplicamos el estilo CSS al vídeo
188
                    $h5Video.css("height", "93vh");
189
                }
190
            }
191
        }
192
    }
193
 
1 efrain 194
    function renderBlockButtons(){
195
        const buttonsContainer = $("#blocks_buttons");
196
        const blocksContainer = $(".block-region");
197
        const blocks = blocksContainer.find("section.block").toArray();
198
 
199
        $(blocksContainer).addClass("tab-content")
200
 
201
        const blocksObjs = []
202
 
203
        $(blocks).each((index, block) => {
204
            const blckId = $(block).attr("id").trim()
205
            const blckTitle = $(block).find(".card-title").text()
206
 
207
            $(block).addClass("tab-pane fade")
208
            if(index === 0) $(block).addClass("active show")
209
 
210
            const blckObj = { id: blckId, title: blckTitle }
211
 
212
            blocksObjs.push(blckObj)
213
        })
214
 
215
        blocksObjs.forEach(({ id, title }, index)=> {
216
            const blockBtn = `
217
                <button class="btn nav-link ${index === 0 ? 'active' : ''}" data-toggle="tab" data-target="#${id}" type="button" role="tab" aria-controls="nav-home" aria-selected="true">${title}</button>
218
            `
219
 
220
            buttonsContainer.append(blockBtn)
221
        })
222
    }
223
 
594 ariadna 224
    resizeVideoIframe()
1 efrain 225
    renderBlockButtons()
226
});
227
{{/js}}