Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 8767 | Rev 9025 | 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': {
299
 
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': {
381
                    required: true,
382
 
383
                },
384
                'date': {
385
                    required: true,
386
 
387
                },
388
               'image': {
389
                    required: false,
390
                    extension: 'jpg|jpeg|png',
391
                    accept: 'image/jpg,image/jpeg,image/png'
392
                },
393
               'file': {
394
                    required: false,
395
                    extension: 'jpg|jpeg|png|webm,mp4,webm|wav|mp3|pdf',
396
                    accept: 'image/jpg,image/jpeg,image/png,video/webm,video/mpeg,video/mp4,audio/wav, audio/mpeg, application/pdf'
397
                },
398
            },
399
            submitHandler: function(form)
400
            {
401
 
402
                var formdata = false;
403
                if (window.FormData){
404
                    formdata = new FormData(form); //form[0]);
405
                }
406
 
407
                $('input[type="submit"]').prop('disabled', true);
408
 
409
                $.ajax({
410
                    'dataType'  : 'json',
411
                    'accept'    : 'application/json',
412
                    'method'    : 'post',
413
                    'url'       :  $('#form-edit').attr('action'),
414
                    'data'      :  formdata,
415
                    'processData': false,
416
                    'contentType': false,
417
                }).done(function(response) {
418
                    if(response['success']) {
419
                        $.fn.showSuccess(response['data']);
420
                        $('#modal-edit').modal('hide');
421
 
422
                        gridTable.api().ajax.reload(null, false);
423
                    } else {
424
                        validatorAdd.resetForm();
425
                        if(jQuery.type(response['data']) == 'string') {
426
                            $.fn.showError(response['data']);
427
                        } else  {
428
                            $.each(response['data'], function( fieldname, errors ) {
429
                                $.fn.showFormErrorValidator('#form-add #' + fieldname, errors);
430
                            });
431
                        }
432
                    }
433
                }).fail(function( jqXHR, textStatus, errorThrown) {
434
                    $.fn.showError(textStatus);
435
                }).always(function() {
436
                    NProgress.done();
437
                });
438
                return false;
439
            },
440
            invalidHandler: function(form, validator) {
441
 
442
            }
443
 
444
 
445
        });
446
 
447
        $('body').on('click', 'button.btn-add', function(e) {
448
            e.preventDefault();
449
 
450
            $('#form-add #title').val('');
451
            $('#form-add #date').val('');
452
            $('#form-add #url').val('');
453
            $('#form-add #status').bootstrapToggle('on');
454
 
455
            $('#form-add #file').fileinput('reset');
456
            $('#form-add #file').val('');
457
 
458
            $('#form-add #image').fileinput('reset');
459
            $('#form-add #image').val('');
460
 
461
            CKEDITOR.instances.description_add.setData('');
462
            validatorAdd.resetForm();
463
 
464
            $('#modal-add').modal('show');
465
        });
466
 
467
        $('body').on('click', 'button.btn-edit', function(e) {
468
            e.preventDefault();
469
            NProgress.start();
470
            var action = $(this).data('href');
471
 
472
            $.ajax({
473
                'dataType'  : 'json',
474
                'accept'    : 'application/json',
475
                'method'    : 'get',
476
                'url'       :  action,
477
            }).done(function(response) {
478
                if(response['success']) {
479
 
480
                    $('#form-edit').attr('action', action);
481
                    $('#form-edit #title').val(response['data']['title']);
482
                    $('#form-edit #date').val(response['data']['date']);
483
                    $('#form-edit #url').val(response['data']['url']);
484
                    $('#form-edit #status').bootstrapToggle(response['data']['status'] == 'a' ? 'on' : 'off');
485
 
486
                    $('#form-edit #file').fileinput('reset');
487
                    $('#form-edit #file').val('');
488
 
489
                    $('#form-edit #image').fileinput('reset');
490
                    $('#form-edit #image').val('');
491
 
492
                    var description = $.trim(response['data']['description']);
493
                    CKEDITOR.instances.description_edit.setData(description.length > 0 ? description : '');
494
 
495
                    validatorEdit.resetForm();
496
 
497
                    $('#modal-edit').modal('show');
498
 
499
 
500
                } else {
501
                    $.fn.showError(response['data']);
502
                }
503
            }).fail(function( jqXHR, textStatus, errorThrown) {
504
                $.fn.showError(textStatus);
505
            }).always(function() {
506
                NProgress.done();
507
            });
508
        });
