forked from deraadt/Moodle-block_progress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodule.js
38 lines (32 loc) · 1.57 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
31
32
33
34
35
36
37
38
M.block_progress = {
wwwroot: '',
preLoadArray: new Array(),
tickIcon: new Image(),
crossIcon: new Image(),
displayDate: 1,
init: function (YUIObject, root, modulesInUse, date) {
var i;
// Remember the web root.
this.wwwroot = root;
// Rember whether the now indicator is displayed (also hides date).
this.displayDate = date;
// Preload icons for modules in use
for (i = 0; i < modulesInUse.length; i++) {
this.preLoadArray[i] = new Image();
this.preLoadArray[i].src = M.util.image_url('icon', modulesInUse[i]);
}
this.tickIcon.src = M.util.image_url('tick', 'block_progress');
this.crossIcon.src = M.util.image_url('cross', 'block_progress');
},
showInfo: function (mod, type, id, name, message, dateTime, instanceID, userID, icon) {
// Dynamically update the content of the information window below the progress bar.
var content = '<a href="' + this.wwwroot + '/mod/' + mod + '/view.php?id=' + id + '">';
content += '<img src="' + M.util.image_url('icon', mod) + '" alt="" class="moduleIcon" />';
content += name + '</a><br />' + type + ' ' + message + ' ';
content += '<img src="' + M.util.image_url(icon, 'block_progress') + '" alt="" /><br />';
if (this.displayDate) {
content += M.str.block_progress.time_expected + ': ' + dateTime + '<br />';
}
document.getElementById('progressBarInfo' + instanceID + 'user' + userID).innerHTML = content;
}
};