1 |
www |
1 |
<?php
|
|
|
2 |
use LeadersLinked\Model\CompanyMicrolearningUserLog;
|
|
|
3 |
|
|
|
4 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
5 |
$currentUser = $this->currentUserHelper();
|
|
|
6 |
$roleName = $currentUser->getUserTypeId();
|
|
|
7 |
|
|
|
8 |
$routeDatatable = $this->url('microlearning/students');
|
|
|
9 |
|
|
|
10 |
$allowEdit = $acl->isAllowed($roleName, 'microlearning/students/edit') ? 1 : 0;
|
|
|
11 |
$allowTimeline = $acl->isAllowed($roleName, 'microlearning/students/timeline') ? 1 : 0;
|
|
|
12 |
$allowChangePassword = $acl->isAllowed($roleName, 'microlearning/students/change-password') ? 1 : 0;
|
|
|
13 |
$allowUnblock = $acl->isAllowed($roleName, 'microlearning/students/unblock') ? 1 : 0;
|
|
|
14 |
|
16822 |
efrain |
15 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/nprogress/nprogress.css'));
|
|
|
16 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/nprogress/nprogress.js'));
|
1 |
www |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
|
20 |
|
|
|
21 |
|
16822 |
efrain |
22 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
|
|
|
24 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
|
1 |
www |
25 |
|
16822 |
efrain |
26 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.css'));
|
|
|
27 |
$this->headLink()->appendStylesheet($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.css'));
|
1 |
www |
28 |
|
16822 |
efrain |
29 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net/jquery.dataTables.js'));
|
|
|
30 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5/dataTables.bootstrap5.js'));
|
|
|
31 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/dataTables.responsive.min.js'));
|
|
|
32 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/datatables.net-bs5-responsive/responsive.bootstrap5.min.js'));
|
1 |
www |
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
16822 |
efrain |
37 |
|
|
|
38 |
|
|
|
39 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/jquery.validate.js'));
|
|
|
40 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/additional-methods.js'));
|
|
|
41 |
$this->inlineScript()->appendFile($this->basePath('assets/vendors/jquery-validation/localization/messages_es.js'));
|
|
|
42 |
|
1 |
www |
43 |
$activityApprovedTest = CompanyMicrolearningUserLog::ACTIVITY_APPROVED_TEST;
|
|
|
44 |
$activityCompletedCapsule = CompanyMicrolearningUserLog::ACTIVITY_COMPLETED_CAPSULE;
|
|
|
45 |
$activityCompletedTopic = CompanyMicrolearningUserLog::ACTIVITY_COMPLETED_TOPIC;
|
|
|
46 |
$activityRetakeATest = CompanyMicrolearningUserLog::ACTIVITY_RETAKE_A_TEST;
|
|
|
47 |
$activitySignin = CompanyMicrolearningUserLog::ACTIVITY_SIGNIN;
|
|
|
48 |
$activitySignout = CompanyMicrolearningUserLog::ACTIVITY_SIGNOUT;
|
|
|
49 |
$activityStartCapsule = CompanyMicrolearningUserLog::ACTIVITY_START_CAPSULE;
|
|
|
50 |
$activityStartTopic = CompanyMicrolearningUserLog::ACTIVITY_START_TOPIC;
|
|
|
51 |
$activityTakeATest = CompanyMicrolearningUserLog::ACTIVITY_TAKE_A_TEST;
|
|
|
52 |
$activityViewSlide = CompanyMicrolearningUserLog::ACTIVITY_VIEW_SLIDE;
|
|
|
53 |
|
16798 |
efrain |
54 |
$this->headStyle()->captureStart();
|
|
|
55 |
echo <<<CSS
|
|
|
56 |
thead, tbody { display: block; }
|
1 |
www |
57 |
|
16798 |
efrain |
58 |
tbody {
|
|
|
59 |
height: 200px; /* Just for the demo */
|
|
|
60 |
overflow-y: auto; /* Trigger vertical scroll */
|
|
|
61 |
overflow-x: hidden; /* Hide the horizontal scroll */
|
|
|
62 |
}
|
1 |
www |
63 |
|
16798 |
efrain |
64 |
CSS;
|
|
|
65 |
$this->headStyle()->captureEnd();
|
|
|
66 |
|
|
|
67 |
|
1 |
www |
68 |
$this->inlineScript()->captureStart();
|
|
|
69 |
echo <<<JS
|
|
|
70 |
|
|
|
71 |
|
|
|
72 |
jQuery( document ).ready(function( $ ) {
|
|
|
73 |
|
|
|
74 |
var routeUpload = '';
|
|
|
75 |
var routeNotification = '';
|
|
|
76 |
|
|
|
77 |
$.validator.addMethod('passwordStrengthCheck', function(value) {
|
|
|
78 |
return /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$^x%x*-]).{6,16}$/.test(value)
|
|
|
79 |
}, 'ERROR_PASSWORD_STRENGTH');
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
$.validator.setDefaults({
|
|
|
83 |
debug: true,
|
|
|
84 |
highlight: function(element) {
|
|
|
85 |
$(element).addClass('is-invalid');
|
|
|
86 |
},
|
|
|
87 |
unhighlight: function(element) {
|
|
|
88 |
$(element).removeClass('is-invalid');
|
|
|
89 |
},
|
|
|
90 |
errorElement: 'span',
|
|
|
91 |
errorClass: 'error invalid-feedback',
|
|
|
92 |
errorPlacement: function(error, element) {
|
|
|
93 |
if(element.parent('.btn-file').length) {
|
|
|
94 |
error.insertAfter(element.parent().parent());
|
|
|
95 |
} else if(element.parent('.toggle').length) {
|
|
|
96 |
error.insertAfter(element.parent().parent());
|
|
|
97 |
} else {
|
|
|
98 |
error.insertAfter(element.parent());
|
|
|
99 |
}
|
|
|
100 |
}
|
|
|
101 |
});
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
105 |
var field = $(fieldname);
|
|
|
106 |
if(field) {
|
|
|
107 |
$(field).addClass('is-invalid');
|
|
|
108 |
|
|
|
109 |
|
|
|
110 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
111 |
if(element.parent('.btn-file').length) {
|
|
|
112 |
error.insertAfter(element.parent().parent());
|
|
|
113 |
} else if(element.parent('.toggle').length) {
|
|
|
114 |
error.insertAfter(element.parent().parent());
|
|
|
115 |
} else {
|
|
|
116 |
error.insertAfter(element.parent());
|
|
|
117 |
}
|
|
|
118 |
}
|
|
|
119 |
};
|
|
|
120 |
|
|
|
121 |
var allowEdit = $allowEdit;
|
|
|
122 |
var allowTimeline = $allowTimeline;
|
|
|
123 |
var allowChangePassword = $allowChangePassword;
|
|
|
124 |
var allowUnblock = $allowUnblock;
|
|
|
125 |
|
|
|
126 |
|
|
|
127 |
var gridTable = $('#gridTable').dataTable( {
|
|
|
128 |
'processing': true,
|
|
|
129 |
'serverSide': true,
|
|
|
130 |
'searching': true,
|
|
|
131 |
'order': [[ 0, 'asc' ]],
|
|
|
132 |
'ordering': true,
|
|
|
133 |
'ordenable' : true,
|
|
|
134 |
'responsive': true,
|
|
|
135 |
'select' : false,
|
|
|
136 |
'paging': true,
|
|
|
137 |
'pagingType': 'simple_numbers',
|
|
|
138 |
|
|
|
139 |
|
|
|
140 |
'ajax': {
|
|
|
141 |
'url' : '$routeDatatable',
|
|
|
142 |
'type' : 'get',
|
|
|
143 |
|
|
|
144 |
'beforeSend': function (request) {
|
|
|
145 |
NProgress.start();
|
|
|
146 |
},
|
|
|
147 |
'dataFilter': function(response) {
|
|
|
148 |
var response = jQuery.parseJSON( response );
|
|
|
149 |
|
|
|
150 |
var json = {};
|
|
|
151 |
json.recordsTotal = 0;
|
|
|
152 |
json.recordsFiltered = 0;
|
|
|
153 |
json.data = [];
|
|
|
154 |
|
|
|
155 |
if(response.success) {
|
|
|
156 |
|
|
|
157 |
|
|
|
158 |
json.recordsTotal = response.data.total;
|
|
|
159 |
json.recordsFiltered = response.data.total;
|
|
|
160 |
json.data = response.data.items;
|
|
|
161 |
} else {
|
|
|
162 |
$.fn.showError(response.data)
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
return JSON.stringify( json );
|
|
|
166 |
}
|
|
|
167 |
},
|
|
|
168 |
'language' : {
|
|
|
169 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
170 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
171 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
172 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
173 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
174 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
175 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
176 |
'sInfoPostFix': '',
|
|
|
177 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
178 |
'sUrl': '',
|
|
|
179 |
'sInfoThousands': ',',
|
|
|
180 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
181 |
'oPaginate': {
|
|
|
182 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
183 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
184 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
185 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
186 |
},
|
|
|
187 |
'oAria': {
|
|
|
188 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
189 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
190 |
},
|
|
|
191 |
},
|
|
|
192 |
'drawCallback': function( settings ) {
|
|
|
193 |
NProgress.done();
|
16822 |
efrain |
194 |
|
1 |
www |
195 |
},
|
|
|
196 |
'aoColumns': [
|
|
|
197 |
{ 'mDataProp': 'first_name' },
|
|
|
198 |
{ 'mDataProp': 'last_name' },
|
|
|
199 |
{ 'mDataProp': 'email' },
|
|
|
200 |
{ 'mDataProp': 'details' },
|
|
|
201 |
{ 'mDataProp': 'actions' },
|
|
|
202 |
],
|
|
|
203 |
'columnDefs': [
|
|
|
204 |
{
|
|
|
205 |
'targets': -2,
|
|
|
206 |
'orderable': false,
|
|
|
207 |
'render' : function ( data, type, row ) {
|
|
|
208 |
s = '';
|
|
|
209 |
s = s + 'LABEL_TOTAL_ASIGNED : ' + data['total_asigned'] + '<br>';
|
|
|
210 |
s = s + 'LABEL_TOTAL_WITHOUT_STARTING : ' + data['total_without_starting'] + '<br>';
|
|
|
211 |
s = s + 'LABEL_TOTAL_STARTED : ' + data['total_started'] + '<br>';
|
|
|
212 |
s = s + 'LABEL_TOTAL_COMPLETED : ' + data['total_completed'] + '<br>';
|
|
|
213 |
|
|
|
214 |
return s;
|
|
|
215 |
}
|
|
|
216 |
},
|
|
|
217 |
|
|
|
218 |
|
|
|
219 |
{
|
|
|
220 |
'targets': -1,
|
|
|
221 |
'orderable': false,
|
|
|
222 |
'render' : function ( data, type, row ) {
|
|
|
223 |
s = '';
|
|
|
224 |
|
|
|
225 |
if(allowEdit && data['link_edit'] ) {
|
|
|
226 |
s = s + '<button class="btn btn-primary btn-sm btn-edit" style="margin-top: 5px" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button><br>';
|
|
|
227 |
}
|
|
|
228 |
if(allowTimeline && data['link_timeline'] ) {
|
|
|
229 |
s = s + '<button class="btn btn-info btn-sm btn-timeline" style="margin-top: 5px" data-href="' + data['link_timeline']+ '" data-toggle="tooltip" title="LABEL_TIMELINE"><i class="fa fa-th-list"></i> LABEL_ACTIVITIES</button><br>';
|
|
|
230 |
}
|
|
|
231 |
if(allowChangePassword && data['link_change_password']) {
|
|
|
232 |
s = s + '<button class="btn btn-success btn-sm btn-change-password" style="margin-top: 5px" data-href="' + data['link_change_password']+ '" data-toggle="tooltip" title="LABEL_CHANGE_PASSWORD"><i class="fa fa-key"></i> LABEL_PASSWORD </button><br>';
|
|
|
233 |
}
|
|
|
234 |
if(allowUnblock && data['link_unblock']) {
|
|
|
235 |
s = s + '<button class="btn btn-info btn-sm btn-unblock" style="margin-top: 5px" data-href="' + data['link_unblock']+ '" data-toggle="tooltip" title="LABEL_UNBLOCK"><i class="fa fa-unlock"></i> LABEL_UNBLOCK </button><br>';
|
|
|
236 |
}
|
|
|
237 |
|
|
|
238 |
|
|
|
239 |
|
|
|
240 |
return s;
|
|
|
241 |
}
|
|
|
242 |
}
|
|
|
243 |
],
|
|
|
244 |
});
|
|
|
245 |
|
|
|
246 |
var validatorEdit = $('#form-extend-user').validate({
|
|
|
247 |
debug: true,
|
|
|
248 |
onclick: false,
|
|
|
249 |
onkeyup: false,
|
|
|
250 |
ignore: [],
|
|
|
251 |
rules: {
|
|
|
252 |
'company_id': {
|
|
|
253 |
required: false,
|
|
|
254 |
},
|
|
|
255 |
'function_id': {
|
|
|
256 |
required: false,
|
|
|
257 |
},
|
|
|
258 |
'group_id': {
|
|
|
259 |
required: false,
|
|
|
260 |
},
|
|
|
261 |
'institution_id': {
|
|
|
262 |
required: false,
|
|
|
263 |
},
|
|
|
264 |
'program_id': {
|
|
|
265 |
required: false,
|
|
|
266 |
},
|
|
|
267 |
'partner_id': {
|
|
|
268 |
required: false,
|
|
|
269 |
},
|
|
|
270 |
'sector_id': {
|
|
|
271 |
required: false,
|
|
|
272 |
},
|
|
|
273 |
'student_type_id': {
|
|
|
274 |
required: false,
|
|
|
275 |
},
|
|
|
276 |
},
|
|
|
277 |
submitHandler: function(form)
|
|
|
278 |
{
|
|
|
279 |
|
|
|
280 |
$('input[type="submit"]').prop('disabled', true);
|
|
|
281 |
|
|
|
282 |
$.ajax({
|
|
|
283 |
'dataType' : 'json',
|
|
|
284 |
'accept' : 'application/json',
|
|
|
285 |
'method' : 'post',
|
|
|
286 |
'url' : $('#form-extend-user').attr('action'),
|
|
|
287 |
'data' : $('#form-extend-user').serialize(),
|
|
|
288 |
}).done(function(response) {
|
|
|
289 |
if(response['success']) {
|
|
|
290 |
$.fn.showSuccess(response['data']);
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
$('#modalExtendUser').modal('hide');
|
|
|
294 |
gridTable.api().ajax.reload(null, false);
|
|
|
295 |
} else {
|
|
|
296 |
validatorEdit.resetForm();
|
|
|
297 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
298 |
$.fn.showError(response['data']);
|
|
|
299 |
} else {
|
|
|
300 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
301 |
$.fn.showFormErrorValidator('#form-extend-user #' + fieldname, errors);
|
|
|
302 |
});
|
|
|
303 |
}
|
|
|
304 |
}
|
|
|
305 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
306 |
$.fn.showError(textStatus);
|
|
|
307 |
}).always(function() {
|
|
|
308 |
NProgress.done();
|
|
|
309 |
});
|
|
|
310 |
return false;
|
|
|
311 |
},
|
|
|
312 |
invalidHandler: function(form, validator) {
|
|
|
313 |
|
|
|
314 |
}
|
|
|
315 |
});
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
319 |
e.preventDefault();
|
|
|
320 |
|
|
|
321 |
var url = $(this).data('href');
|
|
|
322 |
$.ajax({
|
|
|
323 |
'dataType' : 'json',
|
|
|
324 |
'accept' : 'application/json',
|
|
|
325 |
'method' : 'get',
|
|
|
326 |
'url' : url,
|
|
|
327 |
}).done(function(response) {
|
|
|
328 |
if(response['success']) {
|
|
|
329 |
$('#form-extend-user').attr('action',url);
|
|
|
330 |
$('#form-extend-user #first_name').val(response['data']['first_name']);
|
|
|
331 |
$('#form-extend-user #last_name').val(response['data']['last_name']);
|
|
|
332 |
$('#form-extend-user #email').val(response['data']['email']);
|
|
|
333 |
$('#form-extend-user #company_id').val(response['data']['company_id']);
|
|
|
334 |
$('#form-extend-user #function_id').val(response['data']['function_id']);
|
|
|
335 |
$('#form-extend-user #group_id').val(response['data']['group_id']);
|
|
|
336 |
$('#form-extend-user #institution_id').val(response['data']['institution_id']);
|
|
|
337 |
$('#form-extend-user #program_id').val(response['data']['program_id']);
|
|
|
338 |
$('#form-extend-user #partner_id').val(response['data']['partner_id']);
|
|
|
339 |
$('#form-extend-user #sector_id').val(response['data']['sector_id']);
|
|
|
340 |
$('#form-extend-user #student_type_id').val(response['data']['student_type_id']);
|
|
|
341 |
|
|
|
342 |
|
|
|
343 |
|
|
|
344 |
$('#modalExtendUser').modal('show');
|
|
|
345 |
} else {
|
|
|
346 |
validatorEdit.resetForm();
|
|
|
347 |
if(jQuery.type(response['data']) == 'string') {
|
|
|
348 |
$.fn.showError(response['data']);
|
|
|
349 |
} else {
|
|
|
350 |
$.each(response['data'], function( fieldname, errors ) {
|
|
|
351 |
$.fn.showFormErrorValidator('#form-extend-user #' + fieldname, errors);
|
|
|
352 |
});
|
|
|
353 |
}
|
|
|
354 |
}
|
|
|
355 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
356 |
$.fn.showError(textStatus);
|
|
|
357 |
}).always(function() {
|
|
|
358 |
NProgress.done();
|
|
|
359 |
});
|
|
|
360 |
});
|
|
|
361 |
|
|
|
362 |
$('body').on('click', 'button.btn-timeline', function(e) {
|
|
|
363 |
e.preventDefault();
|
|
|
364 |
|
|
|
365 |
var url = $(this).data('href');
|
|
|
366 |
$.ajax({
|
|
|
367 |
'dataType' : 'json',
|
|
|
368 |
'accept' : 'application/json',
|
|
|
369 |
'method' : 'get',
|
|
|
370 |
'url' : url,
|
|
|
371 |
}).done(function(response) {
|
|
|
372 |
if(response['success']) {
|
|
|
373 |
|
|
|
374 |
$('div.timeline').empty();
|
|
|
375 |
|
|
|
376 |
$.fn.renderTimeLine(response['data']);
|
|
|
377 |
|
|
|
378 |
$('#modalTimeline').modal('show');
|
|
|
379 |
} else {
|
|
|
380 |
$.fn.showError(response['data']);
|
|
|
381 |
}
|
|
|
382 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
383 |
$.fn.showError(textStatus);
|
|
|
384 |
}).always(function() {
|
|
|
385 |
NProgress.done();
|
|
|
386 |
});
|
|
|
387 |
});
|
|
|
388 |
|
|
|
389 |
|
|
|
390 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
391 |
e.preventDefault();
|
|
|
392 |
$('#modalExtendUser').modal('hide');
|
|
|
393 |
$('#modalTimeline').modal('hide');
|
|
|
394 |
$('#modalChangePassword').modal('hide');
|
|
|
395 |
});
|
|
|
396 |
|
16822 |
efrain |
397 |
$('body').on('click', 'button.btn-unblock', function(e) {
|
|
|
398 |
e.preventDefault();
|
|
|
399 |
var action = $(this).data('href');
|
|
|
400 |
|
|
|
401 |
|
|
|
402 |
swal.fire({
|
|
|
403 |
title: 'LABEL_ARE_YOU_SURE',
|
|
|
404 |
icon: 'question',
|
|
|
405 |
cancelButtonText: 'LABEL_NO',
|
|
|
406 |
showCancelButton: true,
|
|
|
407 |
confirmButtonText: 'LABEL_YES'
|
|
|
408 |
}).then((result) => {
|
|
|
409 |
if (result.isConfirmed) {
|
|
|
410 |
|
|
|
411 |
NProgress.start();
|
|
|
412 |
$.ajax({
|
|
|
413 |
'dataType' : 'json',
|
|
|
414 |
'accept' : 'application/json',
|
|
|
415 |
'method' : 'post',
|
|
|
416 |
'url' : action,
|
|
|
417 |
}).done(function(response) {
|
|
|
418 |
if(response['success']) {
|
|
|
419 |
$.fn.showSuccess(response['data']);
|
|
|
420 |
gridTable.api().ajax.reload(null, false);
|
|
|
421 |
} else {
|
|
|
422 |
$.fn.showError(response['data']);
|
|
|
423 |
}
|
|
|
424 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
425 |
$.fn.showError(textStatus);
|
|
|
426 |
}).always(function() {
|
|
|
427 |
NProgress.done();
|
|
|
428 |
});
|
|
|
429 |
}
|
|
|
430 |
});
|
|
|
431 |
});
|
1 |
www |
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
436 |
e.preventDefault();
|
|
|
437 |
gridTable.api().ajax.reload(null, false);
|
|
|
438 |
});
|
|
|
439 |
|
|
|
440 |
$.fn.renderTimeLine = function(data) {
|
|
|
441 |
|
|
|
442 |
$.each(data['current']['items'],function(index, record) {
|
|
|
443 |
|
|
|
444 |
switch(record['activity'])
|
|
|
445 |
{
|
|
|
446 |
case '$activityApprovedTest' :
|
|
|
447 |
activity = 'LABEL_TIMELINE_ACTIVITY_APPROVED_TEST';
|
|
|
448 |
image = '/img/microlearning/approved-test.svg';
|
|
|
449 |
break;
|
|
|
450 |
|
|
|
451 |
case '$activityCompletedCapsule' :
|
|
|
452 |
activity = 'LABEL_TIMELINE_ACTIVITY_COMPLETED_CAPSULE';
|
|
|
453 |
image = '/img/microlearning/completed-capsule.svg';
|
|
|
454 |
break;
|
|
|
455 |
|
|
|
456 |
case '$activityCompletedTopic' :
|
|
|
457 |
activity = 'LABEL_TIMELINE_ACTIVITY_COMPLETED_TOPIC';
|
|
|
458 |
image = '/img/microlearning/completed-topic.svg';
|
|
|
459 |
break;
|
|
|
460 |
|
|
|
461 |
case '$activityRetakeATest' :
|
|
|
462 |
activity = 'LABEL_TIMELINE_ACTIVITY_RETAKE_A_TEST';
|
|
|
463 |
image = '/img/microlearning/retake-a-test.svg';
|
|
|
464 |
break;
|
|
|
465 |
|
|
|
466 |
case '$activitySignin' :
|
|
|
467 |
activity = 'LABEL_TIMELINE_ACTIVITY_SIGNIN';
|
|
|
468 |
image = '/img/microlearning/sign-in.svg';
|
|
|
469 |
break;
|
|
|
470 |
|
|
|
471 |
case '$activitySignout' :
|
|
|
472 |
activity = 'LABEL_TIMELINE_ACTIVITY_SIGNOUT';
|
|
|
473 |
image = '/img/microlearning/sign-out.svg';
|
|
|
474 |
break;
|
|
|
475 |
|
|
|
476 |
case '$activityStartCapsule' :
|
|
|
477 |
activity = 'LABEL_TIMELINE_ACTIVITY_START_CAPSULE';
|
|
|
478 |
image = '/img/microlearning/start-capsule.svg';
|
|
|
479 |
break;
|
|
|
480 |
|
|
|
481 |
case '$activityStartTopic' :
|
|
|
482 |
activity = 'LABEL_TIMELINE_ACTIVITY_START_TOPIC';
|
|
|
483 |
image = '/img/microlearning/start-topic.svg';
|
|
|
484 |
break;
|
|
|
485 |
|
|
|
486 |
case '$activityTakeATest' :
|
|
|
487 |
activity = 'LABEL_TIMELINE_ACTIVITY_TAKE_A_TEST';
|
|
|
488 |
image = '/img/microlearning/take-a-test.svg';
|
|
|
489 |
break;
|
|
|
490 |
|
|
|
491 |
case '$activityViewSlide' :
|
|
|
492 |
activity = 'LABEL_TIMELINE_ACTIVITY_VIEW_SLIDE';
|
|
|
493 |
image = '/img/microlearning/view-slide.svg';
|
|
|
494 |
break;
|
|
|
495 |
|
|
|
496 |
default :
|
|
|
497 |
activity = '';
|
|
|
498 |
break;
|
|
|
499 |
}
|
|
|
500 |
|
|
|
501 |
if(activity) {
|
|
|
502 |
|
|
|
503 |
|
|
|
504 |
var s = '<div>';
|
|
|
505 |
s = s + '<img src="' + image + '" style="width: 32px; height: auto" />';
|
|
|
506 |
s = s + '<div class="timeline-item">';
|
|
|
507 |
s = s + '<span class="time"><i class="fas fa-clock"></i> ' + record['added_on'] +'</span>';
|
|
|
508 |
s = s + '<h3 class="timeline-header">' + activity + '</h3>';
|
|
|
509 |
|
|
|
510 |
if(record['topic'] || record['capsule'] || record['slide']) {
|
|
|
511 |
s = s + '<div class="timeline-body">';
|
|
|
512 |
|
|
|
513 |
if(record['topic']) {
|
|
|
514 |
s = s + 'LABEL_TOPIC : ' + record['topic'] + '<br>';
|
|
|
515 |
}
|
|
|
516 |
if(record['capsule']) {
|
|
|
517 |
s = s + ' LABEL_CAPSULE : ' + record['capsule'] + '<br>';
|
|
|
518 |
}
|
|
|
519 |
if(record['slide']) {
|
|
|
520 |
s = s + ' LABEL_SLIDE : ' + record['slide'] + '<br>';
|
|
|
521 |
}
|
|
|
522 |
s = s + '</div>';
|
|
|
523 |
}
|
|
|
524 |
|
|
|
525 |
s = s + '</div>';
|
|
|
526 |
s = s + '</div>';
|
|
|
527 |
|
|
|
528 |
$('div.timeline').append(s);
|
|
|
529 |
}
|
|
|
530 |
|
|
|
531 |
});
|
|
|
532 |
}
|
|
|
533 |
|
|
|
534 |
|
|
|
535 |
var validatorChangePassword = $('#form-change-password').validate({
|
|
|
536 |
debug: true,
|
|
|
537 |
onclick: false,
|
|
|
538 |
onkeyup: false,
|
|
|
539 |
ignore: [':hidden'],
|
|
|
540 |
rules: {
|
|
|
541 |
|
|
|
542 |
'password': {
|
|
|
543 |
required: true,
|
|
|
544 |
minlength: 6,
|
|
|
545 |
maxlength: 16,
|
|
|
546 |
passwordStrengthCheck: true,
|
|
|
547 |
},
|
|
|
548 |
'confirmation' : {
|
|
|
549 |
required: true,
|
|
|
550 |
minlength: 6,
|
|
|
551 |
maxlength: 16,
|
|
|
552 |
equalTo: '#form-change-password #password'
|
|
|
553 |
},
|
|
|
554 |
},
|
|
|
555 |
submitHandler: function(form)
|
|
|
556 |
{
|
|
|
557 |
NProgress.start();
|
|
|
558 |
$.ajax({
|
|
|
559 |
'dataType' : 'json',
|
|
|
560 |
'accept' : 'application/json',
|
|
|
561 |
'method' : 'post',
|
|
|
562 |
'url' : $('#form-change-password').attr('action'),
|
|
|
563 |
'data' : $('#form-change-password').serialize()
|
|
|
564 |
}).done(function(response) {
|
|
|
565 |
if(response.success) {
|
|
|
566 |
$.fn.showSuccess(response.data);
|
|
|
567 |
|
|
|
568 |
$('#modalChangePassword').modal('hide');
|
|
|
569 |
gridTable.api().ajax.reload(null, false);
|
|
|
570 |
} else {
|
|
|
571 |
if(jQuery.type(response.data) == 'string') {
|
|
|
572 |
$.fn.showError(response.data)
|
|
|
573 |
} else {
|
|
|
574 |
$.each(response.data, function( fieldname, errors ) {
|
|
|
575 |
$.fn.showFormErrorValidator('#form-change-password #' + fieldname, errors);
|
|
|
576 |
});
|
|
|
577 |
}
|
|
|
578 |
}
|
|
|
579 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
580 |
$.fn.showError(textStatus)
|
|
|
581 |
|
|
|
582 |
}).always(function() {
|
|
|
583 |
NProgress.done();
|
|
|
584 |
})
|
|
|
585 |
},
|
|
|
586 |
invalidHandler: function(form, validator) {
|
|
|
587 |
}
|
|
|
588 |
});
|
|
|
589 |
|
|
|
590 |
$('body').on('click', 'button.btn-change-password', function(e) {
|
|
|
591 |
e.preventDefault();
|
|
|
592 |
|
|
|
593 |
NProgress.start();
|
|
|
594 |
var action = $(this).data('href');
|
|
|
595 |
|
|
|
596 |
$.ajax({
|
|
|
597 |
'dataType' : 'json',
|
|
|
598 |
'accept' : 'application/json',
|
|
|
599 |
'method' : 'get',
|
|
|
600 |
'url' : action,
|
|
|
601 |
}).done(function(response) {
|
|
|
602 |
if(response['success']) {
|
|
|
603 |
|
|
|
604 |
$('#form-change-password').attr('action', action);
|
|
|
605 |
$('#form-change-password #first_name').val(response['data']['first_name']);
|
|
|
606 |
$('#form-change-password #last_name').val(response['data']['last_name']);
|
|
|
607 |
$('#form-change-password #email').val(response['data']['email']);
|
|
|
608 |
$('#form-change-password #password').val('');
|
|
|
609 |
$('#form-change-password #confirmation').val('');
|
|
|
610 |
validatorChangePassword.resetForm();
|
|
|
611 |
|
|
|
612 |
$('#modalChangePassword').modal('show');
|
|
|
613 |
} else {
|
|
|
614 |
$.fn.showError(response['data']);
|
|
|
615 |
}
|
|
|
616 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
617 |
$.fn.showError(textStatus);
|
|
|
618 |
}).always(function() {
|
|
|
619 |
NProgress.done();
|
|
|
620 |
});
|
|
|
621 |
|
|
|
622 |
});
|
|
|
623 |
|
|
|
624 |
|
|
|
625 |
|
|
|
626 |
});
|
|
|
627 |
JS;
|
|
|
628 |
$this->inlineScript()->captureEnd();
|
|
|
629 |
?>
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
<!-- Content Header (Page header) -->
|
|
|
633 |
<section class="content-header">
|
|
|
634 |
<div class="container-fluid">
|
|
|
635 |
<div class="row mb-2">
|
|
|
636 |
<div class="col-sm-12">
|
|
|
637 |
<h1>LABEL_STUDENTS</h1>
|
|
|
638 |
</div>
|
|
|
639 |
</div>
|
|
|
640 |
</div><!-- /.container-fluid -->
|
|
|
641 |
</section>
|
|
|
642 |
|
|
|
643 |
<section class="content">
|
|
|
644 |
<div class="container-fluid">
|
|
|
645 |
<div class="row">
|
|
|
646 |
<div class="col-12">
|
|
|
647 |
<div class="card">
|
|
|
648 |
<div class="card-header">
|
|
|
649 |
</div>
|
|
|
650 |
<div class="card-body">
|
16845 |
efrain |
651 |
<table id="gridTable" class="table table-bordered">
|
1 |
www |
652 |
<thead>
|
|
|
653 |
<tr>
|
|
|
654 |
<th>LABEL_FIRST_NAME</th>
|
|
|
655 |
<th>LABEL_LAST_NAME</th>
|
|
|
656 |
<th>LABEL_EMAIL</th>
|
|
|
657 |
<th>LABEL_CAPSULES</th>
|
|
|
658 |
<th>LABEL_ACTIONS</th>
|
|
|
659 |
</tr>
|
|
|
660 |
</thead>
|
|
|
661 |
<tbody>
|
|
|
662 |
</tbody>
|
|
|
663 |
</table>
|
|
|
664 |
</div>
|
|
|
665 |
<div class="card-footer clearfix">
|
|
|
666 |
</div>
|
|
|
667 |
</div>
|
|
|
668 |
</div>
|
|
|
669 |
</div>
|
|
|
670 |
</div>
|
|
|
671 |
</section>
|
|
|
672 |
|
|
|
673 |
|
|
|
674 |
<!-- The Modal -->
|
|
|
675 |
<div class="modal" id="modalExtendUser">
|
|
|
676 |
<div class="modal-dialog modal-xl">
|
|
|
677 |
<div class="modal-content">
|
|
|
678 |
|
|
|
679 |
<!-- Modal Header -->
|
|
|
680 |
<div class="modal-header">
|
16845 |
efrain |
681 |
<h6 class="modal-title">LABEL_EDIT</h6>
|
16822 |
efrain |
682 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
1 |
www |
683 |
</div>
|
|
|
684 |
|
|
|
685 |
<!-- Modal body -->
|
|
|
686 |
<div class="modal-body">
|
|
|
687 |
<?php
|
|
|
688 |
$form = $this->formExtendUser;
|
|
|
689 |
$form->setAttributes([
|
|
|
690 |
'method' => 'post',
|
|
|
691 |
'name' => 'form-extend-user',
|
|
|
692 |
'id' => 'form-extend-user'
|
|
|
693 |
]);
|
|
|
694 |
|
|
|
695 |
$form->prepare();
|
|
|
696 |
echo $this->form()->openTag($form);
|
|
|
697 |
|
|
|
698 |
?>
|
|
|
699 |
|
|
|
700 |
<div class="form-group">
|
|
|
701 |
<label>LABEL_FIRST_NAME</label>
|
|
|
702 |
<input type="text" readonly="readonly" name="first_name" id="first_name" class="form-control" >
|
|
|
703 |
</div>
|
|
|
704 |
<div class="form-group">
|
|
|
705 |
<label>LABEL_LAST_NAME</label>
|
|
|
706 |
<input type="text" readonly="readonly" name="last_name" id="last_name" class="form-control" >
|
|
|
707 |
</div>
|
|
|
708 |
<div class="form-group">
|
|
|
709 |
<label>LABEL_EMAIL</label>
|
|
|
710 |
<input type="text" readonly="readonly" name="email" id="email" class="form-control" >
|
|
|
711 |
</div>
|
|
|
712 |
|
|
|
713 |
<?php
|
|
|
714 |
$fields = [
|
|
|
715 |
[
|
|
|
716 |
'label' => 'LABEL_COMPANIES',
|
|
|
717 |
'name' => 'company_id',
|
|
|
718 |
],
|
|
|
719 |
[
|
|
|
720 |
'label' => 'LABEL_FUNCTIONS',
|
|
|
721 |
'name' => 'function_id',
|
|
|
722 |
],
|
|
|
723 |
[
|
|
|
724 |
'label' => 'LABEL_GROUPS',
|
|
|
725 |
'name' => 'group_id',
|
|
|
726 |
],
|
|
|
727 |
[
|
|
|
728 |
'label' => 'LABEL_INSTITUTIONS',
|
|
|
729 |
'name' => 'institution_id',
|
|
|
730 |
],
|
|
|
731 |
[
|
|
|
732 |
'label' => 'LABEL_PROGRAMS',
|
|
|
733 |
'name' => 'program_id',
|
|
|
734 |
],
|
|
|
735 |
[
|
|
|
736 |
'label' => 'LABEL_PARTNERS',
|
|
|
737 |
'name' => 'partner_id',
|
|
|
738 |
],
|
|
|
739 |
[
|
|
|
740 |
'label' => 'LABEL_SECTORS',
|
|
|
741 |
'name' => 'sector_id',
|
|
|
742 |
],
|
|
|
743 |
[
|
|
|
744 |
'label' => 'LABEL_STUDENT_TYPES',
|
|
|
745 |
'name' => 'student_type_id',
|
|
|
746 |
],
|
|
|
747 |
];
|
|
|
748 |
|
|
|
749 |
$column = 0;
|
|
|
750 |
foreach($fields as $field) :
|
|
|
751 |
if($column == 0) {
|
|
|
752 |
echo '<div class="row">';
|
|
|
753 |
|
|
|
754 |
}
|
|
|
755 |
$column++;
|
|
|
756 |
|
|
|
757 |
?>
|
|
|
758 |
|
|
|
759 |
|
|
|
760 |
<div class="col-md-6 col-sm-12">
|
|
|
761 |
<div class="form-group">
|
|
|
762 |
<?php
|
|
|
763 |
$element = $form->get( $field['name'] );
|
|
|
764 |
$element->setOptions(['label' => $field['label'] ]);
|
|
|
765 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
766 |
|
|
|
767 |
echo $this->formLabel($element);
|
|
|
768 |
echo $this->formSelect($element);
|
|
|
769 |
?>
|
|
|
770 |
</div>
|
|
|
771 |
</div>
|
|
|
772 |
<?php
|
|
|
773 |
if($column == 2) {
|
|
|
774 |
$column = 0;
|
|
|
775 |
echo '</div>';
|
|
|
776 |
}
|
|
|
777 |
?>
|
|
|
778 |
<?php endforeach; ?>
|
|
|
779 |
<?php if($column) {
|
|
|
780 |
echo '</div>';
|
|
|
781 |
}
|
|
|
782 |
?>
|
|
|
783 |
|
|
|
784 |
|
|
|
785 |
<div class="form-group">
|
|
|
786 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
787 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
788 |
</div>
|
|
|
789 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
790 |
</div>
|
|
|
791 |
|
|
|
792 |
<!-- Modal footer -->
|
|
|
793 |
<div class="modal-footer">
|
16822 |
efrain |
794 |
<button type="button" class="btn btn-light" data-bs-dismiss="modal">LABEL_CLOSE</button>
|
1 |
www |
795 |
</div>
|
|
|
796 |
|
|
|
797 |
</div>
|
|
|
798 |
</div>
|
|
|
799 |
</div>
|
|
|
800 |
|
|
|
801 |
<!-- The Modal -->
|
|
|
802 |
<div class="modal" id="modalTimeline">
|
|
|
803 |
<div class="modal-dialog modal-xl">
|
|
|
804 |
<div class="modal-content">
|
|
|
805 |
|
|
|
806 |
<!-- Modal Header -->
|
|
|
807 |
<div class="modal-header">
|
16845 |
efrain |
808 |
<h6 class="modal-title">LABEL_TIMELINE</h6>
|
16822 |
efrain |
809 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
1 |
www |
810 |
</div>
|
|
|
811 |
|
|
|
812 |
<!-- Modal body -->
|
|
|
813 |
<div class="modal-body">
|
|
|
814 |
<div class="row">
|
|
|
815 |
<div class="col-md-12">
|
|
|
816 |
<div class="timeline">
|
|
|
817 |
</div>
|
|
|
818 |
</div>
|
|
|
819 |
</div>
|
|
|
820 |
</div>
|
|
|
821 |
|
|
|
822 |
<!-- Modal footer -->
|
|
|
823 |
<div class="modal-footer">
|
16822 |
efrain |
824 |
<button type="button" class="btn btn-light" data-bs-dismiss="modal">LABEL_CLOSE</button>
|
1 |
www |
825 |
</div>
|
|
|
826 |
|
|
|
827 |
</div>
|
|
|
828 |
</div>
|
|
|
829 |
</div>
|
|
|
830 |
|
|
|
831 |
<!-- The Modal -->
|
|
|
832 |
<div class="modal" id="modalChangePassword">
|
|
|
833 |
<div class="modal-dialog">
|
|
|
834 |
<div class="modal-content">
|
|
|
835 |
|
|
|
836 |
<!-- Modal Header -->
|
|
|
837 |
<div class="modal-header">
|
16845 |
efrain |
838 |
<h6 class="modal-title">LABEL_USERS</h6>
|
16822 |
efrain |
839 |
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="btn-close"></button>
|
1 |
www |
840 |
</div>
|
|
|
841 |
|
|
|
842 |
<!-- Modal body -->
|
|
|
843 |
<div class="modal-body">
|
|
|
844 |
<?php
|
|
|
845 |
$form = $this->formChangePassword;
|
|
|
846 |
$form->setAttributes([
|
|
|
847 |
'method' => 'post',
|
|
|
848 |
'name' => 'form-change-password',
|
|
|
849 |
'id' => 'form-change-password'
|
|
|
850 |
]);
|
|
|
851 |
|
|
|
852 |
$form->prepare();
|
|
|
853 |
echo $this->form()->openTag($form);
|
|
|
854 |
?>
|
|
|
855 |
<div class="form-group">
|
|
|
856 |
<?php
|
|
|
857 |
$element = $form->get('first_name');
|
|
|
858 |
$element->setOptions(['label' => 'LABEL_FIRST_NAME']);
|
|
|
859 |
$element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
|
|
|
860 |
|
|
|
861 |
echo $this->formLabel($element);
|
|
|
862 |
echo $this->formText($element);
|
|
|
863 |
?>
|
|
|
864 |
</div>
|
|
|
865 |
<div class="form-group">
|
|
|
866 |
<?php
|
|
|
867 |
$element = $form->get('last_name');
|
|
|
868 |
$element->setOptions(['label' => 'LABEL_LAST_NAME']);
|
|
|
869 |
$element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
|
|
|
870 |
|
|
|
871 |
echo $this->formLabel($element);
|
|
|
872 |
echo $this->formText($element);
|
|
|
873 |
?>
|
|
|
874 |
</div>
|
|
|
875 |
<div class="form-group">
|
|
|
876 |
<?php
|
|
|
877 |
$element = $form->get('email');
|
|
|
878 |
$element->setOptions(['label' => 'LABEL_EMAIL']);
|
|
|
879 |
$element->setAttributes(['class' => 'form-control', 'readonly' => 'readonly']);
|
|
|
880 |
|
|
|
881 |
echo $this->formLabel($element);
|
|
|
882 |
echo $this->formText($element);
|
|
|
883 |
?>
|
|
|
884 |
</div>
|
|
|
885 |
<div class="form-group">
|
|
|
886 |
<?php
|
|
|
887 |
$element = $form->get('password');
|
|
|
888 |
$element->setOptions(['label' => 'LABEL_PASSWORD']);
|
|
|
889 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
890 |
|
|
|
891 |
echo $this->formLabel($element);
|
|
|
892 |
echo $this->formPassword($element);
|
|
|
893 |
?>
|
|
|
894 |
</div>
|
|
|
895 |
<div class="form-group">
|
|
|
896 |
<?php
|
|
|
897 |
$element = $form->get('confirmation');
|
|
|
898 |
$element->setOptions(['label' => 'LABEL_CONFIRMATION']);
|
|
|
899 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
900 |
|
|
|
901 |
echo $this->formLabel($element);
|
|
|
902 |
echo $this->formPassword($element);
|
|
|
903 |
?>
|
|
|
904 |
</div>
|
|
|
905 |
|
|
|
906 |
|
|
|
907 |
<div class="form-group">
|
|
|
908 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
909 |
<button type="button" class="btn btn-light btn-cancel-modal">LABEL_CANCEL</button>
|
|
|
910 |
</div>
|
|
|
911 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
912 |
</div>
|
|
|
913 |
|
|
|
914 |
<!-- Modal footer -->
|
|
|
915 |
<div class="modal-footer">
|
16822 |
efrain |
916 |
<button type="button" class="btn btn-light" data-bs-dismiss="modal">LABEL_CLOSE</button>
|
1 |
www |
917 |
</div>
|
|
|
918 |
|
|
|
919 |
</div>
|
|
|
920 |
</div>
|
|
|
921 |
</div>
|
|
|
922 |
|
|
|
923 |
|