forked from danmarsden/moodle-mod_attendance
-
Notifications
You must be signed in to change notification settings - Fork 0
/
module.js
30 lines (27 loc) · 1.01 KB
/
module.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
M.mod_attendance = {}; // eslint-disable-line camelcase
M.mod_attendance.init_manage = function(Y) { // eslint-disable-line camelcase
Y.on('click', function(e) {
if (e.target.get('checked')) {
Y.all('input.attendancesesscheckbox').each(function() {
this.set('checked', 'checked');
});
} else {
Y.all('input.attendancesesscheckbox').each(function() {
this.set('checked', '');
});
}
}, '#cb_selector');
};
M.mod_attendance.set_preferences_action = function(action) { // eslint-disable-line camelcase
var item = document.getElementById('preferencesaction');
if (item) {
item.setAttribute('value', action);
} else {
item = document.getElementById('preferencesform');
var input = document.createElement("input");
input.setAttribute("type", "hidden");
input.setAttribute("name", "action");
input.setAttribute("value", action);
item.appendChild(input);
}
};