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 |
|
|
|
19 |
@template tool_supporter/course_detail
|
|
|
20 |
|
|
|
21 |
Template which outputs detailed data about a course.
|
|
|
22 |
|
|
|
23 |
Classes required for JS:
|
|
|
24 |
* dataTables
|
|
|
25 |
|
|
|
26 |
Context variables required for this template:
|
|
|
27 |
* courseDetails - array: course details.
|
|
|
28 |
* rolesincourse - array: roles with id
|
|
|
29 |
* roles - array: available roles and the amount in the course
|
|
|
30 |
* users - array of arrays: users enrolled into the course
|
|
|
31 |
* activities - array of arrays: activities used in the course
|
|
|
32 |
* links - array: Links to the course, to its settings and for deleting it
|
|
|
33 |
|
|
|
34 |
Example context (json):
|
|
|
35 |
[{
|
|
|
36 |
"courseDetails": {
|
|
|
37 |
"id": 64,
|
|
|
38 |
"startdate": "27/08/2022, 11:00:00",
|
|
|
39 |
"shortname": "Course for context creation",
|
|
|
40 |
"fullname": "Course for context creation",
|
|
|
41 |
"visible": true,
|
|
|
42 |
"path": "Top Level 1/Level 1.1",
|
|
|
43 |
"enrolledUsers": 1,
|
|
|
44 |
"timecreated": "07.02.2019 02:01",
|
|
|
45 |
"level_one": "Top Level 1",
|
|
|
46 |
"level_two": "Level 1.1"
|
|
|
47 |
},
|
|
|
48 |
"config": {
|
|
|
49 |
"showshortname": true,
|
|
|
50 |
"showfullname": true,
|
|
|
51 |
"showvisible": true,
|
|
|
52 |
"showpath": true,
|
|
|
53 |
"showtimecreated": true,
|
|
|
54 |
"showusersamount": true,
|
|
|
55 |
"showrolesandamount": true
|
|
|
56 |
},
|
|
|
57 |
"rolesincourse": [
|
|
|
58 |
"Teacher"
|
|
|
59 |
],
|
|
|
60 |
"roles": [
|
|
|
61 |
{
|
|
|
62 |
"roleName": "Teacher",
|
|
|
63 |
"roleNumber": 1
|
|
|
64 |
}
|
|
|
65 |
],
|
|
|
66 |
"users": [
|
|
|
67 |
{
|
|
|
68 |
"id": 2,
|
|
|
69 |
"username": "admin",
|
|
|
70 |
"firstname": "Admin",
|
|
|
71 |
"lastname": "Nutzer",
|
|
|
72 |
"lastaccess": "07.02.2019 02:01",
|
|
|
73 |
"roles": [
|
|
|
74 |
"Teacher"
|
|
|
75 |
],
|
|
|
76 |
"enrol_id": 43
|
|
|
77 |
}
|
|
|
78 |
],
|
|
|
79 |
"activities": [
|
|
|
80 |
{
|
|
|
81 |
"section": "General",
|
|
|
82 |
"activity": "forum",
|
|
|
83 |
"name": "Announcements",
|
|
|
84 |
"visible": 1
|
|
|
85 |
}
|
|
|
86 |
],
|
|
|
87 |
"links": {
|
|
|
88 |
"settingslink": "http://127.0.0.1/course/edit.php?id=64",
|
|
|
89 |
"deletelink": "http://127.0.0.1/course/delete.php?id=64",
|
|
|
90 |
"courselink": "http://127.0.0.1/course/view.php?id=64"
|
|
|
91 |
},
|
|
|
92 |
"enrolmentMethods": [
|
|
|
93 |
{
|
|
|
94 |
"methodname": "Manual enrolments",
|
|
|
95 |
"enabled": false,
|
|
|
96 |
"users": 1
|
|
|
97 |
},
|
|
|
98 |
{
|
|
|
99 |
"methodname": "Guest access",
|
|
|
100 |
"enabled": true,
|
|
|
101 |
"users": 0
|
|
|
102 |
},
|
|
|
103 |
{
|
|
|
104 |
"methodname": "Self enrolment (Student)",
|
|
|
105 |
"enabled": true,
|
|
|
106 |
"users": 0
|
|
|
107 |
}
|
|
|
108 |
],
|
|
|
109 |
"isallowedtoupdatecourse": true
|
|
|
110 |
}]
|
|
|
111 |
|
|
|
112 |
}}
|
|
|
113 |
<!--View details after clicking on a course in course table. -->
|
|
|
114 |
|
|
|
115 |
<div style="display: none; padding-bottom: 15px" id ="course_details" data-region = "course_details">
|
|
|
116 |
<div class="card">
|
|
|
117 |
<div class="card-header">
|
|
|
118 |
{{#links}}
|
|
|
119 |
|
|
|
120 |
<a href="{{courselink}}" target="_blank" class="text-decoration-none"><h3 class="card-title">{{#courseDetails}}{{fullname}}{{/courseDetails}}</h3></a>
|
|
|
121 |
<div class="btn-group ml-auto">
|
|
|
122 |
{{#isallowedtoupdatecourse}}
|
|
|
123 |
{{#courseDetails}}
|
|
|
124 |
{{^visible}}
|
|
|
125 |
<a href="#" class="btn btn-xs btn-secondary p-1" id="show_course_visibility">
|
|
|
126 |
{{#pix}} i/show, core, {{#str}}show{{/str}} {{/pix}}
|
|
|
127 |
</a>
|
|
|
128 |
{{/visible}}
|
|
|
129 |
{{#visible}}
|
|
|
130 |
<a href="#" class="btn btn-xs btn-secondary p-1" id="hide_course_visibility">
|
|
|
131 |
{{#pix}} i/hide, core, {{#str}}hide{{/str}} {{/pix}}
|
|
|
132 |
</a>
|
|
|
133 |
{{/visible}}
|
|
|
134 |
{{/courseDetails}}
|
|
|
135 |
<a data-toggle="tooltip" title="{{#str}}editsettings{{/str}}" href="{{settingslink}}" target="_blank" class="btn btn-xs btn-secondary p-1">
|
|
|
136 |
{{#pix}} i/edit, core, {{#str}}editsettings{{/str}} {{/pix}}
|
|
|
137 |
</a>
|
|
|
138 |
<a data-toggle="tooltip" title="{{#str}}duplicate{{/str}}" href="#" class="btn btn-xs btn-secondary p-1" id="duplicate_course_button">
|
|
|
139 |
{{#pix}} i/copy, tool_supporter, {{#str}}duplicate{{/str}} {{/pix}}
|
|
|
140 |
</a>
|
|
|
141 |
{{/isallowedtoupdatecourse}}
|
|
|
142 |
{{#deletelink}}
|
|
|
143 |
<a data-toggle="tooltip" title="{{#str}}deletecourse{{/str}}" href="{{deletelink}}" target="_blank" class="btn btn-xs btn-secondary p-1">
|
|
|
144 |
{{#pix}} i/delete, core, {{#str}}deletecourse{{/str}} {{/pix}}
|
|
|
145 |
</a>
|
|
|
146 |
{{/deletelink}}
|
|
|
147 |
<a data-toggle="tooltip" title="{{#str}}hide{{/str}}" href="#" class="btn btn-xs btn-secondary p-1" id="btn_hide_course_details">
|
|
|
148 |
{{#pix}}i/minus, tool_supporter, {{#str}}collapse{{/str}} {{/pix}}
|
|
|
149 |
</a>
|
|
|
150 |
<a data-toggle="tooltip" title="{{#str}}show{{/str}}" href="#" class="btn btn-xs btn-secondary p-1" id="btn_show_course_details" style="display: none">
|
|
|
151 |
{{#pix}}i/plus, tool_supporter, {{#str}}show{{/str}} {{/pix}}
|
|
|
152 |
</a>
|
|
|
153 |
</div>
|
|
|
154 |
{{/links}}
|
|
|
155 |
</div>
|
|
|
156 |
<div class="card-block" id="course_details_body">
|
|
|
157 |
<!-- Show course details -->
|
|
|
158 |
<table class = "table borderless">
|
|
|
159 |
<tbody>
|
|
|
160 |
{{#config}}
|
|
|
161 |
{{#courseDetails}}
|
|
|
162 |
<tr><th>ID</th><td id="selectedcourseid">{{id}}</td></tr>
|
|
|
163 |
{{#showstartdate}}<tr><th>{{#str}}startdate{{/str}}</th><td>{{startdate}}</td></tr>{{/showstartdate}}
|
|
|
164 |
{{#showshortname}}<tr><th>{{#str}}shortnamecourse{{/str}}</th><td>{{shortname}}</td></tr>{{/showshortname}}
|
|
|
165 |
{{#showfullname}}<tr><th>{{#str}}fullnamecourse{{/str}}</th><td>{{fullname}}</td></tr>{{/showfullname}}
|
|
|
166 |
{{#showvisible}}<tr><th>{{#str}}visible{{/str}}</th><td>{{visible}}</td></tr>{{/showvisible}}
|
|
|
167 |
{{#showpath}}<tr><th>{{#str}}path{{/str}}</th><td>{{path}}</td></tr>{{/showpath}}
|
|
|
168 |
{{#showtimecreated}}<tr><th>{{#str}}eventcoursecreated{{/str}}</th><td>{{timecreated}}</td></tr>{{/showtimecreated}}
|
|
|
169 |
{{#showusersamount}}<tr><th>{{#str}}users{{/str}}</th><td>{{enrolledUsers}}</td></tr>{{/showusersamount}}
|
|
|
170 |
{{/courseDetails}}
|
|
|
171 |
{{#showrolesandamount}}{{#roles}}
|
|
|
172 |
<tr><th>{{roleName}}</th><td>{{roleNumber}}</td></tr>
|
|
|
173 |
{{/roles}}{{/showrolesandamount}}
|
|
|
174 |
{{/config}}
|
|
|
175 |
</tbody>
|
|
|
176 |
</table>
|
|
|
177 |
<hr>
|
|
|
178 |
|
|
|
179 |
<!-- Navigation for user- and activity-table of selected course -->
|
|
|
180 |
<div>
|
|
|
181 |
<ul class="nav nav-tabs nav-justified" role="tablist">
|
|
|
182 |
<li class = "nav-item"><a class = "nav-link active" data-toggle="tab" href="#CoursePill_1" role = "tab">{{#str}}enrolledusers, enrol{{/str}}</a></li>
|
|
|
183 |
<li class = "nav-item"><a class = "nav-link" data-toggle="tab" href="#CoursePill_2" role = "tab">{{#str}}activities{{/str}}</a></li>
|
|
|
184 |
<li class = "nav-item"><a class = "nav-link" data-toggle="tab" href="#CoursePill_3" role = "tab">{{#str}}enrolmentinstances, enrol{{/str}}</a></li>
|
|
|
185 |
</ul>
|
|
|
186 |
</div>
|
|
|
187 |
|
|
|
188 |
<div class="tab-content">
|
|
|
189 |
<div id="CoursePill_1" class="tab-pane active" role="tabpanel">
|
|
|
190 |
<!-- Table of users in this course-->
|
|
|
191 |
|
|
|
192 |
<div class = "nav-item dropdown float-left" style="padding-left: 5px;">
|
|
|
193 |
<b>{{#str}}filter{{/str}}:</b>
|
|
|
194 |
<a class = "dropdown-toggle" href='javascript:void(0)' data-toggle="dropdown">{{#str}}roles{{/str}}</a>
|
|
|
195 |
<ul class="dropdown-menu" id="roledropdown">
|
|
|
196 |
<!--filter user list by selecting wanted role-->
|
|
|
197 |
{{#rolesincourse}}
|
|
|
198 |
<li class = "dropdown-item"><input type="checkbox" value="{{{.}}}" name="rolesincourse" id="rolesincourse"> {{{.}}}</li>
|
|
|
199 |
{{/rolesincourse}}
|
|
|
200 |
</ul>
|
|
|
201 |
</div>
|
|
|
202 |
|
|
|
203 |
<div class = "float-right">
|
|
|
204 |
<u>
|
|
|
205 |
<a href="{{wwwroot}}/user/index.php?id={{#courseDetails}}{{id}}{{/courseDetails}}" target="_blank">
|
|
|
206 |
{{#pix}} i/settings, core{{/pix}}
|
|
|
207 |
</a>
|
|
|
208 |
</u>
|
|
|
209 |
</div>
|
|
|
210 |
|
|
|
211 |
<div class="table table-responsive">
|
|
|
212 |
<table class="stripe hover row-border" id="userincourse">
|
|
|
213 |
<thead>
|
|
|
214 |
<tr>
|
|
|
215 |
<th>ID</th>
|
|
|
216 |
<th>{{#str}}username{{/str}}</th>
|
|
|
217 |
<th>{{#str}}firstname{{/str}}</th>
|
|
|
218 |
<th>{{#str}}lastname{{/str}}</th>
|
|
|
219 |
<th>{{#str}}roles{{/str}}</th>
|
|
|
220 |
<th>{{#str}}lastaccess{{/str}}</th>
|
|
|
221 |
<th></th>
|
|
|
222 |
</tr>
|
|
|
223 |
</thead>
|
|
|
224 |
<tbody>
|
|
|
225 |
{{#users}}
|
|
|
226 |
<tr>
|
|
|
227 |
<td>{{id}}</td>
|
|
|
228 |
<td>{{username}}</td>
|
|
|
229 |
<td>{{firstname}}</td>
|
|
|
230 |
<td>{{lastname}}</td>
|
|
|
231 |
<td>{{roles}}</td>
|
|
|
232 |
<td>{{lastaccess}}</td>
|
|
|
233 |
<td>
|
|
|
234 |
<a href="{{wwwroot}}/enrol/unenroluser.php?id={{#courseDetails}}{{id}}{{/courseDetails}}&ue={{enrol_id}}" target="_blank">
|
|
|
235 |
{{#pix}} i/delete, core, {{#str}}unenrol, enrol{{/str}}{{/pix}}
|
|
|
236 |
</a>
|
|
|
237 |
</td>
|
|
|
238 |
</tr>
|
|
|
239 |
{{/users}}
|
|
|
240 |
</tbody>
|
|
|
241 |
</table>
|
|
|
242 |
</div>
|
|
|
243 |
</div>
|
|
|
244 |
|
|
|
245 |
<div id="CoursePill_2" class="tab-pane" role="tabpanel">
|
|
|
246 |
<!-- Table of activites in this course-->
|
|
|
247 |
<div class="table table-responsive">
|
|
|
248 |
<table class="stripe hover row-border" id="activityInCourse">
|
|
|
249 |
<thead>
|
|
|
250 |
<tr>
|
|
|
251 |
<th>{{#str}}sectionname{{/str}}</th>
|
|
|
252 |
<th>{{#str}}activity{{/str}}</th>
|
|
|
253 |
<th>{{#str}}name{{/str}}</th>
|
|
|
254 |
<th>{{#str}}visible{{/str}}</th>
|
|
|
255 |
</tr>
|
|
|
256 |
</thead>
|
|
|
257 |
<tbody>
|
|
|
258 |
{{#activities}}
|
|
|
259 |
<tr>
|
|
|
260 |
<td>{{section}}</td>
|
|
|
261 |
<td>{{activity}}</td>
|
|
|
262 |
<td>{{name}}</td>
|
|
|
263 |
<td>{{visible}}</td>
|
|
|
264 |
</tr>
|
|
|
265 |
{{/activities}}
|
|
|
266 |
</tbody>
|
|
|
267 |
</table>
|
|
|
268 |
</div>
|
|
|
269 |
</div>
|
|
|
270 |
|
|
|
271 |
<div id="CoursePill_3" class="tab-pane" role="tabpanel">
|
|
|
272 |
<!-- Table of enrolment methods in this course-->
|
|
|
273 |
<div class = "float-right">
|
|
|
274 |
<u>
|
|
|
275 |
<a href="{{wwwroot}}/enrol/instances.php?id={{#courseDetails}}{{id}}{{/courseDetails}}" target="_blank">
|
|
|
276 |
{{#pix}} i/settings, core{{/pix}}
|
|
|
277 |
</a>
|
|
|
278 |
</u>
|
|
|
279 |
</div>
|
|
|
280 |
<div class = "table table-responsive">
|
|
|
281 |
<table class = "stripe hover row-border">
|
|
|
282 |
<tbody>
|
|
|
283 |
<tr>
|
|
|
284 |
<th>{{#str}}name{{/str}}</th>
|
|
|
285 |
<th>{{#str}}users{{/str}}</th>
|
|
|
286 |
<th>{{#str}}password{{/str}}</th>
|
|
|
287 |
</tr>
|
|
|
288 |
{{#enrolmentMethods}}
|
|
|
289 |
<tr {{#enabled}} class="dimmed_text" {{/enabled}}>
|
|
|
290 |
<td>{{methodname}}</td>
|
|
|
291 |
<td>{{users_count}}</td>
|
|
|
292 |
<td>{{password}}</td>
|
|
|
293 |
</tr>
|
|
|
294 |
{{/enrolmentMethods}}
|
|
|
295 |
</tbody>
|
|
|
296 |
</table>
|
|
|
297 |
</div>
|
|
|
298 |
</div>
|
|
|
299 |
|
|
|
300 |
</div>
|
|
|
301 |
</div>
|
|
|
302 |
</div>
|
|
|
303 |
</div>
|
|
|
304 |
|
|
|
305 |
{{#js}}
|
|
|
306 |
require(['jquery', 'tool_supporter/table_filter', 'tool_supporter/table_sort',
|
|
|
307 |
'tool_supporter/datatables', 'tool_supporter/load_information', 'tool_supporter/create_new_course'],
|
|
|
308 |
function($, search, sort, dataTable, loadInformation, createNewCourse) {
|
|
|
309 |
|
|
|
310 |
// Convert userincourse-table to DataTable and add filter functionality to dropdown-menu
|
|
|
311 |
dataTable.useDataTable('#userincourse', [['rolesincourse', '#roledropdown', 4]]);
|
|
|
312 |
|
|
|
313 |
// Convert activity-table to DataTable
|
|
|
314 |
dataTable.useDataTable("#activityInCourse");
|
|
|
315 |
|
|
|
316 |
// Load information about the clicked user
|
|
|
317 |
loadInformation.clickOnUser('#userincourse');
|
|
|
318 |
|
|
|
319 |
// Buttons on top
|
|
|
320 |
loadInformation.toggleCourseDetails();
|
|
|
321 |
loadInformation.toggleCourseVisibility();
|
|
|
322 |
createNewCourse.duplicateCourse();
|
|
|
323 |
|
|
|
324 |
});
|
|
|
325 |
{{/js}}
|