Proyectos de Subversion Moodle

Rev

| 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
    @template unilabeltype_courseteaser/carousel
19
    Template to show a bootstrap modal dialog.
20
 
21
    Example context (json):
22
    {
23
        "showintro": false,
24
        "intro": "",
25
        "interval": "5",
26
        "height": 300,
27
        "fontawesomeprev": "fa-solid fa-forward",
28
        "fontawesomenext": "fa-solid fa-forward",
29
        "items": [
30
            {
31
                "courseid": "3",
32
                "courseurl": "url-to-course",
33
                "title": "TEST copy 1",
34
                "nr": 0,
35
                "first": true
36
            },
37
            {
38
                "courseid": "2",
39
                "courseurl": "url-to-course",
40
                "title": "TEST",
41
                "nr": 1
42
            }
43
        ],
44
        "hasitems": true,
45
        "custombuttons": true,
46
        "cssjsonstring": "'css-selector {overflow: hidden;}'",
47
        "cmid": "55"
48
    }
49
}}
50
 
51
{{#showintro}}
52
    {{{intro}}}
53
{{/showintro}}
54
{{#hasitems}}
55
    <div id="{{plugin}}-{{uniqid}}" class="{{plugin}} carousel slide my-2" data-ride="carousel" data-interval="{{#interval}}{{.}}000{{/interval}}{{^interval}}false{{/interval}}">
56
 
57
        <!-- Indicators -->
58
        <ul class="carousel-indicators">
59
            {{#items}}
60
                <li data-target="#{{plugin}}-{{uniqid}}" data-slide-to="{{nr}}"{{#first}} class="active"{{/first}}></li>
61
            {{/items}}
62
        </ul>
63
 
64
        <!-- The slideshow -->
65
        <div class="carousel-inner">
66
            {{#items}}
67
                <div class="carousel-item text-center py-4{{#first}} active{{/first}}">
68
                    <a href="{{{courseurl}}}" class="d-block py-3">
69
                        {{#imageurl}}
70
                        <div style="width:100%;">
71
                            <img class="img-fluid" src="{{{imageurl}}}" style="height:100%;object-fit:contain;"/>
72
                        </div>
73
                        {{/imageurl}}
74
                    </a>
75
 
76
                    {{> unilabeltype_courseteaser/carousel_caption }}
77
 
78
                </div>
79
            {{/items}}
80
        </div>
81
 
82
        <!-- Left and right controls -->
83
        {{< unilabeltype_courseteaser/carousel_control}}{{!
84
            }} {{$direction}}next{{/direction}}{{!
85
            }} {{$icon}}{{#fontawesomenext}}{{.}}{{/fontawesomenext}}{{^fontawesomenext}}d-none{{/fontawesomenext}}{{/icon}}{{!
86
            }} {{/ unilabeltype_courseteaser/carousel_control}}
87
        {{< unilabeltype_courseteaser/carousel_control}}{{!
88
            }} {{$direction}}prev{{/direction}}{{!
89
            }} {{$icon}}{{#fontawesomeprev}}{{.}}{{/fontawesomeprev}}{{^fontawesomeprev}}d-none{{/fontawesomeprev}}{{/icon}}{{!
90
            }} {{/ unilabeltype_courseteaser/carousel_control}}
91
    </div>
92
{{/hasitems}}
93
{{^hasitems}}
94
    <span>{{#str}} nocontent , unilabeltype_courseteaser {{/str}}</span>
95
{{/hasitems}}
96
{{#js}}
97
    require(['theme_boost/loader']);
98
    require(['theme_boost/bootstrap/carousel']);
99
    {{#interval}}
100
    require(['mod_unilabel/carouselstart'], function(mod) {
101
        mod.init('{{plugin}}-{{uniqid}}');
102
    });
103
    {{/interval}}
104
 
105
    {{#hasitems}}
106
        {{#custombuttons}}
107
            require(['mod_unilabel/add_css'], function(mod) {
108
                // To make sure we have clean html we have to put the css into the <head> by using javascript.
109
                mod.init({{{cssjsonstring}}});
110
            });
111
        {{/custombuttons}}
112
    {{/hasitems}}
113
 
114
{{/js}}