509
 
510
        $('body').on('click', 'button.btn-refresh', function(e) {
511
            e.preventDefault();
512
            gridTable.api().ajax.reload(null, false);
513
        });
514
 
515
 
516
        $('body').on('click', 'button.btn-cancel', function(e) {
517
            e.preventDefault();
518
            $('#modal-add').modal('hide');
519
            $('#modal-edit').modal('hide');
520
        });
521
 
522
        $('body').on('click', 'button.btn-view', function(e) {
523
            e.preventDefault();
524
 
525
            var href = $(this).data('href');
526
            window.open(href, '_blank');
527
 
528
        });
529
 
530
 
531
 
532
        $('#form-add #date').datetimepicker({
533
            locale: 'es',
534
            format: 'DD/MM/YYYY'
535
        });
536
 
537
        $('#form-edit #date').datetimepicker({
538
            locale: 'es',
539
            format: 'DD/MM/YYYY'
540
        });
541
 
542
        $('#form-add #image').fileinput({
543
            theme: 'fa',
544
            language: 'es',
545
            showUpload: false,
546
            dropZoneEnabled: false,
547
            maxFileCount: 1,
548
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
549
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
550
        });
551
 
552
 
553
        $('#form-edit #image').fileinput({
554
            theme: 'fa',
555
            language: 'es',
556
            showUpload: false,
557
            dropZoneEnabled: false,
558
            maxFileCount: 1,
559
            allowedFileExtensions: ['jpeg', 'jpg', 'png'],
560
            msgPlaceholder: 'LABEL_RECOMMENDED_SIZE $image_size',
561
        });
562
 
563
        $('#form-add #file').fileinput({
564
            theme: 'fa',
565
            language: 'es',
566
            showUpload: false,
567
            dropZoneEnabled: false,
568
            maxFileCount: 1,
569
            allowedFileExtensions: ['webm','mp4','mpeg','jpg','jpeg','png', 'wav', 'mp3', 'pdf'],
570
        });
571
 
572
        $('#form-edit #file').fileinput({
573
            theme: 'fa',
574
            language: 'es',
575
            showUpload: false,
576
            dropZoneEnabled: false,
577
            maxFileCount: 1,
578
            allowedFileExtensions: ['webm','mp4','mpeg','jpg','jpeg','png', 'wav', 'mp3', 'pdf'],
579
        });
580
 
581
 
582
        $('#form-add #status').bootstrapToggle({'on' : 'LABEL_ACTIVE',  'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});
583
        $('#form-edit #status').bootstrapToggle({'on' : 'LABEL_ACTIVE',  'off' : 'LABEL_INACTIVE', 'width' : '160px', 'height' : '40px'});
8767 stevensc 584
        CKEDITOR.replace( 'description_add', {
585
            toolbar: [
586
                    { name: 'editing', items: ['Scayt'] },
587
                    { name: 'links', items: ['Link', 'Unlink'] },
588
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
589
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
590
                    '/',
591
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
592
                    { name: 'styles', items: ['Styles', 'Format'] },
593
                    { name: 'tools', items: ['Maximize'] }
594
                ],
595
                removePlugins: 'elementspath,Anchor',
596
                heigth: 100
597
        });
598
        CKEDITOR.replace( 'description_edit', {
599
            toolbar: [
600
                    { name: 'editing', items: ['Scayt'] },
601
                    { name: 'links', items: ['Link', 'Unlink'] },
602
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
603
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
604
                    '/',
605
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
606
                    { name: 'styles', items: ['Styles', 'Format'] },
607
                    { name: 'tools', items: ['Maximize'] }
608
                ],
609
                removePlugins: 'elementspath,Anchor',
610
                heigth: 100
611
        });
1 www 612
    });
613
JS;
614
$this->inlineScript()->captureEnd();
615
?>
616
 
617
 
618
 
619
<!-- Content Header (Page header) -->
620
<section class="content-header">
621
	<div class="container-fluid">
622
    	<div class="row mb-2">
623
        	<div class="col-sm-12">
624
            	<h1>LABEL_POSTS</h1>
625
			</div>
626
		</div>
627
	</div><!-- /.container-fluid -->
628
</section>
629
 
630
<section class="content">
631
	<div class="container-fluid">
632
    	<div class="row">
633
        	<div class="col-12">
634
				<div class="card">
635
					<div class="card-body">
20 steven 636
        	    		<table id="gridTable" class="table   table-hover">
