Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 9025 | Rev 15045 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

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