Commit | Line | Data |
---|---|---|
0b620801 AG |
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 core_course/bulkactivitycompletion | |
19 | ||
20 | Activity completion selector. | |
21 | ||
22 | Example context (json): | |
23 | { | |
24 | "courseid": "2", | |
25 | "sesskey": "AAAAAA", | |
26 | "sections": [{ | |
27 | "sectionnumber": "0", | |
28 | "name": "General", | |
29 | "activities": [{ | |
30 | "cmid": "4", | |
31 | "modname": "Test activity", | |
32 | "icon": { | |
33 | "attributes": [ | |
34 | {"name": "src", "value": "https://raw.githubusercontent.com/moodle/moodle/master/pix/t/check.png"}, | |
35 | {"name": "alt", "value": "module icon"} | |
36 | ] | |
37 | }, | |
38 | "completionstatus": { | |
39 | "string": "Manual", | |
40 | "icon": { | |
41 | "attributes": [ | |
42 | {"name": "src", "value": "https://raw.githubusercontent.com/moodle/moodle/master/pix/t/check.png"}, | |
43 | {"name": "alt", "value": "completion icon"} | |
44 | ] | |
45 | } | |
46 | } | |
47 | }] | |
48 | }] | |
49 | } | |
50 | }} | |
51 | <div class="container-fluid"> | |
52 | <div class="row m-b-2"> | |
53 | <div class="col">{{#str}}bulkactivitydetail, moodle{{/str}}</div> | |
54 | </div> | |
6e605119 | 55 | <form method="post" action="bulkcompletion.php" class="mform" id="theform"> |
0b620801 AG |
56 | <div class="row m-b-2"> |
57 | <div class="col"> | |
58 | <input type="submit" value="{{#str}}edit{{/str}}" class="btn btn-primary" name="submitbutton" aria-label="{{#str}}updateactivities, completion{{/str}}" /> | |
59 | <input type="reset" value="{{#str}}cancel{{/str}}" class="btn btn-secondary" aria-label="{{#str}}resetactivities, completion{{/str}}" /> | |
60 | </div> | |
61 | </div> | |
62 | <div class="top-section row m-b-1"> | |
63 | <div class="col-sm-6 span6"> | |
64 | <input type="checkbox" class="mastercheck m-r-1" aria-label="{{#str}}checkall, completion{{/str}}"> | |
65 | <label class="font-weight-bold">{{#str}}activitieslabel, moodle{{/str}}</label> | |
66 | </div> | |
67 | <div class="col-sm-6"> | |
68 | <label class="font-weight-bold">{{#str}}completiontracking, moodle{{/str}}</label> | |
69 | <span>{{{helpicon}}}</span> | |
70 | </div> | |
71 | </div> | |
72 | <div class="topics"> | |
73 | ||
74 | {{#sections}} | |
75 | ||
76 | <div class="topic-section m-b-1"> | |
77 | <div class="row m-b-1"> | |
78 | <div class="col-sm-12"> | |
79 | <input type="checkbox" data-section-master="{{sectionnumber}}" class="m-r-1" aria-label="{{#str}}checkallsection, completion, {{name}}{{/str}}"> | |
80 | <h3>{{name}}</h3> | |
81 | </div> | |
82 | </div> | |
83 | {{> core_course/activityinstance}} | |
84 | </div> | |
85 | ||
86 | {{/sections}} | |
87 | ||
88 | </div> | |
89 | <input type="hidden" name="id" value="{{courseid}}" /> | |
90 | <input type="hidden" name="sesskey" value="{{sesskey}}" /> | |
91 | <div class="row"> | |
92 | <div class="col"> | |
93 | <input type="submit" value="{{#str}}edit{{/str}}" class="btn btn-primary" name="submitbutton" /> | |
94 | <input type="reset" value="{{#str}}cancel{{/str}}" class="btn btn-secondary" /> | |
95 | </div> | |
96 | </div> | |
97 | </form> | |
98 | </div> | |
99 | ||
100 | {{#js}} | |
101 | require([ | |
102 | 'jquery', | |
103 | ], function($) { | |
104 | $('.mastercheck').click(function() { | |
105 | var checked = $('.mastercheck').is(':checked'); | |
106 | $('input[type=checkbox]').each(function() { | |
107 | $(this).prop('checked', checked); | |
108 | }); | |
109 | }); | |
110 | var mastersection = $('input[data-section-master]'); | |
111 | mastersection.click(function() { | |
112 | var checked = $(this).is(':checked'); | |
113 | var dataid = $(this).attr('data-section-master'); | |
114 | $('input[type=checkbox][data-section=\'' + dataid + '\']').each(function() { | |
115 | $(this).prop('checked', checked); | |
116 | }); | |
117 | }); | |
118 | ||
119 | ||
120 | }); | |
121 | {{/js}} |