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 mod_lti/tool_proxy_card
|
|
|
19 |
|
|
|
20 |
This template provides the layout for a single tool card on the tool
|
|
|
21 |
configuration page.
|
|
|
22 |
|
|
|
23 |
Classes required for JS:
|
|
|
24 |
* none
|
|
|
25 |
|
|
|
26 |
Data attributes required for JS:
|
|
|
27 |
* none
|
|
|
28 |
|
|
|
29 |
Context variables required for this template:
|
|
|
30 |
* hascapabilitygroups
|
|
|
31 |
* state
|
|
|
32 |
** pending|configured|rejected|unknown
|
|
|
33 |
** text
|
|
|
34 |
* courseid
|
|
|
35 |
* urls
|
|
|
36 |
** course
|
|
|
37 |
** icon
|
|
|
38 |
* name
|
|
|
39 |
* description
|
|
|
40 |
* instancecount
|
|
|
41 |
|
|
|
42 |
Example context (json):
|
|
|
43 |
{
|
|
|
44 |
"id": 1,
|
|
|
45 |
"name": "Test Tool",
|
|
|
46 |
"urls": {
|
|
|
47 |
"edit": "https://moodle.example.com/mod/lti/registersettings.php",
|
|
|
48 |
"icon": "https://moodle.example.com/theme/image.php/boost/lti/-1/icon"
|
|
|
49 |
},
|
|
|
50 |
"state": {
|
|
|
51 |
"text": "Accepted",
|
|
|
52 |
"configured": false,
|
|
|
53 |
"pending": false,
|
|
|
54 |
"rejected": false,
|
|
|
55 |
"accepted": true,
|
|
|
56 |
"unknown": false
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
}}
|
|
|
60 |
<div class="tool-card" data-proxy-id="{{id}}">
|
|
|
61 |
<div class="overlay-container">
|
|
|
62 |
<div class="img-container">
|
|
|
63 |
{{> mod_lti/loader }}
|
|
|
64 |
<div class="success-icon-container">{{#pix}} i/valid, core, {{#str}} success {{/str}}{{/pix}}</div>
|
|
|
65 |
<div class="fail-icon-container">{{#pix}} i/invalid, core, {{#str}} error {{/str}}{{/pix}}</div>
|
|
|
66 |
</div>
|
|
|
67 |
{{#hascapabilitygroups}}
|
|
|
68 |
{{> mod_lti/tool_type_capabilities_agree }}
|
|
|
69 |
{{/hascapabilitygroups}}
|
|
|
70 |
</div>
|
|
|
71 |
<div class="tool-card-content">
|
|
|
72 |
<div class="tool-card-header">
|
|
|
73 |
<div class="tool-card-subheader">
|
|
|
74 |
<div class="badge
|
|
|
75 |
{{#state.pending}}bg-info text-white{{/state.pending}}
|
|
|
76 |
{{#state.configured}}bg-success text-white{{/state.configured}}
|
|
|
77 |
{{#state.rejected}}bg-danger text-white{{/state.rejected}}
|
|
|
78 |
{{#state.unknown}}bg-warning text-dark{{/state.unknown}}">
|
|
|
79 |
{{state.text}}
|
|
|
80 |
</div>
|
|
|
81 |
<div class="tool-card-actions float-sm-right">
|
|
|
82 |
{{#courseid}}
|
|
|
83 |
<a href="{{{urls.course}}}" title="{{#str}} courselink, mod_lti {{/str}}">{{#pix}} i/course, core, {{#str}} courselink, mod_lti {{/str}}{{/pix}}</a>
|
|
|
84 |
{{/courseid}}
|
|
|
85 |
<a class="edit" href="{{{urls.edit}}}" title="{{#str}} edit {{/str}}">{{#pix}} t/edit, core, {{#str}} edit {{/str}}{{/pix}}</a>
|
|
|
86 |
<a class="delete" href="#" title="{{#str}} delete {{/str}}">{{#pix}} t/delete, core, {{#str}} delete {{/str}}{{/pix}}</a>
|
|
|
87 |
</div>
|
|
|
88 |
</div>
|
|
|
89 |
<img class="tool-card-icon" src="{{{urls.icon}}}" alt="{{name}}">
|
|
|
90 |
<div class="contenteditable-container">
|
|
|
91 |
<h4 class="name">{{name}}</h4>
|
|
|
92 |
<div class="overlay-container">{{> mod_lti/loader }}</div>
|
|
|
93 |
</div>
|
|
|
94 |
</div>
|
|
|
95 |
<div class="tool-card-body">
|
|
|
96 |
<div class="contenteditable-container">
|
|
|
97 |
<p class="description">{{description}}</p>
|
|
|
98 |
<div class="overlay-container">{{> mod_lti/loader }}</div>
|
|
|
99 |
</div>
|
|
|
100 |
</div>
|
|
|
101 |
<div class="tool-card-footer">
|
|
|
102 |
{{#state.pending}}
|
|
|
103 |
<a class="activate btn btn-success" href="#">{{#str}} activate, mod_lti {{/str}}</a>
|
|
|
104 |
{{/state.pending}}
|
|
|
105 |
{{^state.pending}}
|
|
|
106 |
{{#instancecount}}
|
|
|
107 |
<p>{{#str}} toolisbeingused, mod_lti, {{instancecount}} {{/str}}</p>
|
|
|
108 |
{{/instancecount}}
|
|
|
109 |
{{^instancecount}}
|
|
|
110 |
<p>{{#str}} toolisnotbeingused, mod_lti{{/str}}</p>
|
|
|
111 |
{{/instancecount}}
|
|
|
112 |
{{/state.pending}}
|
|
|
113 |
</div>
|
|
|
114 |
</div>
|
|
|
115 |
</div>
|
|
|
116 |
{{#js}}
|
|
|
117 |
require(['jquery', 'mod_lti/tool_proxy_card_controller'], function($, controller) {
|
|
|
118 |
var cardElement = $('[data-proxy-id={{id}}]');
|
|
|
119 |
controller.init(cardElement);
|
|
|
120 |
});
|
|
|
121 |
{{/js}}
|