Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
require(['core/first', 'jquery', 'jqueryui', 'core/ajax', 'pnotify'], function(core, $, bootstrap, ajax, pnotify) {
2
	$(document).ready(function() {
3
		$('#btn-download-excel-all-courses').click(function(e) {
4
			e.preventDefault();
5
 
6
			$('#btn-download-excel-all-courses').prop('disabled', true);
7
			$('.ccn_preloader_load').show();
8
 
9
      		ajax.call([{
10
        		methodname: 'local_cesa_reportes_excel_all_courses',
11
 				args: {
12
		          'fakeparam': 0,
13
		        },
14
 
15
 
16
      		}])[0].done(function(response) {
17
				$('.ccn_preloader_load').hide();
18
				$('#btn-download-excel-all-courses').prop('disabled', false);
19
 
20
				var json = JSON.parse(response);
21
 
22
				if(json.success) {
23
					new pnotify({
24
			            title: false,
25
			            text: json.data,
26
			            type: 'success',
27
			            hide: true,
28
						delay: 2000,
29
						addclass: "stack-modal",
30
			        });
31
				} else {
32
					new pnotify({
33
			            title: false,
34
			            text: json.data,
35
			            type: 'error',
36
			            hide: true,
37
						delay: 2000,
38
						addclass: "stack-modal",
39
			        });
40
				}
41
 
42
 
43
        		return;
44
      		}).fail(function(err) {
45
				$('.ccn_preloader_load').hide();
46
				$('#btn-download-excel-all-courses').prop('disabled', false);
47
 
48
       			console.log(err);
49
        		return;
50
      		});
51
		});
52
 
53
 
54
 
55
	});
56
});