| 1 |
www |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$routeReports = $this->url('microlearning/reports');
|
|
|
6 |
|
|
|
7 |
$roleName = $currentUser->getUserTypeId();
|
|
|
8 |
|
|
|
9 |
|
|
|
10 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
11 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
12 |
|
|
|
13 |
$this->headStyle()->captureStart();
|
|
|
14 |
echo <<<CSS
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
#tableStudents {
|
|
|
18 |
display: flex;
|
|
|
19 |
flex-flow: column;
|
|
|
20 |
width: 100%;
|
|
|
21 |
}
|
|
|
22 |
|
|
|
23 |
#tableStudents thead {
|
|
|
24 |
flex: 0 0 auto;
|
|
|
25 |
}
|
|
|
26 |
|
|
|
27 |
#tableStudents tbody {
|
|
|
28 |
flex: 1 1 auto;
|
|
|
29 |
display: block;
|
|
|
30 |
overflow-y: auto;
|
|
|
31 |
overflow-x: hidden;
|
|
|
32 |
}
|
|
|
33 |
|
|
|
34 |
#tableStudents tr {
|
|
|
35 |
width: 100%;
|
|
|
36 |
display: table;
|
|
|
37 |
table-layout: fixed;
|
|
|
38 |
}
|
|
|
39 |
CSS;
|
|
|
40 |
$this->headStyle()->captureEnd();
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
$this->inlineScript()->captureStart();
|
|
|
45 |
echo <<<JS
|
|
|
46 |
jQuery( document ).ready(function( $ ) {
|
|
|
47 |
|
|
|
48 |
$.fn.changeFilter = function() {
|
|
|
49 |
NProgress.start();
|
|
|
50 |
$.ajax({
|
|
|
51 |
'dataType' : 'json',
|
|
|
52 |
'accept' : 'application/json',
|
|
|
53 |
'method' : 'get',
|
|
|
54 |
'url' : $('#form-filter').attr('action'),
|
|
|
55 |
'data' : $('#form-filter').serialize(),
|
|
|
56 |
}).done(function(response) {
|
|
|
57 |
if(response['success']) {
|
|
|
58 |
|
|
|
59 |
$('#tableStudents tbody').empty();
|
|
|
60 |
$.each(response['data'], function(id, item) {
|
|
|
61 |
|
|
|
62 |
var percentaje = 0;
|
|
|
63 |
if(item['total_capsules_completed'] > 0 && item['total_capsules'] > 0) {
|
|
|
64 |
percentaje = parseInt ( ( item['total_capsules_completed'] * 100 ) / item['total_capsules'] );
|
|
|
65 |
}
|
|
|
66 |
|
|
|
67 |
var s = '<tr>';
|
|
|
68 |
|
|
|
69 |
|
|
|
70 |
|
|
|
71 |
s = s + '<td style="width: 32%">';
|
|
|
72 |
s = s + $.trim(item['first_name'] + ' ' + item['last_name'] ) + '<br>';
|
|
|
73 |
s = s + item['email'] ;
|
|
|
74 |
s = s + '</td>';
|
|
|
75 |
|
|
|
76 |
|
|
|
77 |
s = s + '<td style="width: 10%" class="text-right">' + item['total_capsules'] + '</td>';
|
|
|
78 |
s = s + '<td style="width: 10%" class="text-right">' + item['total_capsules_completed'] + '</td>';
|
|
|
79 |
s = s + '<td style="width: 10%" class="text-right">' + item['total_capsules_incomplete'] + '</td>';
|
|
|
80 |
s = s + '<td style="width: 10%" >' + item['first_date'] + '<br>' + item['first_time'] + '</td>';
|
|
|
81 |
s = s + '<td style="width: 10%" >' + item['last_date'] + '<br>' + item['last_time'] + '</td>';
|
|
|
82 |
s = s + '<td style="width: 10%" >';
|
|
|
83 |
s = s + '<div class="progress progress-xs progress-striped active">';
|
|
|
84 |
s = s + '<div class="progress-bar bg-primary" style="width: ' + percentaje + '%"></div>';
|
|
|
85 |
s = s + '</div>';
|
|
|
86 |
s = s + '</td>';
|
|
|
87 |
s = s + '<td style="width: 8%" class="text-right">' + percentaje + '%</td>';
|
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
s = s + '</tr>';
|
|
|
92 |
$('#tableStudents tbody').append(s);
|
|
|
93 |
|
|
|
94 |
|
|
|
95 |
});
|
|
|
96 |
|
|
|
97 |
|
|
|
98 |
} else {
|
|
|
99 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
100 |
$.fn.showError(response['data']);
|
|
|
101 |
} else {
|
|
|
102 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
103 |
$.fn.showFormErrorValidator('#form-slide-video-edit #' + fieldname, errors);
|
|
|
104 |
});
|
|
|
105 |
}
|
|
|
106 |
}
|
|
|
107 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
108 |
$.fn.showError(textStatus);
|
|
|
109 |
}).always(function() {
|
|
|
110 |
NProgress.done();
|
|
|
111 |
});
|
|
|
112 |
return false;
|
|
|
113 |
}
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
$('#form-filter #company_id').change(function(e) {
|
|
|
117 |
e.preventDefault();
|
|
|
118 |
$.fn.changeFilter();
|
|
|
119 |
|
|
|
120 |
});
|
|
|
121 |
|
|
|
122 |
$('#form-filter #function_id').change(function(e) {
|
|
|
123 |
e.preventDefault();
|
|
|
124 |
$.fn.changeFilter();
|
|
|
125 |
|
|
|
126 |
});
|
|
|
127 |
|
|
|
128 |
|
|
|
129 |
$('#form-filter #group_id').change(function(e) {
|
|
|
130 |
e.preventDefault();
|
|
|
131 |
$.fn.changeFilter();
|
|
|
132 |
|
|
|
133 |
});
|
|
|
134 |
|
|
|
135 |
|
|
|
136 |
$('#form-filter #institution_id').change(function(e) {
|
|
|
137 |
e.preventDefault();
|
|
|
138 |
$.fn.changeFilter();
|
|
|
139 |
|
|
|
140 |
});
|
|
|
141 |
|
|
|
142 |
|
|
|
143 |
$('#form-filter #program_id').change(function(e) {
|
|
|
144 |
e.preventDefault();
|
|
|
145 |
$.fn.changeFilter();
|
|
|
146 |
|
|
|
147 |
});
|
|
|
148 |
|
|
|
149 |
|
|
|
150 |
$('#form-filter #partner_id').change(function(e) {
|
|
|
151 |
e.preventDefault();
|
|
|
152 |
$.fn.changeFilter();
|
|
|
153 |
|
|
|
154 |
});
|
|
|
155 |
|
|
|
156 |
|
|
|
157 |
$('#form-filter #sector_id').change(function(e) {
|
|
|
158 |
e.preventDefault();
|
|
|
159 |
$.fn.changeFilter();
|
|
|
160 |
|
|
|
161 |
});
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
$('#form-filter #student_type_id').change(function(e) {
|
|
|
165 |
e.preventDefault();
|
|
|
166 |
$.fn.changeFilter();
|
|
|
167 |
|
|
|
168 |
});
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
$.fn.changeFilter();
|
|
|
172 |
|
|
|
173 |
});
|
|
|
174 |
JS;
|
|
|
175 |
$this->inlineScript()->captureEnd();
|
|
|
176 |
?>
|
|
|
177 |
|
|
|
178 |
<!-- Content Header (Page header) -->
|
|
|
179 |
<section class="content-header">
|
|
|
180 |
<div class="container-fluid">
|
|
|
181 |
<div class="row mb-2">
|
|
|
182 |
<div class="col-sm-12">
|
|
|
183 |
<h1>LABEL_REPORTS</h1>
|
|
|
184 |
</div>
|
|
|
185 |
</div>
|
|
|
186 |
</div><!-- /.container-fluid -->
|
|
|
187 |
</section>
|
|
|
188 |
|
|
|
189 |
<section class="content">
|
|
|
190 |
<div class="container-fluid">
|
|
|
191 |
<div class="row">
|
|
|
192 |
<div class="col-12">
|
|
|
193 |
<div class="card card-primary collapsed-card">
|
|
|
194 |
<div class="card-header">
|
|
|
195 |
<h3 class="card-title">LABEL_FILTERS</h3>
|
|
|
196 |
|
|
|
197 |
<div class="card-tools">
|
|
|
198 |
<button type="button" class="btn btn-tool" data-card-widget="collapse"><i class="fa fa-filter"></i></button>
|
|
|
199 |
</div>
|
|
|
200 |
<!-- /.card-tools -->
|
|
|
201 |
</div>
|
|
|
202 |
<!-- /.card-header -->
|
|
|
203 |
<div class="card-body">
|
|
|
204 |
<form name="form-filter" id="form-filter" action="<?php echo $routeReports ?>">
|
|
|
205 |
<?php
|
|
|
206 |
$fields = [
|
|
|
207 |
[
|
|
|
208 |
'label' => 'LABEL_COMPANIES',
|
|
|
209 |
'name' => 'company_id',
|
|
|
210 |
],
|
|
|
211 |
[
|
|
|
212 |
'label' => 'LABEL_FUNCTIONS',
|
|
|
213 |
'name' => 'function_id',
|
|
|
214 |
],
|
|
|
215 |
[
|
|
|
216 |
'label' => 'LABEL_GROUPS',
|
|
|
217 |
'name' => 'group_id',
|
|
|
218 |
],
|
|
|
219 |
[
|
|
|
220 |
'label' => 'LABEL_INSTITUTIONS',
|
|
|
221 |
'name' => 'institution_id',
|
|
|
222 |
],
|
|
|
223 |
[
|
|
|
224 |
'label' => 'LABEL_PROGRAMS',
|
|
|
225 |
'name' => 'program_id',
|
|
|
226 |
],
|
|
|
227 |
[
|
|
|
228 |
'label' => 'LABEL_PARTNERS',
|
|
|
229 |
'name' => 'partner_id',
|
|
|
230 |
],
|
|
|
231 |
[
|
|
|
232 |
'label' => 'LABEL_SECTORS',
|
|
|
233 |
'name' => 'sector_id',
|
|
|
234 |
],
|
|
|
235 |
[
|
|
|
236 |
'label' => 'LABEL_STUDENT_TYPES',
|
|
|
237 |
'name' => 'student_type_id',
|
|
|
238 |
],
|
|
|
239 |
];
|
|
|
240 |
|
|
|
241 |
$column = 0;
|
|
|
242 |
foreach($fields as $field) :
|
|
|
243 |
if($column == 0) {
|
|
|
244 |
echo '<div class="row">';
|
|
|
245 |
|
|
|
246 |
}
|
|
|
247 |
$column++;
|
|
|
248 |
|
|
|
249 |
?>
|
|
|
250 |
|
|
|
251 |
|
|
|
252 |
<div class="col-md-6 col-sm-12">
|
|
|
253 |
<div class="form-group">
|
|
|
254 |
<?php
|
|
|
255 |
$element = $form->get( $field['name'] );
|
|
|
256 |
$element->setOptions(['label' => $field['label'] ]);
|
|
|
257 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
258 |
|
|
|
259 |
echo $this->formLabel($element);
|
|
|
260 |
echo $this->formSelect($element);
|
|
|
261 |
?>
|
|
|
262 |
</div>
|
|
|
263 |
</div>
|
|
|
264 |
<?php
|
|
|
265 |
if($column == 2) {
|
|
|
266 |
$column = 0;
|
|
|
267 |
echo '</div>';
|
|
|
268 |
}
|
|
|
269 |
?>
|
|
|
270 |
<?php endforeach; ?>
|
|
|
271 |
<?php if($column) {
|
|
|
272 |
echo '</div>';
|
|
|
273 |
}
|
|
|
274 |
?>
|
|
|
275 |
</form>
|
|
|
276 |
</div>
|
|
|
277 |
<!-- /.card-body -->
|
|
|
278 |
</div>
|
|
|
279 |
</div>
|
|
|
280 |
</div>
|
|
|
281 |
|
|
|
282 |
<div class="row">
|
|
|
283 |
<div class="col-12">
|
|
|
284 |
|
|
|
285 |
<div class="card">
|
|
|
286 |
<!-- /.card-header -->
|
|
|
287 |
<div class="card-body p-0">
|
|
|
288 |
<table class="table table-responsive" id="tableStudents" >
|
|
|
289 |
<thead>
|
|
|
290 |
<tr>
|
|
|
291 |
|
|
|
292 |
<th style="width: 32%"> </th>
|
|
|
293 |
<th style="width: 30%" colspan="3" class="text-center">LABEL_CAPSULES</th>
|
|
|
294 |
<th style="width: 20%" colspan="2" class="text-center">LABEL_DATE</th>
|
|
|
295 |
<th style="width: 10%"> </th>
|
|
|
296 |
<th style="width: 8%"> </th>
|
|
|
297 |
</tr>
|
|
|
298 |
<tr>
|
|
|
299 |
|
|
|
300 |
<th style="width: 32%">LABEL_REPORTS_STUDENT</th>
|
|
|
301 |
<th style="width: 10%" class="text-right">LABEL_REPORTS_CAPSULES_TOTAL</th>
|
|
|
302 |
<th style="width: 10%" class="text-right">LABEL_REPORTS_CAPSULES_COMPLETED</th>
|
|
|
303 |
<th style="width: 10%" class="text-right">LABEL_REPORTS_CAPSULES_INCOMPLETED</th>
|
|
|
304 |
<th style="width: 10%">LABEL_REPORTS_FIRST_DATE</th>
|
|
|
305 |
<th style="width: 10%">LABEL_REPORTS_LAST_DATE</th>
|
|
|
306 |
<th style="width: 10%">LABEL_REPORTS_PROGRESS</th>
|
|
|
307 |
<th style="width: 8%" class="text-right">%</th>
|
|
|
308 |
</tr>
|
|
|
309 |
</thead>
|
|
|
310 |
<tbody>
|
|
|
311 |
|
|
|
312 |
</tbody>
|
|
|
313 |
</table>
|
|
|
314 |
</div>
|
|
|
315 |
<!-- /.card-body -->
|
|
|
316 |
</div>
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
</div>
|
|
|
320 |
</div>
|
|
|
321 |
</div>
|
|
|
322 |
</section>
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
|
|
|
329 |
|