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_imageboard/imageboard
|
|
|
19 |
Template to show an imageboard with images.
|
|
|
20 |
|
|
|
21 |
Example context (json):
|
|
|
22 |
{
|
|
|
23 |
"showintro": false,
|
|
|
24 |
"intro": "",
|
|
|
25 |
"images": [
|
|
|
26 |
{
|
|
|
27 |
"title": "",
|
|
|
28 |
"url": "http://localhost/mod/forum/view.php?id=136",
|
|
|
29 |
"newwindow": 1,
|
|
|
30 |
"xposition": "150",
|
|
|
31 |
"yposition": "100",
|
|
|
32 |
"targetwidth": "80",
|
|
|
33 |
"targetheight": "0",
|
|
|
34 |
"fontsize": "12",
|
|
|
35 |
"imageurl": "http://localhost/image1.png",
|
|
|
36 |
"nr": 0
|
|
|
37 |
},
|
|
|
38 |
{
|
|
|
39 |
"title": "",
|
|
|
40 |
"url": "",
|
|
|
41 |
"newwindow": 1,
|
|
|
42 |
"xposition": "400",
|
|
|
43 |
"yposition": "200",
|
|
|
44 |
"targetwidth": "0",
|
|
|
45 |
"targetheight": "0",
|
|
|
46 |
"fontsize": "12",
|
|
|
47 |
"imageurl": "http://localhost/image2.png",
|
|
|
48 |
"nr": 1
|
|
|
49 |
}
|
|
|
50 |
],
|
|
|
51 |
"hasimages": true,
|
|
|
52 |
"titlecolor": "#00ff00",
|
|
|
53 |
"titlebackgroundcolor": "#0000ff",
|
|
|
54 |
"cmid": "140",
|
|
|
55 |
"canvaswidth": "500",
|
|
|
56 |
"autoscale": false,
|
|
|
57 |
"canvasheight": "600",
|
|
|
58 |
"autocanvasheight": false,
|
|
|
59 |
"backgroundimage": "",
|
|
|
60 |
"capababilityforgrid": true,
|
|
|
61 |
"bordercolor": "#2D57FA",
|
|
|
62 |
"border": "4",
|
|
|
63 |
"gridcolor": "#B7009E"
|
|
|
64 |
}
|
|
|
65 |
}}
|
|
|
66 |
<div id="unilabeltype-imageboard-container-{{cmid}}" class="unilabeltype-imageboard-container">
|
|
|
67 |
{{#showintro}}
|
|
|
68 |
{{{intro}}}
|
|
|
69 |
{{/showintro}}
|
|
|
70 |
|
|
|
71 |
<div id="unilabeltype-imageboard-{{cmid}}"
|
|
|
72 |
class="unilabeltype-imageboard"
|
|
|
73 |
style="position: relative;
|
|
|
74 |
background: url('{{backgroundimage}}');
|
|
|
75 |
width: {{canvaswidth}}px;
|
|
|
76 |
height: {{canvasheight}}px;
|
|
|
77 |
background-size: cover;">
|
|
|
78 |
{{#images}}
|
|
|
79 |
{{> unilabeltype_imageboard/image }}
|
|
|
80 |
{{/images}}
|
|
|
81 |
|
|
|
82 |
{{#capababilityforgrid}}
|
|
|
83 |
{{> unilabeltype_imageboard/imagegrid }}
|
|
|
84 |
{{/capababilityforgrid}}
|
|
|
85 |
|
|
|
86 |
</div>
|
|
|
87 |
|
|
|
88 |
<!-- List the used images or text -->
|
|
|
89 |
|
|
|
90 |
<div class="unilabeltype-imageboard-controllbuttons d-flex flex-column mt-2">
|
|
|
91 |
{{#capababilityforgrid}}
|
|
|
92 |
<div class="unilabel-imageboard-gridtoggler">
|
|
|
93 |
<a class="unilabeltype-imageboard-controllbutton" href="#" id="unilabeltype-imageboard-gridtoggler-{{cmid}}">
|
|
|
94 |
<i class="fa fa-th fa-fw"></i> <span class="unilabeltype-imageboard-toggle-text">{{#str}} buttonlabelhelpergridshow, unilabeltype_imageboard {{/str}}</span>
|
|
|
95 |
</a>
|
|
|
96 |
</div>
|
|
|
97 |
{{/capababilityforgrid}}
|
|
|
98 |
{{#hasimages}}
|
|
|
99 |
{{> unilabeltype_imageboard/imagelist }}
|
|
|
100 |
{{/hasimages}}
|
|
|
101 |
</div>
|
|
|
102 |
</div>
|
|
|
103 |
{{#js}}
|
|
|
104 |
require(['unilabeltype_imageboard/imageboardrenderer'], function(imageboardrenderer) {
|
|
|
105 |
imageboardrenderer.init(
|
|
|
106 |
{{cmid}},
|
|
|
107 |
{{canvaswidth}},
|
|
|
108 |
{{canvasheight}},
|
|
|
109 |
{{#autoscale}}true{{/autoscale}}{{^autoscale}}false{{/autoscale}},
|
|
|
110 |
{{#editing}}true{{/editing}}{{^editing}}false{{/editing}}
|
|
|
111 |
);
|
|
|
112 |
});
|
|
|
113 |
{{/js}}
|