1 www 637
                      		<thead>
638
        						<tr>
639
                                	<th>LABEL_TITLE</th>
640
                                	<th>LABEL_DATE</th>
641
                                  	<th>LABEL_ACTIVE</th>
642
                                  	<th>LABEL_ACTIONS</th>
643
                                </tr>
644
                       		</thead>
645
                         	<tbody>
646
                         	</tbody>
647
                    	</table>
648
                   	</div>
649
                   	<div class="card-footer clearfix">
650
                   		<div style="float:right;">
651
							<button type="button" class="btn btn-info btn-refresh"><i class="fa fa-refresh"></i> LABEL_REFRESH  </button>
652
							<?php if($allowAdd) : ?>
653
							<button type="button" class="btn btn-primary btn-add"><i class="fa fa-plus"></i> LABEL_ADD </button>
654
							<?php endif; ?>
655
						</div>
656
                 	</div>
657
          		</div>
658
           	</div>
659
        </div>
660
 	</div>
661
</section>
662
 
663
<!-- The Modal -->
664
<div class="modal" id="modal-add">
665
	<div class="modal-dialog  modal-xl">
666
    	<div class="modal-content">
667
 
668
            <!-- Modal Header -->
669
      		<div class="modal-header">
670
        		<h4 class="modal-title">LABEL_ADD</h4>
671
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
672
      		</div>
673
 
674
            <!-- Modal body -->
675
      		<div class="modal-body">
676
       			 <?php
677
                    $form = $this->formAdd;
678
            		$form->setAttributes([
679
                        'method'    => 'post',
680
                        'name'      => 'form-add',
681
                        'id'        => 'form-add'
682
                    ]);
683
 
684
                    $form->prepare();
685
                    echo $this->form()->openTag($form);
686
                    ?>
687
                       	<div class="form-group">
688
        					<?php
689
                            $element = $form->get('date');
690
                            $element->setOptions(['label' => 'LABEL_DATE']);
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('title');
700
                            $element->setOptions(['label' => 'LABEL_TITLE']);
701
                            $element->setAttributes(['class' => 'form-control']);
702
 
703
                            echo $this->formLabel($element);
704
                            echo $this->formText($element);
705
                            ?>
706
						</div>
707
						<div class="form-group">
708
                    	<?php
709
                            $element = $form->get('description');
710
                            $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
711
                            $element->setAttributes(['id' => 'description_add', 'class' => 'form-control']);
712
 
713
                            echo $this->formLabel($element);
714
                            echo $this->formTextArea($element);
715
                        ?>
716
						</div>
717
						<div class="form-group">
718
        					<?php
719
                            $element = $form->get('url');
720
                            $element->setOptions(['label' => 'LABEL_URL']);
721
                            $element->setAttributes(['class' => 'form-control']);
722
 
723
                            echo $this->formLabel($element);
724
                            echo $this->formText($element);
725
                            ?>
726
						</div>
727
						<div class="form-group">
728
                      	<?php
729
                            $element = $form->get('status');
730
                            $element->setAttributes(['class' => 'form-control']);
731
                            echo $this->formCheckbox($element);
732
                        ?>
733
						</div>
734
						<div class="form-group">
735
 
736
                     		<?php
737
                            $element = $form->get('image');
738
                            $element->setAttributes(['class' => 'form-control']);
739
                            $element->setOptions(['label' => 'LABEL_IMAGE']);
740
                            $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
741
                            echo $this->formLabel($element);
742
                            ?>
743
                            <div class="file-loading">
744
                            <?php echo $this->formFile($element);?>
745
                            </div>
746
 
747
              			</div>
748
              			<div class="form-group">
749
 
750
                     		<?php
751
                            $element = $form->get('file');
752
                            $element->setAttributes(['class' => 'form-control']);
753
                            $element->setOptions(['label' => 'LABEL_FILE']);
754
                            $element->setAttributes(['accept' => 'video/webm,video/mp4,video/mpeg,image/jpg,image/jpeg,image/png,audio/wav,audio/mpeg,application/pdf']);
755
                            echo $this->formLabel($element);
756
                            ?>
757
                            <div class="file-loading">
758
                            <?php echo $this->formFile($element);?>
759
                            </div>
760
 
761
              			</div>
762
 
763
        				<div class="form-group">
764
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
765
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
766
                   		</div>
767
     	      		<?php echo $this->form()->closeTag($form); ?>
768
      		</div>
769
 
770
            <!-- Modal footer -->
