Proyectos de Subversion Moodle

Rev

Rev 1278 | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

{{!
    This file is part of Moodle - http://moodle.org/

    Moodle is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Moodle is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
}}
{{!
    Context variables required for this template:
    * sitename - The name of the site
    * output - The core renderer for the page
    * bodyattributes - attributes for the body tag as a string of html attributes
    * sidepreblocks - HTML for the blocks
    * hasblocks - true if there are blocks on this page
    * navdraweropen - true if the nav drawer should be open on page load
    * regionmainsettingsmenu - HTML for the region main settings menu
    * hasregionmainsettingsmenu - There is a region main settings menu on this page.

    Example context (json):
    {
        "sitename": "Moodle",
        "output": {
            "doctype": "<!DOCTYPE html>",
            "page_title": "Test page",
            "favicon": "favicon.ico",
            "main_content": "<h1>Headings make html validators happier</h1>"
         },
        "bodyattributes":"",
        "sidepreblocks": "<h2>Blocks html goes here</h2>",
        "hasblocks":true,
        "navdraweropen":true,
        "regionmainsettingsmenu": "",
        "hasregionmainsettingsmenu": false
    }
}}
{{> theme_universe/head }}

<body {{{ bodyattributes }}}>
{{> core/local/toast/wrapper}}

<div id="page-wrapper" class="d-print-block {{#output.courseheadermenu}}rui--course-with-nav{{/output.courseheadermenu}} {{^output.courseheadermenu}}rui--course-witout-nav{{/output.courseheadermenu}}">

    {{{ output.standard_top_of_body_html }}}

    {{{ output.cesa_navigation_course_menu_lateral_output }}}
    
    {{> theme_universe_child/navbar }}
    <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">
        
        <div id="topofscroll" class="main-inner">
            <div id="page-content" class="page-content wrapper-fw">

                <div class="drawer-toggles d-flex">
                    {{#courseindex}}
                        <div class="drawer-toggler drawer-left-toggle open-nav d-print-none">
                            <button
                                class="btn-drawer btn-drawer--left drawertoggle"
                                data-toggler="drawers"
                                data-action="toggle"
                                data-target="universe-drawers-courseindex"
                                data-toggle="tooltip"
                                data-placement="right"
                                title="{{#str}}opendrawerindex, core{{/str}}"
                            >
                                <span class="sr-only">{{#str}}opendrawerindex, core{{/str}}</span>
                                <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>
                            </button>
                        </div>
                    {{/courseindex}}
                    
                </div>

                <div id="region-main-box" class="region-main-course-wrapper">

                    <section id="region-main" aria-label="{{#str}}content{{/str}}">
                        <div class="wrapper-fw"> 
                            {{{ output.simple_header }}}
                        </div>
                        <div class="wrapper-fw">
                            
                            {{{ output.main_content }}}  
                        
                        </div>
                        {{#secondarymoremenu}}
                            <div class="secondary-navigation d-print-none">
                                {{> core/moremenu}}
                            </div>
                        {{/secondarymoremenu}} 
                        {{#headercontent}}
                            {{> core/activity_header }}
                        {{/headercontent}}
                        
                        {{{ output.activity_navigation }}}
                        
                        <div class="rui-blocks-wrapper wrapper--with-margin wrapper-xl">
                                
                            <div class="wrapper-page-withblocks">
                                {{#hasblocks}}
                                    {{< theme_universe/drawer }}
                                        {{$id}}universe-drawers-blocks{{/id}}
                                        {{$drawerclasses}}drawer drawer-right{{#blockdraweropen}} show{{/blockdraweropen}}{{/drawerclasses}}
                                        {{$drawercontent}}
                                        <div class="card text-center incourse-menu">
                                                <div class="card-header">
                                                    <div class="nav btn-group d-inline-flex mx-auto" id="blocks_buttons"></div>
                                                </div>
                                                <div class="card-body">
                                                    <section class="d-print-none block-region" aria-label="{{#str}}blocks{{/str}}">
                                                        {{{ sidepreblocks }}}
                                                    </section>
                                                </div>
                                        </div>
                                        {{/drawercontent}}
                                        {{$drawerpreferencename}}drawer-open-block{{/drawerpreferencename}}
                                        {{$forceopen}}{{#forceblockdraweropen}}1{{/forceblockdraweropen}}{{/forceopen}}
                                        {{$drawerstate}}show-drawer-right{{/drawerstate}}
                                        {{$tooltipplacement}}left{{/tooltipplacement}}
                                        {{$drawercloseonresize}}1{{/drawercloseonresize}}
                                        {{$closebuttontext}}{{#str}}closeblockdrawer, core{{/str}}{{/closebuttontext}}
                                    {{/ theme_universe/drawer}}
                                            
                                {{/hasblocks}}
                        </div>
                    </section>
                </div>
            </div>
        </div>
        {{> theme_universe/footer }}
    </div>
       
    {{{ output.standard_after_main_region_html }}}
    
</div>

</body>
</html>
{{#js}}
M.util.js_pending('theme_universe/loader');
require(['theme_universe/loader', 'theme_universe/drawer', 'jquery'], function(Loader, Drawer, $) {
    Drawer.init();
    M.util.js_complete('theme_universe/loader');

    function resizeVideoIframe(){
         // Seleccionamos el iframe
        const $iframe = $('iframe');

        // Verificamos si el iframe existe
        if ($iframe.length) {
            // Obtenemos el contenido del iframe
            const $iframeContents = $iframe.contents();

            // Seleccionamos el primer contenedor de vídeo H5P dentro del contenido del iframe
            const $h5pVideoWrapper = $iframeContents.find('.h5p-video').first();

            // Verificamos si el contenedor del vídeo H5P existe
            if ($h5pVideoWrapper.length) {
                // Seleccionamos el primer vídeo con la clase 'h5p-video' dentro del contenedor
                const $h5Video = $h5pVideoWrapper.find('video.h5p-video').first();

                // Verificamos si el vídeo existe
                if ($h5Video.length) {
                    // Aplicamos el estilo CSS al vídeo
                    $h5Video.css("height", "93vh");
                }
            }
        }
    }

    function renderBlockButtons(){
        const buttonsContainer = $("#blocks_buttons");
        const blocksContainer = $(".block-region");
        const blocks = blocksContainer.find("section.block").toArray();

        $(blocksContainer).addClass("tab-content")

        const blocksObjs = []

        $(blocks).each((index, block) => {
            const blckId = $(block).attr("id").trim()
            const blckTitle = $(block).find(".card-title").text()

            $(block).addClass("tab-pane fade")
            if(index === 0) $(block).addClass("active show")

            const blckObj = { id: blckId, title: blckTitle }

            blocksObjs.push(blckObj)
        })

        blocksObjs.forEach(({ id, title }, index)=> {
            const blockBtn = `
                <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>
            ` 

            buttonsContainer.append(blockBtn)
        })
    }

    resizeVideoIframe()
    renderBlockButtons()
});
{{/js}}