Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

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