Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 14614 | Rev 15389 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 14614 Rev 15386
Línea 1... Línea 1...
1
<?php
1
<?php
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
3
$currentUser    = $this->currentUserHelper();
3
$currentUser    = $this->currentUserHelper();
Línea 4... Línea -...
4
 
-
 
5
$routeReports = $this->url('microlearning/reports/progress'); 
-
 
6
 
4
 
Línea -... Línea 5...
-
 
5
$roleName = $currentUser->getUserTypeId();
-
 
6
 
-
 
7
$allowDownload  = $acl->isAllowed($roleName, 'microlearning/reports/progress-for-capsule/excel') ? 1 : 0;
-
 
8
 
Línea 7... Línea 9...
7
$roleName = $currentUser->getUserTypeId();
9
 
8
 
10
 
9
 
11
 
Línea 43... Línea 45...
43
 
45
 
44
 
46
 
45
$this->inlineScript()->captureStart();
47
$this->inlineScript()->captureStart();
-
 
48
echo <<<JS
46
echo <<<JS
49
jQuery( document ).ready(function( $ ) {
47
jQuery( document ).ready(function( $ ) {
50
 
48
    
51
 
49
    $.fn.changeFilter = function() {
52
    $.fn.changeFilter = function() {
50
        NProgress.start(); 
53
        NProgress.start(); 
51
        $.ajax({
54
        $.ajax({
Línea 63... Línea 66...
63
                    $('#form-filter #capsule_uuid').empty();    
66
                    $('#form-filter #capsule_uuid').empty();    
Línea 64... Línea 67...
64
 
67
 
65
                    $.each(response['data']['capsules'], function( value, label ) {
68
                    $.each(response['data']['capsules'], function( value, label ) {
66
                      $('#form-filter #capsule_uuid').append(new Option(label, value));
69
                      $('#form-filter #capsule_uuid').append(new Option(label, value));
-
 
70
                    });
-
 
71
 
67
                    });
72
                    $('#form-filter #capsule_uuid').val(response['data']['capsule_selected']);
Línea 68... Línea 73...
68
                } 
73
                } 
69
               
74
               
70
                if(response['data']['items']) { 
75
                if(response['data']['items']) { 
Línea 74... Línea 79...
74
    
79
    
Línea 75... Línea 80...
75
                    );
80
                    );
Línea -... Línea 81...
-
 
81
        
-
 
82
                }
-
 
83
 
-
 
84
                if(response['data']['link_download']) {
-
 
85
                    $('button.btn-download').data('href', response['data']['link_download']);
-
 
86
                    $('button.btn-download').show();
-
 
87
 
-
 
88
                } else {
76
        
89
                     $('button.btn-download').hide();
77
                }
90
                }
78
 
91
 
79
            } else {
92
            } else {
80
                if(jQuery.type(response['data']) == 'string') {
93
                if(jQuery.type(response['data']) == 'string') {
Línea 105... Línea 118...
105
        e.preventDefault();
118
        e.preventDefault();
Línea 106... Línea 119...
106
 
119
 
107
        $.fn.changeFilter();
120
        $.fn.changeFilter();
Línea -... Línea 121...
-
 
121
    })
-
 
122
 
-
 
123
    $('button.btn-download').click(function(e) {
-
 
124
        e.preventDefault();
-
 
125
        var action   = $(this).data('href');
-
 
126
 
-
 
127
        NProgress.start(); 
-
 
128
        $.ajax({
-
 
129
            'dataType'  : 'json',
-
 
130
            'method'    : 'get',
-
 
131
            'url'       :  action,
-
 
132
        }).done(function(response) {
-
 
133
            if(response['success']) {
-
 
134
                var anchor = window.document.createElement("a");
-
 
135
                anchor.href = 'data:application/octet-stream;charset=utf-8;base64,' + response['data']['content'] ;
-
 
136
                anchor.download = response['data']['basename'];
-
 
137
                document.body.appendChild(anchor);
-
 
138
                anchor.click();  // IE: "Access is denied"; see: https://connect.microsoft.com/IE/feedback/details/797361/ie-10-treats-blob-url-as-cross-origin-and-denies-access
-
 
139
                document.body.removeChild(anchor);
-
 
140
            } else {
-
 
141
                $.fn.showError(response['data']);
-
 
142
            }
-
 
143
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
144
            showError(textStatus);
-
 
145
        }).always(function() {
-
 
146
            NProgress.done();
-
 
147
        });
-
 
148
 
-
 
149
 
-
 
150
    });
-
 
151
 
-
 
152
 
-
 
153
    $('button.btn-refresh').click(function(e) {
-
 
154
        e.preventDefault();
-
 
155
        $.fn.changeFilter();
-
 
156
    
-
 
157
 
-
 
158
    });
Línea 108... Línea 159...
108
    })
159
 
-
 
160
 
Línea 109... Línea 161...
109
 
161
 
110
 
162
    $.fn.changeFilter();
111
    $.fn.changeFilter();
163
    $('button.btn-download').hide();
112
        
164
        
Línea 164... Línea 216...
164
                                    echo $this->formLabel($element);
216
                                    echo $this->formLabel($element);
165
                                    echo $this->formSelect($element);
217
                                    echo $this->formSelect($element);
166
                                    ?>
218
                                    ?>
167
                                </div>				
219
                                </div>				
168
                            </div>
220
                            </div>
169
                            <!-- 
-
 
-
 
221
 
170
                            <div
222
                            <div
171
                                class="col-md-12 col-sm-12"
223
                                class="col-md-12 col-sm-12"
172
                            >
224
                            >
173
                                <div style="float:right;">
225
                                <div style="float:right;">
174
                                    <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
226
                                    <button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
-
 
227
                                    <?php if($allowDownload) :  ?>
175
                
228
                                    
-
 
229
                					<button type="button" class="btn btn-info btn-download"><i class="fa fa-download"></i> LABEL_DOWNLOAD  </button>
-
 
230
                					<?php endif;?>
176
                                </div>
231
                                </div>
177
                            </div>
232
                            </div>
178
                             -->
-
 
-
 
233
                        
179
                        </div>
234
                        </div>
180
						<?php echo $this->form()->closeTag($form); ?>
235
						<?php echo $this->form()->closeTag($form); ?>
181
					</div>            
236
					</div>            
182
					<div class="card-body">
237
					<div class="card-body">
183
        	    		<table id="gridTable" class="table   table-hover">
238
        	    		<table id="gridTable" class="table   table-hover">