15337 |
efrain |
1 |
<?php
|
|
|
2 |
$acl = $this->viewModel()->getRoot()->getVariable('acl');
|
|
|
3 |
$currentUser = $this->currentUserHelper();
|
|
|
4 |
|
|
|
5 |
$roleName = $currentUser->getUserTypeId();
|
|
|
6 |
|
|
|
7 |
|
|
|
8 |
$routeDatatable = $this->url('settings/private-networks');
|
|
|
9 |
$routeAdd = $this->url('settings/private-networks/add');
|
|
|
10 |
|
|
|
11 |
$allowAdd = $acl->isAllowed($roleName, 'settings/private-networks/add') ? 1 : 0;
|
|
|
12 |
$allowEdit = $acl->isAllowed($roleName, 'settings/private-networks/edit') ? 1 : 0;
|
|
|
13 |
$allowDelete = $acl->isAllowed($roleName, 'settings/private-networks/delete') ? 1 : 0;
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
|
|
|
17 |
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
|
|
|
18 |
|
|
|
19 |
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
|
|
|
20 |
|
|
|
21 |
|
|
|
22 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
|
|
|
23 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
|
|
|
24 |
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
|
|
|
25 |
|
|
|
26 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-bs4/css/dataTables.bootstrap4.min.css'));
|
|
|
27 |
$this->headLink()->appendStylesheet($this->basePath('plugins/datatables-responsive/css/responsive.bootstrap4.min.css'));
|
|
|
28 |
|
|
|
29 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables/jquery.dataTables.min.js'));
|
|
|
30 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-bs4/js/dataTables.bootstrap4.min.js'));
|
|
|
31 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/dataTables.responsive.min.js'));
|
|
|
32 |
$this->inlineScript()->appendFile($this->basePath('plugins/datatables-responsive/js/responsive.bootstrap4.min.js'));
|
|
|
33 |
|
|
|
34 |
|
|
|
35 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
|
|
|
36 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
|
|
|
37 |
|
|
|
38 |
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-confirmation/dist/bootstrap-confirmation.js'));
|
|
|
39 |
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-checkbox/awesome-bootstrap-checkbox.css'));
|
|
|
40 |
|
|
|
41 |
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.js'));
|
|
|
42 |
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/i18n/es.js'));
|
|
|
43 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.css'));
|
|
|
44 |
|
|
|
45 |
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.css'));
|
|
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
|
49 |
$status_active = \LeadersLinked\Model\Network::STATUS_ACTIVE;
|
|
|
50 |
|
|
|
51 |
$this->inlineScript()->captureStart();
|
|
|
52 |
echo <<<JS
|
|
|
53 |
jQuery( document ).ready(function( $ ) {
|
|
|
54 |
$.validator.addMethod('passwordStrengthCheck', function(value) {
|
|
|
55 |
return /^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9])(?=.*?[#?!@$^x%x*-]).{6,16}$/.test(value)
|
|
|
56 |
}, 'ERROR_PASSWORD_STRENGTH');
|
|
|
57 |
|
|
|
58 |
var allowEdit = $allowEdit;
|
|
|
59 |
var allowDelete = $allowDelete;
|
|
|
60 |
|
|
|
61 |
$.validator.setDefaults({
|
|
|
62 |
debug: true,
|
|
|
63 |
highlight: function(element) {
|
|
|
64 |
$(element).addClass('is-invalid');
|
|
|
65 |
},
|
|
|
66 |
unhighlight: function(element) {
|
|
|
67 |
$(element).removeClass('is-invalid');
|
|
|
68 |
},
|
|
|
69 |
errorElement: 'span',
|
|
|
70 |
errorClass: 'error invalid-feedback',
|
|
|
71 |
errorPlacement: function(error, element) {
|
|
|
72 |
if(element.parent('.form-group').length) {
|
|
|
73 |
error.insertAfter(element);
|
|
|
74 |
} else if(element.parent('.toggle').length) {
|
|
|
75 |
error.insertAfter(element.parent().parent());
|
|
|
76 |
} else {
|
|
|
77 |
error.insertAfter(element.parent());
|
|
|
78 |
}
|
|
|
79 |
}
|
|
|
80 |
});
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
$.fn.showFormErrorValidator = function(fieldname, errors) {
|
|
|
84 |
var field = $(fieldname);
|
|
|
85 |
if(field) {
|
|
|
86 |
$(field).addClass('is-invalid');
|
|
|
87 |
|
|
|
88 |
var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
|
|
|
89 |
if(field.parent('.form-group').length) {
|
|
|
90 |
error.insertAfter(field);
|
|
|
91 |
} else if(field.parent('.toggle').length) {
|
|
|
92 |
error.insertAfter(field.parent().parent());
|
|
|
93 |
} else {
|
|
|
94 |
error.insertAfter(field.parent());
|
|
|
95 |
}
|
|
|
96 |
}
|
|
|
97 |
};
|
|
|
98 |
|
|
|
99 |
var gridTable = $('#gridTable').dataTable( {
|
|
|
100 |
'processing': true,
|
|
|
101 |
'serverSide': true,
|
|
|
102 |
'searching': true,
|
|
|
103 |
'order': [[ 0, 'asc' ]],
|
|
|
104 |
'ordering': true,
|
|
|
105 |
'ordenable' : true,
|
|
|
106 |
'responsive': true,
|
|
|
107 |
'select' : false,
|
|
|
108 |
'paging': true,
|
|
|
109 |
'pagingType': 'simple_numbers',
|
|
|
110 |
'ajax': {
|
|
|
111 |
'url' : '$routeDatatable',
|
|
|
112 |
'type' : 'get',
|
|
|
113 |
'beforeSend': function (request) {
|
|
|
114 |
NProgress.start();
|
|
|
115 |
},
|
|
|
116 |
'dataFilter': function(response) {
|
|
|
117 |
var response = jQuery.parseJSON( response );
|
|
|
118 |
|
|
|
119 |
var json = {};
|
|
|
120 |
json.recordsTotal = 0;
|
|
|
121 |
json.recordsFiltered = 0;
|
|
|
122 |
json.data = [];
|
|
|
123 |
|
|
|
124 |
|
|
|
125 |
if(response.success) {
|
|
|
126 |
json.recordsTotal = response.data.total;
|
|
|
127 |
json.recordsFiltered = response.data.total;
|
|
|
128 |
json.data = response.data.items;
|
|
|
129 |
} else {
|
|
|
130 |
$.fn.showError(response.data)
|
|
|
131 |
}
|
|
|
132 |
|
|
|
133 |
return JSON.stringify( json );
|
|
|
134 |
}
|
|
|
135 |
},
|
|
|
136 |
'language' : {
|
|
|
137 |
'sProcessing': 'LABEL_DATATABLE_SPROCESSING',
|
|
|
138 |
'sLengthMenu': 'LABEL_DATATABLE_SLENGTHMENU',
|
|
|
139 |
'sZeroRecords': 'LABEL_DATATABLE_SZERORECORDS',
|
|
|
140 |
'sEmptyTable': 'LABEL_DATATABLE_SEMPTYTABLE',
|
|
|
141 |
'sInfo': 'LABEL_DATATABLE_SINFO',
|
|
|
142 |
'sInfoEmpty': 'LABEL_DATATABLE_SINFOEMPTY',
|
|
|
143 |
'sInfoFiltered': 'LABEL_DATATABLE_SINFOFILTERED',
|
|
|
144 |
'sInfoPostFix': '',
|
|
|
145 |
'sSearch': 'LABEL_DATATABLE_SSEARCH',
|
|
|
146 |
'sUrl': '',
|
|
|
147 |
'sInfoThousands': ',',
|
|
|
148 |
'sLoadingRecords': 'LABEL_DATATABLE_SLOADINGRECORDS',
|
|
|
149 |
'oPaginate': {
|
|
|
150 |
'sFirst': 'LABEL_DATATABLE_SFIRST',
|
|
|
151 |
'sLast': 'LABEL_DATATABLE_SLAST',
|
|
|
152 |
'sNext': 'LABEL_DATATABLE_SNEXT',
|
|
|
153 |
'sPrevious': 'LABEL_DATATABLE_SPREVIOUS'
|
|
|
154 |
},
|
|
|
155 |
'oAria': {
|
|
|
156 |
'sSortAscending': ': LABEL_DATATABLE_SSORTASCENDING',
|
|
|
157 |
'sSortDescending': ':LABEL_DATATABLE_SSORTDESCENDING'
|
|
|
158 |
},
|
|
|
159 |
},
|
|
|
160 |
'drawCallback': function( settings ) {
|
|
|
161 |
NProgress.done();
|
|
|
162 |
$('button.btn-delete').confirmation({
|
|
|
163 |
rootSelector: 'button.btn-delete',
|
|
|
164 |
title : 'LABEL_ARE_YOU_SURE',
|
|
|
165 |
singleton : true,
|
|
|
166 |
btnOkLabel: 'LABEL_YES',
|
|
|
167 |
btnCancelLabel: 'LABEL_NO',
|
|
|
168 |
onConfirm: function(value) {
|
|
|
169 |
var action = $(this).data('href');
|
|
|
170 |
NProgress.start();
|
|
|
171 |
$.ajax({
|
|
|
172 |
'dataType' : 'json',
|
|
|
173 |
'accept' : 'application/json',
|
|
|
174 |
'method' : 'post',
|
|
|
175 |
'url' : action,
|
|
|
176 |
}).done(function(response) {
|
|
|
177 |
if(response['success']) {
|
|
|
178 |
$.fn.showSuccess(response['data']);
|
|
|
179 |
gridTable.api().ajax.reload(null, false);
|
|
|
180 |
} else {
|
|
|
181 |
$.fn.showError(response['data']);
|
|
|
182 |
}
|
|
|
183 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
184 |
$.fn.showError(textStatus);
|
|
|
185 |
}).always(function() {
|
|
|
186 |
NProgress.done();
|
|
|
187 |
});
|
|
|
188 |
},
|
|
|
189 |
});
|
|
|
190 |
},
|
|
|
191 |
'aoColumns': [
|
|
|
192 |
{ 'mDataProp': 'name' },
|
|
|
193 |
{ 'mDataProp': 'main_hostname' },
|
|
|
194 |
{ 'mDataProp': 'admin_hostname' },
|
|
|
195 |
{ 'mDataProp': 'status' },
|
|
|
196 |
{ 'mDataProp': 'actions' },
|
|
|
197 |
],
|
|
|
198 |
'columnDefs': [
|
|
|
199 |
{
|
|
|
200 |
'targets':0,
|
|
|
201 |
'className' : 'text-vertical-middle',
|
|
|
202 |
},
|
|
|
203 |
{
|
|
|
204 |
'targets': -2,
|
|
|
205 |
'orderable': false,
|
|
|
206 |
'className' : 'text-center',
|
|
|
207 |
'render' : function ( data, type, row ) {
|
|
|
208 |
|
|
|
209 |
checked = data == 'a' ? ' checked="checked" ' : '';
|
|
|
210 |
return '<div class="checkbox checkbox-success">' +
|
|
|
211 |
'<input class="styled" type="checkbox" ' + checked + ' disabled="disabled">' +
|
|
|
212 |
'<label ></label></div>';
|
|
|
213 |
}
|
|
|
214 |
},
|
|
|
215 |
{
|
|
|
216 |
'targets': -1,
|
|
|
217 |
'orderable': false,
|
|
|
218 |
'render' : function ( data, type, row ) {
|
|
|
219 |
s = '';
|
|
|
220 |
|
|
|
221 |
if(allowEdit && data['link_edit']) {
|
|
|
222 |
s = s + '<button class="btn btn-primary btn-edit" data-href="' + data['link_edit']+ '" data-toggle="tooltip" title="LABEL_EDIT"><i class="fa fa-pencil"></i> LABEL_EDIT </button> ';
|
|
|
223 |
}
|
|
|
224 |
if(allowDelete && data['link_delete']) {
|
|
|
225 |
s = s + '<button class="btn btn-danger btn-delete" data-href="' + data['link_delete']+ '" data-toggle="tooltip" title="LABEL_DELETE"><i class="fa fa-trash"></i> LABEL_DELETE </button> ';
|
|
|
226 |
}
|
|
|
227 |
return s;
|
|
|
228 |
}
|
|
|
229 |
}
|
|
|
230 |
],
|
|
|
231 |
});
|
|
|
232 |
|
|
|
233 |
var validatorAdd = $('#form-add').validate({
|
|
|
234 |
debug: true,
|
|
|
235 |
onclick: false,
|
|
|
236 |
onkeyup: false,
|
|
|
237 |
ignore: [':hidden'],
|
|
|
238 |
rules: {
|
|
|
239 |
'first_name': {
|
|
|
240 |
required: true,
|
|
|
241 |
maxlength: 64,
|
|
|
242 |
},
|
|
|
243 |
'last_name': {
|
|
|
244 |
required: true,
|
|
|
245 |
maxlength: 64,
|
|
|
246 |
},
|
|
|
247 |
'email': {
|
|
|
248 |
required: true,
|
|
|
249 |
email: true,
|
|
|
250 |
maxlength: 250,
|
|
|
251 |
},
|
|
|
252 |
'password': {
|
|
|
253 |
required: true,
|
|
|
254 |
minlength: 6,
|
|
|
255 |
maxlength: 16,
|
|
|
256 |
passwordStrengthCheck: true,
|
|
|
257 |
},
|
|
|
258 |
'confirmation' : {
|
|
|
259 |
required: true,
|
|
|
260 |
minlength: 6,
|
|
|
261 |
maxlength: 16,
|
|
|
262 |
equalTo: '#form-add #password'
|
|
|
263 |
},
|
|
|
264 |
'company': {
|
|
|
265 |
required: true,
|
|
|
266 |
maxlength: 128,
|
|
|
267 |
},
|
|
|
268 |
'company_size_id': {
|
|
|
269 |
required: true,
|
|
|
270 |
},
|
|
|
271 |
'industry_id': {
|
|
|
272 |
required: true,
|
|
|
273 |
},
|
|
|
274 |
'main_hostname': {
|
|
|
275 |
required: true,
|
|
|
276 |
maxlength: 250,
|
15459 |
efrain |
277 |
url: true,
|
15337 |
efrain |
278 |
},
|
15452 |
efrain |
279 |
'alternative_hostname': {
|
|
|
280 |
required: false,
|
|
|
281 |
maxlength: 250,
|
15459 |
efrain |
282 |
url: true,
|
15452 |
efrain |
283 |
},
|
15337 |
efrain |
284 |
'admin_hostname': {
|
|
|
285 |
required: true,
|
15459 |
efrain |
286 |
maxlength: 250,
|
|
|
287 |
url: true,
|
15337 |
efrain |
288 |
},
|
15459 |
efrain |
289 |
'moodle_url': {
|
|
|
290 |
required: false,
|
|
|
291 |
maxlength: 250,
|
|
|
292 |
url: true,
|
|
|
293 |
},
|
|
|
294 |
'relationship_user_mode': {
|
|
|
295 |
required: true,
|
|
|
296 |
},
|
|
|
297 |
'status': {
|
|
|
298 |
required: false,
|
|
|
299 |
},
|
15441 |
efrain |
300 |
'theme_id': {
|
|
|
301 |
required: true,
|
|
|
302 |
},
|
15337 |
efrain |
303 |
},
|
|
|
304 |
submitHandler: function(form)
|
|
|
305 |
{
|
|
|
306 |
NProgress.start();
|
|
|
307 |
$.ajax({
|
|
|
308 |
'dataType' : 'json',
|
|
|
309 |
'accept' : 'application/json',
|
|
|
310 |
'method' : 'post',
|
|
|
311 |
'url' : $('#form-add').attr('action'),
|
|
|
312 |
'data' : $('#form-add').serialize()
|
|
|
313 |
}).done(function(response) {
|
|
|
314 |
if(response.success) {
|
|
|
315 |
$.fn.showSuccess(response.data);
|
|
|
316 |
|
|
|
317 |
$('#modalAdd').modal('hide');
|
|
|
318 |
gridTable.api().ajax.reload(null, false);
|
|
|
319 |
} else {
|
|
|
320 |
if(jQuery.type(response.data) == 'string') {
|
|
|
321 |
$.fn.showError(response.data)
|
|
|
322 |
} else {
|
|
|
323 |
$.each(response.data, function( fieldname, errors ) {
|
|
|
324 |
$.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
|
|
|
325 |
});
|
|
|
326 |
}
|
|
|
327 |
}
|
|
|
328 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
329 |
$.fn.showError(textStatus)
|
|
|
330 |
|
|
|
331 |
}).always(function() {
|
|
|
332 |
NProgress.done();
|
|
|
333 |
})
|
|
|
334 |
},
|
|
|
335 |
invalidHandler: function(form, validator) {
|
|
|
336 |
}
|
|
|
337 |
});
|
|
|
338 |
|
|
|
339 |
var validatorEdit = $('#form-edit').validate({
|
|
|
340 |
debug: true,
|
|
|
341 |
onclick: false,
|
|
|
342 |
onkeyup: false,
|
|
|
343 |
ignore: [':hidden'],
|
|
|
344 |
rules: {
|
15441 |
efrain |
345 |
'theme_id' : {
|
|
|
346 |
required: true,
|
|
|
347 |
},
|
15337 |
efrain |
348 |
'name': {
|
|
|
349 |
required: true,
|
|
|
350 |
maxlength: 128,
|
|
|
351 |
},
|
|
|
352 |
'main_hostname': {
|
|
|
353 |
required: true,
|
|
|
354 |
maxlength: 250,
|
|
|
355 |
},
|
15452 |
efrain |
356 |
'alternative_hostname': {
|
|
|
357 |
required: false,
|
|
|
358 |
maxlength: 250,
|
|
|
359 |
},
|
15337 |
efrain |
360 |
'admin_hostname': {
|
|
|
361 |
required: true,
|
|
|
362 |
maxlength: 250,
|
|
|
363 |
},
|
15459 |
efrain |
364 |
'status': {
|
|
|
365 |
required: false,
|
15337 |
efrain |
366 |
},
|
15459 |
efrain |
367 |
'moodle_url': {
|
|
|
368 |
required: false,
|
|
|
369 |
maxlength: 250,
|
|
|
370 |
url: true,
|
|
|
371 |
},
|
|
|
372 |
'relationship_user_mode': {
|
|
|
373 |
required: true,
|
|
|
374 |
},
|
15441 |
efrain |
375 |
'theme_id': {
|
|
|
376 |
required: true,
|
|
|
377 |
},
|
15337 |
efrain |
378 |
},
|
|
|
379 |
submitHandler: function(form)
|
|
|
380 |
{
|
|
|
381 |
NProgress.start();
|
|
|
382 |
$.ajax({
|
|
|
383 |
'dataType' : 'json',
|
|
|
384 |
'accept' : 'application/json',
|
|
|
385 |
'method' : 'post',
|
|
|
386 |
'url' : $('#form-edit').attr('action'),
|
|
|
387 |
'data' : $('#form-edit').serialize()
|
|
|
388 |
}).done(function(response) {
|
|
|
389 |
if(response.success) {
|
|
|
390 |
$.fn.showSuccess(response.data);
|
|
|
391 |
|
|
|
392 |
$('#modalEdit').modal('hide');
|
|
|
393 |
gridTable.api().ajax.reload(null, false);
|
|
|
394 |
} else {
|
|
|
395 |
if(jQuery.type(response.data) == 'string') {
|
|
|
396 |
$.fn.showError(response.data)
|
|
|
397 |
} else {
|
|
|
398 |
$.each(response.data, function( fieldname, errors ) {
|
|
|
399 |
$.fn.showFormErrorValidator('#form-edit #' + fieldname, errors);
|
|
|
400 |
});
|
|
|
401 |
}
|
|
|
402 |
}
|
|
|
403 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
404 |
$.fn.showError(textStatus)
|
|
|
405 |
|
|
|
406 |
}).always(function() {
|
|
|
407 |
NProgress.done();
|
|
|
408 |
})
|
|
|
409 |
},
|
|
|
410 |
invalidHandler: function(form, validator) {
|
|
|
411 |
}
|
|
|
412 |
});
|
|
|
413 |
|
|
|
414 |
$('body').on('click', 'button.btn-add', function(e) {
|
|
|
415 |
e.preventDefault();
|
|
|
416 |
|
|
|
417 |
$('#form-add #first_name').val('');
|
|
|
418 |
$('#form-add #last_name').val('');
|
|
|
419 |
$('#form-add #email').val('');
|
|
|
420 |
$('#form-add #password').val('');
|
|
|
421 |
$('#form-add #confirmation').val('');
|
|
|
422 |
$('#form-add #company').val('');
|
|
|
423 |
$('#form-add #company_size_id').val('').trigger('change');
|
|
|
424 |
$('#form-add #industry_id').val('').trigger('change');
|
|
|
425 |
$('#form-add #main_hostname').val('');
|
15452 |
efrain |
426 |
$('#form-add #alternative_hostname').val('');
|
15337 |
efrain |
427 |
$('#form-add #admin_hostname').val('');
|
15459 |
efrain |
428 |
$('#form-add #moodle_url').val('');
|
|
|
429 |
$('#form-add #relationship_user_mode').val('').trigger('change');
|
15441 |
efrain |
430 |
$('#form-add #theme_id').val('');
|
15337 |
efrain |
431 |
|
|
|
432 |
validatorAdd.resetForm();
|
|
|
433 |
$('#modalAdd').modal('show');
|
|
|
434 |
});
|
|
|
435 |
|
|
|
436 |
$('body').on('click', 'button.btn-edit', function(e) {
|
|
|
437 |
e.preventDefault();
|
|
|
438 |
NProgress.start();
|
|
|
439 |
var action = $(this).data('href');
|
|
|
440 |
|
|
|
441 |
$.ajax({
|
|
|
442 |
'dataType' : 'json',
|
|
|
443 |
'method' : 'get',
|
|
|
444 |
'url' : action,
|
|
|
445 |
}).done(function(response) {
|
|
|
446 |
if(response['success']) {
|
|
|
447 |
|
|
|
448 |
$('#form-edit').attr('action', action);
|
|
|
449 |
$('#form-edit #name').val(response['data']['name']);
|
|
|
450 |
$('#form-edit #main_hostname').val(response['data']['main_hostname']);
|
15452 |
efrain |
451 |
$('#form-edit #alternative_hostname').val(response['data']['alternative_hostname']);
|
15337 |
efrain |
452 |
$('#form-edit #admin_hostname').val(response['data']['admin_hostname']);
|
|
|
453 |
$('#form-edit #status').bootstrapToggle(response['data']['status'] == '$status_active' ? 'on' : 'off')
|
15441 |
efrain |
454 |
$('#form-edit #theme_id').val(response['data']['theme_id']);
|
15459 |
efrain |
455 |
$('#form-edit #moodle_url').val(response['data']['moodle_url']);
|
|
|
456 |
$('#form-edit #relationship_user_mode').val(response['data']['relationship_user_mode']).trigger('change');
|
15337 |
efrain |
457 |
validatorEdit.resetForm();
|
|
|
458 |
|
|
|
459 |
$('#modalEdit').modal('show');
|
|
|
460 |
} else {
|
|
|
461 |
$.fn.showError(response['data']);
|
|
|
462 |
}
|
|
|
463 |
}).fail(function( jqXHR, textStatus, errorThrown) {
|
|
|
464 |
$.fn.showError(textStatus);
|
|
|
465 |
}).always(function() {
|
|
|
466 |
NProgress.done();
|
|
|
467 |
});
|
|
|
468 |
});
|
|
|
469 |
|
|
|
470 |
|
|
|
471 |
$('body').on('click', 'button.btn-refresh', function(e) {
|
|
|
472 |
e.preventDefault();
|
|
|
473 |
gridTable.api().ajax.reload(null, false);
|
|
|
474 |
});
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
$('body').on('click', 'button.btn-cancel', function(e) {
|
|
|
480 |
e.preventDefault();
|
|
|
481 |
$('#modalAdd').modal('hide');
|
|
|
482 |
$('#modalEdit').modal('hide');
|
|
|
483 |
});
|
|
|
484 |
|
|
|
485 |
$('#form-add #company_size_id').select2({
|
|
|
486 |
theme: 'bootstrap4',
|
|
|
487 |
width: '100%',
|
|
|
488 |
});
|
|
|
489 |
|
|
|
490 |
$('#form-add #industry_id').select2({
|
|
|
491 |
theme: 'bootstrap4',
|
|
|
492 |
width: '100%',
|
|
|
493 |
});
|
|
|
494 |
|
|
|
495 |
$('#form-edit #status').bootstrapToggle({'on' : 'LABEL_ACTIVE', 'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});
|
|
|
496 |
|
|
|
497 |
});
|
|
|
498 |
JS;
|
|
|
499 |
$this->inlineScript()->captureEnd();
|
|
|
500 |
?>
|
|
|
501 |
|
|
|
502 |
<!-- Content Header (Page header) -->
|
|
|
503 |
<section class="content-header">
|
|
|
504 |
<div class="container-fluid">
|
|
|
505 |
<div class="row mb-2">
|
|
|
506 |
<div class="col-sm-12">
|
|
|
507 |
<h1>LABEL_PRIVATE_NETWORKS</h1>
|
|
|
508 |
</div>
|
|
|
509 |
</div>
|
|
|
510 |
</div><!-- /.container-fluid -->
|
|
|
511 |
</section>
|
|
|
512 |
|
|
|
513 |
<section class="content">
|
|
|
514 |
<div class="container-fluid">
|
|
|
515 |
<div class="row">
|
|
|
516 |
<div class="col-12">
|
|
|
517 |
<div class="card">
|
|
|
518 |
<div class="card-body">
|
|
|
519 |
<table id="gridTable" class="table table-striped table-hover">
|
|
|
520 |
<thead>
|
|
|
521 |
<tr>
|
|
|
522 |
<th>LABEL_NAME</th>
|
|
|
523 |
<th>LABEL_MAIN_HOSTNAME</th>
|
|
|
524 |
<th>LABEL_ADMIN_HOSTNAME</th>
|
|
|
525 |
<th>LABEL_ACTIVE</th>
|
|
|
526 |
<th>LABEL_ACTIONS</th>
|
|
|
527 |
</tr>
|
|
|
528 |
</thead>
|
|
|
529 |
<tbody>
|
|
|
530 |
</tbody>
|
|
|
531 |
</table>
|
|
|
532 |
</div>
|
|
|
533 |
<div class="card-footer clearfix">
|
|
|
534 |
<div style="float:right;">
|
|
|
535 |
<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH </button>
|
|
|
536 |
<?php if ($allowAdd) : ?>
|
|
|
537 |
<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
|
|
|
538 |
<?php endif; ?>
|
|
|
539 |
|
|
|
540 |
</div>
|
|
|
541 |
</div>
|
|
|
542 |
</div>
|
|
|
543 |
</div>
|
|
|
544 |
</div>
|
|
|
545 |
</div>
|
|
|
546 |
</section>
|
|
|
547 |
|
|
|
548 |
|
|
|
549 |
<!-- The Modal -->
|
|
|
550 |
<div class="modal" id="modalAdd">
|
|
|
551 |
<div class="modal-dialog modal-xl">
|
|
|
552 |
<div class="modal-content">
|
|
|
553 |
|
|
|
554 |
<!-- Modal Header -->
|
|
|
555 |
<div class="modal-header">
|
|
|
556 |
<h4 class="modal-title">LABEL_NEW_PRIVATE_NETWORK<span id="form-title"></span></h4>
|
|
|
557 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
558 |
</div>
|
|
|
559 |
|
|
|
560 |
<!-- Modal body -->
|
|
|
561 |
<div class="modal-body">
|
|
|
562 |
<?php
|
|
|
563 |
$form = $this->formAdd;
|
|
|
564 |
$form->setAttributes([
|
|
|
565 |
'method' => 'post',
|
|
|
566 |
'name' => 'form-add',
|
|
|
567 |
'id' => 'form-add',
|
|
|
568 |
'action' => $routeAdd,
|
|
|
569 |
]);
|
|
|
570 |
|
|
|
571 |
$form->prepare();
|
|
|
572 |
echo $this->form()->openTag($form);
|
|
|
573 |
?>
|
|
|
574 |
<div class="form-group">
|
|
|
575 |
<?php
|
|
|
576 |
$element = $form->get('first_name');
|
|
|
577 |
$element->setOptions(['label' => 'LABEL_FIRST_NAME']);
|
|
|
578 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
579 |
|
|
|
580 |
echo $this->formLabel($element);
|
|
|
581 |
echo $this->formText($element);
|
|
|
582 |
?>
|
|
|
583 |
</div>
|
|
|
584 |
<div class="form-group">
|
|
|
585 |
<?php
|
|
|
586 |
$element = $form->get('last_name');
|
|
|
587 |
$element->setOptions(['label' => 'LABEL_LAST_NAME']);
|
|
|
588 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
589 |
|
|
|
590 |
echo $this->formLabel($element);
|
|
|
591 |
echo $this->formText($element);
|
|
|
592 |
?>
|
|
|
593 |
</div>
|
|
|
594 |
<div class="form-group">
|
|
|
595 |
<?php
|
|
|
596 |
$element = $form->get('email');
|
|
|
597 |
$element->setOptions(['label' => 'LABEL_EMAIL']);
|
|
|
598 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
599 |
|
|
|
600 |
echo $this->formLabel($element);
|
|
|
601 |
echo $this->formText($element);
|
|
|
602 |
?>
|
|
|
603 |
</div>
|
|
|
604 |
<div class="form-group">
|
|
|
605 |
<?php
|
|
|
606 |
$element = $form->get('password');
|
|
|
607 |
$element->setOptions(['label' => 'LABEL_PASSWORD']);
|
|
|
608 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
609 |
|
|
|
610 |
echo $this->formLabel($element);
|
|
|
611 |
echo $this->formPassword($element);
|
|
|
612 |
?>
|
|
|
613 |
</div>
|
|
|
614 |
<div class="form-group">
|
|
|
615 |
<?php
|
|
|
616 |
$element = $form->get('confirmation');
|
|
|
617 |
$element->setOptions(['label' => 'LABEL_CONFIRMATION']);
|
|
|
618 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
619 |
|
|
|
620 |
echo $this->formLabel($element);
|
|
|
621 |
echo $this->formPassword($element);
|
|
|
622 |
?>
|
|
|
623 |
</div>
|
|
|
624 |
<div class="form-group">
|
|
|
625 |
<?php
|
|
|
626 |
$element = $form->get('company');
|
|
|
627 |
$element->setOptions(['label' => 'LABEL_COMPANY']);
|
|
|
628 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
629 |
|
|
|
630 |
echo $this->formLabel($element);
|
|
|
631 |
echo $this->formText($element);
|
|
|
632 |
?>
|
|
|
633 |
</div>
|
|
|
634 |
<div class="form-group">
|
|
|
635 |
<?php
|
|
|
636 |
$element = $form->get('industry_id');
|
|
|
637 |
$element->setOptions(['label' => 'LABEL_INDUSTRY']);
|
|
|
638 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
639 |
|
|
|
640 |
echo $this->formLabel($element);
|
|
|
641 |
echo $this->formSelect($element);
|
|
|
642 |
?>
|
|
|
643 |
</div>
|
|
|
644 |
<div class="form-group">
|
|
|
645 |
<?php
|
|
|
646 |
$element = $form->get('company_size_id');
|
|
|
647 |
$element->setOptions(['label' => 'LABEL_COMPANY_SIZE']);
|
|
|
648 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
649 |
|
|
|
650 |
echo $this->formLabel($element);
|
|
|
651 |
echo $this->formSelect($element);
|
|
|
652 |
?>
|
|
|
653 |
</div>
|
|
|
654 |
<div class="form-group">
|
|
|
655 |
<?php
|
|
|
656 |
$element = $form->get('main_hostname');
|
|
|
657 |
$element->setOptions(['label' => 'LABEL_MAIN_HOSTNAME']);
|
|
|
658 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
659 |
|
|
|
660 |
echo $this->formLabel($element);
|
|
|
661 |
echo $this->formText($element);
|
|
|
662 |
?>
|
|
|
663 |
</div>
|
|
|
664 |
<div class="form-group">
|
|
|
665 |
<?php
|
15452 |
efrain |
666 |
$element = $form->get('alternative_hostname');
|
|
|
667 |
$element->setOptions(['label' => 'LABEL_ALTERNATIVE_HOSTNAME']);
|
|
|
668 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
669 |
|
|
|
670 |
echo $this->formLabel($element);
|
|
|
671 |
echo $this->formText($element);
|
|
|
672 |
?>
|
|
|
673 |
</div>
|
|
|
674 |
|
|
|
675 |
|
|
|
676 |
|
|
|
677 |
<div class="form-group">
|
|
|
678 |
<?php
|
15337 |
efrain |
679 |
$element = $form->get('admin_hostname');
|
|
|
680 |
$element->setOptions(['label' => 'LABEL_ADMIN_HOSTNAME']);
|
|
|
681 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
682 |
|
|
|
683 |
echo $this->formLabel($element);
|
|
|
684 |
echo $this->formText($element);
|
|
|
685 |
?>
|
|
|
686 |
</div>
|
15441 |
efrain |
687 |
<div class="form-group">
|
|
|
688 |
<?php
|
15459 |
efrain |
689 |
$element = $form->get('moodle_url');
|
|
|
690 |
$element->setOptions(['label' => 'LABEL_MY_ONROOM_URL']);
|
|
|
691 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
692 |
|
|
|
693 |
echo $this->formLabel($element);
|
|
|
694 |
echo $this->formText($element);
|
|
|
695 |
?>
|
|
|
696 |
</div>
|
|
|
697 |
<div class="form-group">
|
|
|
698 |
<?php
|
|
|
699 |
$element = $form->get('relationship_user_mode');
|
|
|
700 |
$element->setOptions(['label' => 'LABEL_THEME']);
|
|
|
701 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
702 |
|
|
|
703 |
echo $this->formLabel($element);
|
|
|
704 |
echo $this->formSelect($element);
|
|
|
705 |
?>
|
|
|
706 |
</div>
|
|
|
707 |
<div class="form-group">
|
|
|
708 |
<?php
|
15441 |
efrain |
709 |
$element = $form->get('theme_id');
|
|
|
710 |
$element->setOptions(['label' => 'LABEL_THEME']);
|
|
|
711 |
$element->setAttributes(['class' => 'form-control']);
|
15337 |
efrain |
712 |
|
15441 |
efrain |
713 |
echo $this->formLabel($element);
|
|
|
714 |
echo $this->formSelect($element);
|
|
|
715 |
?>
|
|
|
716 |
</div>
|
15337 |
efrain |
717 |
|
|
|
718 |
<div class="form-group">
|
|
|
719 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
720 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
721 |
</div>
|
|
|
722 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
723 |
</div>
|
|
|
724 |
|
|
|
725 |
<!-- Modal footer -->
|
|
|
726 |
<div class="modal-footer">
|
|
|
727 |
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
|
|
|
728 |
</div>
|
|
|
729 |
|
|
|
730 |
</div>
|
|
|
731 |
</div>
|
|
|
732 |
</div>
|
|
|
733 |
|
|
|
734 |
|
|
|
735 |
<!-- The Modal -->
|
|
|
736 |
<div class="modal" id="modalEdit">
|
|
|
737 |
<div class="modal-dialog modal-xl">
|
|
|
738 |
<div class="modal-content">
|
|
|
739 |
|
|
|
740 |
<!-- Modal Header -->
|
|
|
741 |
<div class="modal-header">
|
|
|
742 |
<h4 class="modal-title">LABEL_EDIT_PRIVATE_NETWORK<span id="form-title"></span></h4>
|
|
|
743 |
<button type="button" class="close" data-dismiss="modal">×</button>
|
|
|
744 |
</div>
|
|
|
745 |
|
|
|
746 |
<!-- Modal body -->
|
|
|
747 |
<div class="modal-body">
|
|
|
748 |
<?php
|
|
|
749 |
$form = $this->formEdit;
|
|
|
750 |
$form->setAttributes([
|
|
|
751 |
'method' => 'post',
|
|
|
752 |
'name' => 'form-edit',
|
|
|
753 |
'id' => 'form-edit',
|
|
|
754 |
|
|
|
755 |
]);
|
|
|
756 |
|
|
|
757 |
$form->prepare();
|
|
|
758 |
echo $this->form()->openTag($form);
|
|
|
759 |
?>
|
|
|
760 |
|
|
|
761 |
<div class="form-group">
|
|
|
762 |
<?php
|
|
|
763 |
$element = $form->get('name');
|
|
|
764 |
$element->setOptions(['label' => 'LABEL_NAME']);
|
|
|
765 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
766 |
|
|
|
767 |
echo $this->formLabel($element);
|
|
|
768 |
echo $this->formText($element);
|
|
|
769 |
?>
|
|
|
770 |
</div>
|
|
|
771 |
<div class="form-group">
|
|
|
772 |
<?php
|
|
|
773 |
$element = $form->get('main_hostname');
|
|
|
774 |
$element->setOptions(['label' => 'LABEL_MAIN_HOSTNAME']);
|
|
|
775 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
776 |
|
|
|
777 |
echo $this->formLabel($element);
|
|
|
778 |
echo $this->formText($element);
|
|
|
779 |
?>
|
|
|
780 |
</div>
|
|
|
781 |
<div class="form-group">
|
|
|
782 |
<?php
|
15452 |
efrain |
783 |
$element = $form->get('alternative_hostname');
|
|
|
784 |
$element->setOptions(['label' => 'LABEL_ALTERNATIVE_HOSTNAME']);
|
|
|
785 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
786 |
|
|
|
787 |
echo $this->formLabel($element);
|
|
|
788 |
echo $this->formText($element);
|
|
|
789 |
?>
|
|
|
790 |
</div>
|
|
|
791 |
|
|
|
792 |
<div class="form-group">
|
|
|
793 |
<?php
|
15337 |
efrain |
794 |
$element = $form->get('admin_hostname');
|
|
|
795 |
$element->setOptions(['label' => 'LABEL_ADMIN_HOSTNAME']);
|
|
|
796 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
797 |
|
|
|
798 |
echo $this->formLabel($element);
|
|
|
799 |
echo $this->formText($element);
|
|
|
800 |
?>
|
|
|
801 |
</div>
|
|
|
802 |
<div class="form-group">
|
|
|
803 |
<?php
|
|
|
804 |
$element = $form->get('status');
|
|
|
805 |
echo $this->formCheckbox($element);
|
|
|
806 |
?>
|
|
|
807 |
</div>
|
15459 |
efrain |
808 |
<div class="form-group">
|
|
|
809 |
<?php
|
|
|
810 |
$element = $form->get('moodle_url');
|
|
|
811 |
$element->setOptions(['label' => 'LABEL_MY_ONROOM_URL']);
|
|
|
812 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
813 |
|
|
|
814 |
echo $this->formLabel($element);
|
|
|
815 |
echo $this->formText($element);
|
|
|
816 |
?>
|
|
|
817 |
</div>
|
|
|
818 |
<div class="form-group">
|
|
|
819 |
<?php
|
|
|
820 |
$element = $form->get('relationship_user_mode');
|
|
|
821 |
$element->setOptions(['label' => 'LABEL_THEME']);
|
|
|
822 |
$element->setAttributes(['class' => 'form-control']);
|
|
|
823 |
|
|
|
824 |
echo $this->formLabel($element);
|
|
|
825 |
echo $this->formSelect($element);
|
|
|
826 |
?>
|
|
|
827 |
</div>
|
|
|
828 |
|
|
|
829 |
|
|
|
830 |
|
15441 |
efrain |
831 |
<div class="form-group">
|
|
|
832 |
<?php
|
|
|
833 |
$element = $form->get('theme_id');
|
|
|
834 |
$element->setOptions(['label' => 'LABEL_THEME']);
|
|
|
835 |
$element->setAttributes(['class' => 'form-control']);
|
15337 |
efrain |
836 |
|
15441 |
efrain |
837 |
echo $this->formLabel($element);
|
|
|
838 |
echo $this->formSelect($element);
|
|
|
839 |
?>
|
|
|
840 |
</div>
|
|
|
841 |
|
15337 |
efrain |
842 |
|
|
|
843 |
<div class="form-group">
|
|
|
844 |
<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
|
|
|
845 |
<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
|
|
|
846 |
</div>
|
|
|
847 |
<?php echo $this->form()->closeTag($form); ?>
|
|
|
848 |
</div>
|
|
|
849 |
|
|
|
850 |
<!-- Modal footer -->
|
|
|
851 |
<div class="modal-footer">
|
|
|
852 |
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
|
|
|
853 |
</div>
|
|
|
854 |
|
|
|
855 |
</div>
|
|
|
856 |
</div>
|
|
|
857 |
</div>
|
|
|
858 |
|