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_topicteaser/carousel
|
|
|
19 |
Template to show a bootstrap modal dialog.
|
|
|
20 |
|
|
|
21 |
Example context (json):
|
|
|
22 |
{
|
|
|
23 |
"title": "TEST copy 1",
|
|
|
24 |
"showintro": false,
|
|
|
25 |
"intro": "",
|
|
|
26 |
"interval": "5",
|
|
|
27 |
"height": 300,
|
|
|
28 |
"fontawesomeprev": "fa-solid fa-forward",
|
|
|
29 |
"fontawesomenext": "fa-solid fa-forward",
|
|
|
30 |
"items": [
|
|
|
31 |
{
|
|
|
32 |
"name": "Topic 1",
|
|
|
33 |
"section": "1",
|
|
|
34 |
"viewurl": "https://url-to-view",
|
|
|
35 |
"summary": "",
|
|
|
36 |
"cmlist": "<ul class=\"section img-text\"><\/ul>",
|
|
|
37 |
"nr": 0,
|
|
|
38 |
"first": true
|
|
|
39 |
},
|
|
|
40 |
{
|
|
|
41 |
"name": "Topic 2",
|
|
|
42 |
"section": "2",
|
|
|
43 |
"viewurl": "https://url-to-view",
|
|
|
44 |
"summary": "",
|
|
|
45 |
"cmlist": "<ul class=\"section img-text\"><\/ul>",
|
|
|
46 |
"nr": 1
|
|
|
47 |
},
|
|
|
48 |
{
|
|
|
49 |
"name": "Topic 3",
|
|
|
50 |
"section": "3",
|
|
|
51 |
"viewurl": "https://url-to-view",
|
|
|
52 |
"summary": "",
|
|
|
53 |
"cmlist": "<ul class=\"section img-text\"><\/ul>",
|
|
|
54 |
"nr": 2
|
|
|
55 |
},
|
|
|
56 |
{
|
|
|
57 |
"name": "Topic 4",
|
|
|
58 |
"section": "4",
|
|
|
59 |
"viewurl": "https://url-to-view",
|
|
|
60 |
"summary": "",
|
|
|
61 |
"cmlist": "<ul class=\"section img-text\"><\/ul>",
|
|
|
62 |
"nr": 3
|
|
|
63 |
}
|
|
|
64 |
],
|
|
|
65 |
"hasitems": true,
|
|
|
66 |
"custombuttons": true,
|
|
|
67 |
"cssjsonstring": "'css-selector {overflow: hidden;}'",
|
|
|
68 |
"openmodal": true,
|
|
|
69 |
"opencourseurl": false,
|
|
|
70 |
"cmid": "55"
|
|
|
71 |
}
|
|
|
72 |
}}
|
|
|
73 |
|
|
|
74 |
{{> unilabeltype_topicteaser/intro }}
|
|
|
75 |
{{#hasitems}}
|
|
|
76 |
<div id="{{plugin}}-{{cmid}}" class="{{plugin}} carousel slide my-2" data-ride="carousel" data-interval="{{#interval}}{{.}}000{{/interval}}{{^interval}}false{{/interval}}">
|
|
|
77 |
|
|
|
78 |
<!-- Indicators -->
|
|
|
79 |
<ul class="carousel-indicators" style="z-index:999;">
|
|
|
80 |
{{#items}}
|
|
|
81 |
<li data-target="#{{plugin}}-{{cmid}}" data-slide-to="{{nr}}"{{#first}} class="active"{{/first}}></li>
|
|
|
82 |
{{/items}}
|
|
|
83 |
</ul>
|
|
|
84 |
|
|
|
85 |
<!-- The slideshow -->
|
|
|
86 |
<div class="carousel-inner">
|
|
|
87 |
{{#items}}
|
|
|
88 |
<div class="carousel-item text-center py-4{{#first}} active{{/first}}">
|
|
|
89 |
<!-- The overlay is used as button to show the modal dialog -->
|
|
|
90 |
<a href="{{{viewurl}}}"{{#openmodal}} data-toggle="modal" data-target="#topicteaser-modal-{{cmid}}-{{nr}}"{{/openmodal}}>
|
|
|
91 |
<div class="unilabel-overlay-effect bg-primary h-100 w-100"></div>
|
|
|
92 |
</a>
|
|
|
93 |
<h3>{{name}}</h3>
|
|
|
94 |
{{{summary}}}
|
|
|
95 |
</div>
|
|
|
96 |
{{/items}}
|
|
|
97 |
</div>
|
|
|
98 |
|
|
|
99 |
<!-- Left and right controls -->
|
|
|
100 |
{{< unilabeltype_topicteaser/carousel_control}}{{!
|
|
|
101 |
}} {{$direction}}next{{/direction}}{{!
|
|
|
102 |
}} {{$icon}}{{#fontawesomenext}}{{.}}{{/fontawesomenext}}{{^fontawesomenext}}d-none{{/fontawesomenext}}{{/icon}}{{!
|
|
|
103 |
}} {{/ unilabeltype_topicteaser/carousel_control}}
|
|
|
104 |
{{< unilabeltype_topicteaser/carousel_control}}{{!
|
|
|
105 |
}} {{$direction}}prev{{/direction}}{{!
|
|
|
106 |
}} {{$icon}}{{#fontawesomeprev}}{{.}}{{/fontawesomeprev}}{{^fontawesomeprev}}d-none{{/fontawesomeprev}}{{/icon}}{{!
|
|
|
107 |
}} {{/ unilabeltype_topicteaser/carousel_control}}
|
|
|
108 |
</div>
|
|
|
109 |
|
|
|
110 |
{{#openmodal}}
|
|
|
111 |
{{#items}}
|
|
|
112 |
{{> unilabeltype_topicteaser/dialog }}
|
|
|
113 |
{{/items}}
|
|
|
114 |
{{/openmodal}}
|
|
|
115 |
{{/hasitems}}
|
|
|
116 |
|
|
|
117 |
{{^hasitems}}
|
|
|
118 |
<span>{{#str}} nocontent , unilabeltype_topicteaser {{/str}}</span>
|
|
|
119 |
{{/hasitems}}
|
|
|
120 |
{{#js}}
|
|
|
121 |
require(['theme_boost/loader']);
|
|
|
122 |
require(['theme_boost/bootstrap/carousel']);
|
|
|
123 |
{{#interval}}
|
|
|
124 |
require(['mod_unilabel/carouselstart'], function(mod) {
|
|
|
125 |
mod.init('{{plugin}}-{{cmid}}');
|
|
|
126 |
});
|
|
|
127 |
{{/interval}}
|
|
|
128 |
|
|
|
129 |
{{#hasitems}}
|
|
|
130 |
{{#custombuttons}}
|
|
|
131 |
require(['mod_unilabel/add_css'], function(mod) {
|
|
|
132 |
// To make sure we have clean html we have to put the css into the <head> by using javascript.
|
|
|
133 |
mod.init({{{cssjsonstring}}});
|
|
|
134 |
});
|
|
|
135 |
{{/custombuttons}}
|
|
|
136 |
{{/hasitems}}
|
|
|
137 |
|
|
|
138 |
{{/js}}
|