2 This file is part of Moodle - http://moodle.org/
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.
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.
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/>.
18 @template mod_lti/tool_card
20 This template provides the layout for a single tool card on the tool
23 Classes required for JS:
26 Data attributes required for JS:
29 Context variables required for this template:
33 ** pending|configured|rejected|unknown
37 ** course - optional, required if courseid > 0
50 Example context (json):
53 "name": "Example Tool",
54 "description": "This is an example tool",
55 "platformid": "https:\/\/moodle.example.com",
57 "hascapabilitygroups": false,
66 "icon": "https://www.example.com/icon1.png",
67 "edit": "https://www.example.com/mod/lti/typessettings.php",
68 "publickeyset": "https:\/\/moodle.example.com\/mod\/lti\/certs.php",
69 "accesstoken": "https:\/\/moodle.example.com\/mod\/lti\/token.php",
70 "authrequest": "https:\/\/moodle.example.com\/mod\/lti\/auth.php"
78 <div class="tool-card" data-type-id="{{id}}" data-uniqid="{{uniqid}}"
79 data-modaltitle="{{#str}} tooldetailsmodaltitle, mod_lti {{/str}}"
80 data-mailtosubject="{{#str}} tooldetailsmailtosubject, mod_lti {{/str}}"
81 data-platformidstr="{{#str}} tooldetailsplatformid, mod_lti {{/str}}"
82 data-clientidstr="{{#str}} tooldetailsclientid, mod_lti {{/str}}"
83 data-deploymentidstr="{{#str}} tooldetailsdeploymentid, mod_lti {{/str}}"
84 data-publickeyseturlstr="{{#str}} tooldetailspublickeyseturl, mod_lti {{/str}}"
85 data-accesstokenurlstr="{{#str}} tooldetailsaccesstokenurl, mod_lti {{/str}}"
86 data-authrequesturlstr="{{#str}} tooldetailsauthrequesturl, mod_lti {{/str}}"
87 data-platformid="{{platformid}}" data-clientid="{{clientid}}" data-deploymentid="{{deploymentid}}"
88 data-publickeyseturl="{{urls.publickeyset}}" data-accesstokenurl="{{urls.accesstoken}}" data-authrequesturl="{{urls.authrequest}}">
89 <div class="overlay-container">
90 <div class="img-container">
92 <div class="success-icon-container">{{#pix}} i/valid, core, {{#str}} success {{/str}}{{/pix}}</div>
93 <div class="fail-icon-container">{{#pix}} i/invalid, core, {{#str}} error {{/str}}{{/pix}}</div>
95 {{#hascapabilitygroups}}
96 {{> mod_lti/tool_type_capabilities_agree }}
97 {{/hascapabilitygroups}}
99 <div class="tool-card-content">
100 <div class="tool-card-header">
101 <div class="tool-card-subheader">
103 {{#state.pending}}badge-info{{/state.pending}}
104 {{#state.configured}}badge-success{{/state.configured}}
105 {{#state.rejected}}badge-danger{{/state.rejected}}
106 {{#state.unknown}}badge-warning{{/state.unknown}}">
109 <div class="tool-card-actions float-sm-right">
111 <a href="{{{urls.course}}}" title="{{#str}} courselink, mod_lti {{/str}}">{{#pix}} i/course, core, {{#str}} courselink, mod_lti {{/str}}{{/pix}}</a>
114 <a class="viewdetails" id="{{uniqid}}-{{deploymentid}}" href="#" title="{{#str}} tooldetailsmodallink, mod_lti {{/str}}">{{#pix}} t/viewdetails, core, {{#str}} tooldetailsmodallink, mod_lti {{/str}}{{/pix}}</a>
116 <a class="edit" href="{{{urls.edit}}}" title="{{#str}} edit {{/str}}">{{#pix}} t/edit, core, {{#str}} edit {{/str}}{{/pix}}</a>
117 <a class="delete" href="#" title="{{#str}} delete {{/str}}">{{#pix}} t/delete, core, {{#str}} delete {{/str}}{{/pix}}</a>
120 <img class="tool-card-icon" src="{{{urls.icon}}}" alt="{{name}}">
121 <div class="contenteditable-container">
122 <h4 class="name" contenteditable="true">{{name}}</h4>
123 <div class="overlay-container">{{> mod_lti/loader }}</div>
126 <div class="tool-card-body">
127 <div class="contenteditable-container">
128 <p class="description" contenteditable="true">{{description}}</p>
129 <div class="overlay-container">{{> mod_lti/loader }}</div>
132 <div class="tool-card-footer">
134 <a class="activate btn btn-success" href="#">{{#str}} activate, mod_lti {{/str}}</a>
138 <p>{{#str}} toolisbeingused, mod_lti, {{instancecount}} {{/str}}</p>
141 <p>{{#str}} toolisnotbeingused, mod_lti{{/str}}</p>
148 require(['jquery', 'mod_lti/tool_card_controller'], function($, controller) {
149 var cardElement = $('[data-type-id={{id}}]');
150 controller.init(cardElement);