Commit | Line | Data |
---|---|---|
e8a71f85 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/defaultactivitycompletion | |
19 | ||
20 | Activity completion selector. | |
21 | ||
22 | Example context (json): | |
23 | { | |
24 | "courseid": "2", | |
25 | "sesskey": "AAAAAA", | |
26 | "modules": [{ | |
27 | "id": "10", | |
28 | "formatedname": "Assignment", | |
29 | "icon": { | |
30 | "attributes": [ | |
31 | {"name": "src", "value": "https://raw.githubusercontent.com/moodle/moodle/master/pix/t/check.png"}, | |
32 | {"name": "alt", "value": "Assignment icon"} | |
33 | ] | |
34 | } | |
35 | }] | |
36 | } | |
37 | }} | |
38 | <div class="container-fluid"> | |
39 | <div class="row m-b-2"> | |
40 | <div class="col">{{#str}}bulkactivitydetail, moodle{{/str}}</div> | |
41 | </div> | |
6e605119 | 42 | <form method="post" action="defaultcompletion.php" class="mform" id="theform"> |
e8a71f85 AG |
43 | <div class="row m-b-2"> |
44 | <div class="col"> | |
45 | <input type="submit" value="{{#str}}edit{{/str}}" class="btn btn-primary" name="submitbutton" aria-label="{{#str}}updateactivities, completion{{/str}}" /> | |
46 | <input type="reset" value="{{#str}}cancel{{/str}}" class="btn btn-secondary" aria-label="{{#str}}resetactivities, completion{{/str}}" /> | |
47 | </div> | |
48 | </div> | |
49 | <div class="top-section row m-b-1"> | |
50 | <div class="col-sm-6"> | |
51 | <input type="checkbox" class="mastercheck m-r-1" aria-label="{{#str}}checkall, completion{{/str}}"> | |
52 | <label class="font-weight-bold">{{#str}}activitieslabel, moodle{{/str}}</label> | |
53 | </div> | |
54 | <div class="col-sm-6"> | |
55 | <label class="font-weight-bold">{{#str}}completiontracking, moodle{{/str}}</label> | |
56 | <span>{{{helpicon}}}</span> | |
57 | </div> | |
58 | </div> | |
59 | <div class="modules"> | |
60 | {{#modules}} | |
61 | <div class="module-section m-b-1"> | |
62 | <div class="row m-b-1"> | |
63 | <div class="col-sm-12"> | |
64 | <input type="checkbox" class="m-r-1" name="modids[]" value="{{id}}" aria-label="{{#str}}checkactivity, completion, {{formatedname}}{{/str}}"> | |
65 | <img src={{icon}} /> | |
66 | <span>{{formatedname}}</span> | |
67 | </div> | |
68 | </div> | |
69 | </div> | |
70 | {{/modules}} | |
71 | </div> | |
72 | <input type="hidden" name="id" value="{{courseid}}" /> | |
73 | <input type="hidden" name="sesskey" value="{{sesskey}}" /> | |
74 | <div class="row"> | |
75 | <div class="col"> | |
76 | <input type="submit" value="{{#str}}edit{{/str}}" class="btn btn-primary" name="submitbutton" /> | |
77 | <input type="reset" value="{{#str}}cancel{{/str}}" class="btn btn-secondary" /> | |
78 | </div> | |
79 | </div> | |
80 | </form> | |
81 | </div> | |
82 | ||
83 | {{#js}} | |
84 | require([ | |
85 | 'jquery', | |
86 | ], function($) { | |
87 | $('.mastercheck').click(function() { | |
88 | var checked = $('.mastercheck').is(':checked'); | |
89 | $('input[type=checkbox]').each(function() { | |
90 | $(this).prop('checked', checked); | |
91 | }); | |
92 | }); | |
93 | }); | |
94 | {{/js}} |