771
      		<div class="modal-footer">
772
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
773
      		</div>
774
 
775
    	</div>
776
	</div>
777
</div>
778
 
779
 
780
 
781
<!-- The Modal -->
782
<div class="modal" id="modal-edit">
783
	<div class="modal-dialog  modal-xl">
784
    	<div class="modal-content">
785
 
786
            <!-- Modal Header -->
787
      		<div class="modal-header">
788
        		<h4 class="modal-title">LABEL_EDIT</h4>
789
        		<button type="button" class="close" data-dismiss="modal">&times;</button>
790
      		</div>
791
 
792
            <!-- Modal body -->
793
      		<div class="modal-body">
794
       			 <?php
795
                    $form = $this->formEdit;
796
            		$form->setAttributes([
797
                        'method'    => 'post',
798
                        'name'      => 'form-edit',
799
                        'id'        => 'form-edit'
800
                    ]);
801
 
802
                    $form->prepare();
803
                    echo $this->form()->openTag($form);
804
                    ?>
805
                       	<div class="form-group">
806
        					<?php
807
                            $element = $form->get('date');
808
                            $element->setOptions(['label' => 'LABEL_DATE']);
809
                            $element->setAttributes(['class' => 'form-control']);
810
 
811
                            echo $this->formLabel($element);
812
                            echo $this->formText($element);
813
                            ?>
814
						</div>
815
    					<div class="form-group">
816
        					<?php
817
                            $element = $form->get('title');
818
                            $element->setOptions(['label' => 'LABEL_TITLE']);
819
                            $element->setAttributes(['class' => 'form-control']);
820
 
821
                            echo $this->formLabel($element);
822
                            echo $this->formText($element);
823
                            ?>
824
						</div>
825
						<div class="form-group">
826
                    	<?php
827
                            $element = $form->get('description');
828
                            $element->setOptions(['label' => 'LABEL_DESCRIPTION']);
829
                            $element->setAttributes(['id' => 'description_edit', 'class' => 'form-control']);
830
 
831
                            echo $this->formLabel($element);
832
                            echo $this->formTextArea($element);
833
                        ?>
834
						</div>
835
						<div class="form-group">
836
        					<?php
837
                            $element = $form->get('url');
838
                            $element->setOptions(['label' => 'LABEL_URL']);
839
                            $element->setAttributes(['class' => 'form-control']);
840
 
841
                            echo $this->formLabel($element);
842
                            echo $this->formText($element);
843
                            ?>
844
						</div>
845
						<div class="form-group">
846
                      	<?php
847
                            $element = $form->get('status');
848
                            $element->setAttributes(['class' => 'form-control']);
849
                            echo $this->formCheckbox($element);
850
                        ?>
851
						</div>
852
						<div class="form-group">
853
 
854
                     		<?php
855
                            $element = $form->get('image');
856
                            $element->setAttributes(['class' => 'form-control']);
857
                            $element->setOptions(['label' => 'LABEL_IMAGE']);
858
                            $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
859
                            echo $this->formLabel($element);
860
                            ?>
861
                            <div class="file-loading">
862
                            <?php echo $this->formFile($element);?>
863
                            </div>
864
 
865
              			</div>
866
              			<div class="form-group">
867
 
868
                     		<?php
869
                            $element = $form->get('file');
870
                            $element->setAttributes(['class' => 'form-control']);
871
                            $element->setOptions(['label' => 'LABEL_FILE']);
872
                            $element->setAttributes(['accept' => 'video/webm,video/mp4,video/mpeg,image/jpg,image/jpeg,image/png,audio/wav,audio/mpeg,application/pdf']);
873
                            echo $this->formLabel($element);
874
                            ?>
875
                            <div class="file-loading">
876
                            <?php echo $this->formFile($element);?>
877
                            </div>
878
 
879
              			</div>
880
 
881
        				<div class="form-group">
882
                    		<button type="submit" class="btn btn-primary">LABEL_SAVE</button>
883
                    		<button type="button" class="btn btn-light btn-cancel">LABEL_CANCEL</button>
884
                   		</div>
885
     	      		<?php echo $this->form()->closeTag($form); ?>
886
      		</div>
887
 
888
            <!-- Modal footer -->
889
      		<div class="modal-footer">
890
        		<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
891
      		</div>
892
 
893
    	</div>
894
	</div>
895
</div>
896
 
897
 
898
 
899
 
900
 
901
 
902
 
903
 
904