Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16971 | | Comparar con el anterior | Ultima modificación | Ver Log |

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