Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16814 | Rev 16841 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 16814 Rev 16822
Línea 1... Línea 1...
1
<?php
1
<?php 
2
$acl            = $this->viewModel()->getRoot()->getVariable('acl');
-
 
3
$currentUser    = $this->currentUserHelper();
2
$currentUser = $this->currentUserHelper();
4
 
-
 
5
$roleName = $currentUser->getUserTypeId();
3
$currentUser = $currentUser->getUser();
Línea 6... Línea 4...
6
 
4
 
7
$routeTimeline = $this->url('feeds/timeline');
-
 
Línea -... Línea 5...
-
 
5
$routeTimeline = $this->url('feeds/timeline');
-
 
6
 
-
 
7
 
-
 
8
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
-
 
9
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
-
 
10
 
-
 
11
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
-
 
12
 
-
 
13
 
-
 
14
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
-
 
15
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fa/theme.css'));
-
 
16
 
-
 
17
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
18
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
19
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
-
 
20
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
-
 
21
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fa/theme.js'));
-
 
22
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fa/theme.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->inlineScript()->appendFile($this->basePath('plugins/jsrender/jsrender.min.js'));
-
 
30
 
-
 
31
 
8
$allowFastSurvey = $acl->isAllowed($roleName, 'fast-survey') ? 1 : 0;
32
$this->inlineScript()->appendFile($this->basePath('plugins/bootbox/bootbox.all.min.js'));
-
 
33
 
-
 
34
$this->inlineScript()->captureStart();
-
 
35
echo <<<JS
-
 
36
jQuery( document ).ready(function( $ ) {
-
 
37
    var feed_unique_shared = '';
-
 
38
 
-
 
39
    $.validator.addMethod('requiredContent', function (value, element, param) {
-
 
40
        value = $.trim($.fn.stripHtml(value));
-
 
41
        return value.length > 0;
-
 
42
    }, 'ERROR_REQUIRED');
-
 
43
 
-
 
44
    $.fn.reload = function(page) {
-
 
45
        NProgress.start();
-
 
46
        $.ajax({
-
 
47
            'dataType'  : 'json',
-
 
48
            'accept'    : 'application/json',
-
 
49
            'method'    : 'get',
9
 
50
            'data'      : {
-
 
51
                'page' : page
-
 
52
            },
-
 
53
            'url'       :  '$routeTimeline'
-
 
54
        }).done(function(response) {
-
 
55
            if(response['success']) {
-
 
56
                $('.posts-section').empty();
-
 
57
 
-
 
58
                $( ".posts-section" ).append(
-
 
59
                    $( "#feedTemplate" ).render( response['data']['current']['items'] )
-
 
60
                );
-
 
61
            
-
 
62
 
-
 
63
                if(response['data']['total']['pages'] > 1 ) {
-
 
64
             
-
 
65
                    $('#paginator-process-comm').show();
-
 
66
                    if(response['data']['current']['page']  > 1) {
-
 
67
                        $('#btn-page-previous').data('page', response['data']['current']['page'] - 1);
-
 
68
                        $('#btn-page-previous').show();
-
 
69
                    } else {
-
 
70
                         $('#btn-page-previous').hide();
-
 
71
                    } 
-
 
72
                    if(response['data']['current']['page'] <  response['data']['total']['pages']) {
-
 
73
                        $('#btn-page-next').data('page', response['data']['current']['page'] + 1);
-
 
74
                        $('#btn-page-next').show();
-
 
75
                    } else {
-
 
76
                         $('#btn-page-next').hide();
-
 
77
                    } 
-
 
78
 
-
 
79
                    $('#paginator-process-comm').show();
-
 
80
      
-
 
81
                } else {
-
 
82
                    $('#paginator-process-comm').hide();
-
 
83
                }
-
 
84
                            
-
 
85
    
-
 
86
            } else {
-
 
87
                $.fn.showError(response['data']);
-
 
88
            } 
-
 
89
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
90
            $.fn.showError(textStatus);
-
 
91
        }).always(function() {
-
 
92
            NProgress.done();
-
 
93
        });
-
 
94
 
-
 
95
    }
-
 
96
 
-
 
97
    $('#btn-page-previous').click(function(e) {
-
 
98
        e.preventDefault();
-
 
99
 
-
 
100
        var page = $(this).data('page');
-
 
101
        $.fn.reload(page);
-
 
102
        
-
 
103
    });
-
 
104
 
10
 
105
    $('#btn-page-next').click(function(e) {
-
 
106
        e.preventDefault();
-
 
107
 
-
 
108
        var page = $(this).data('page');
-
 
109
        $.fn.reload(page);
-
 
110
        
-
 
111
    });
-
 
112
 
-
 
113
    $.validator.setDefaults({
-
 
114
        debug: true,
-
 
115
        highlight: function(element) {
-
 
116
            $(element).addClass('form-group-has-error');
-
 
117
        },
-
 
118
        unhighlight: function(element) {
-
 
119
            $(element).removeClass('form-group-has-error');
-
 
120
        },
-
 
121
        errorElement: 'div',
-
 
122
        errorClass: 'form-group-invalid-feedback',
-
 
123
        errorPlacement: function(error, element) {
-
 
124
            if(element.context.id == 'file') {
-
 
125
                error.insertAfter(element.parent().parent().parent());
-
 
126
            } else { 
-
 
127
               if(element.parent('.form-group').length) {
-
 
128
                    error.insertAfter(element.parent());
-
 
129
                } else {
-
 
130
                    error.insertAfter(element);
-
 
131
                }
-
 
132
            }
-
 
133
 
-
 
134
 
-
 
135
        }
-
 
136
    });
-
 
137
    
-
 
138
    $.fn.showFormErrorValidator = function(fieldname, errors) {
-
 
139
        var field = $(fieldname);
-
 
140
        if(field) {
-
 
141
            $(field).addClass('form-group-has-error');
-
 
142
            
-
 
143
            var error = $('<div id="' + fieldname +'-error" class="form-group-invalid-feedback">' + errors + '</div>');
-
 
144
 
-
 
145
            var element = $(fieldname)
-
 
146
            if(element.parent('.form-group').length) {
-
 
147
                error.insertAfter(element.parent());
-
 
148
            } else if(element.parent('.file-loading').length) {
-
 
149
                error.insertAfter(element.parent().parent());
-
 
150
            } else {
11
$js = <<<JS
151
                error.insertAfter(element);
-
 
152
            }
-
 
153
        }
-
 
154
    };
-
 
155
 
-
 
156
    var validatorFeed = $('#form-feed').validate({
-
 
157
        debug: true,
-
 
158
        onclick: false,
-
 
159
        onkeyup: false,
-
 
160
        onfocusout: false,
-
 
161
        ignore: [],
-
 
162
        rules: {
-
 
163
            'shared_with' : {
-
 
164
                required: true,
-
 
165
            },
-
 
166
           'description': {
-
 
167
                updateCkeditor:function() {
-
 
168
                        CKEDITOR.instances.description_feed.updateElement();
-
 
169
                },
-
 
170
                required: true
-
 
171
            },
-
 
172
        },
-
 
173
 
-
 
174
        submitHandler: function(form)
-
 
175
        {
-
 
176
            $('input[type="submit"]').prop('disabled', true);
-
 
177
            NProgress.start();
-
 
178
            $.ajax({
-
 
179
                'dataType'  : 'json',
-
 
180
                'accept'    : 'application/json',
-
 
181
                'method'    : 'post',
-
 
182
                'url'       : $('#form-feed').attr('action'),
-
 
183
                'data'      : $('#form-feed').serialize(),
-
 
184
            }).done(function(response) {
-
 
185
                if(response['success']) {
-
 
186
                    var s = $( "#feedTemplate" ).render( response['data'] );
-
 
187
                    $(s).prependTo(".posts-section");                    
-
 
188
 
-
 
189
                   $('#form-feed')[0].reset()
-
 
190
                    $("#modal-feed-box").modal('hide'); 
-
 
191
                } else {
-
 
192
                    validatorFeed.resetForm();
-
 
193
                    if(jQuery.type(response['data']) == 'string') {
-
 
194
                        $.fn.showError(response['data']);
-
 
195
                    } else  {
-
 
196
                        $.each(response['data'], function( fieldname, errors ) {
-
 
197
                            $.fn.showFormErrorValidator('#form-feed #' + fieldname, errors);
-
 
198
                        });
-
 
199
                    }
-
 
200
                }
-
 
201
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
202
                $.fn.showError(textStatus);
-
 
203
            }).always(function() {
-
 
204
                $('input[type="submit"]').prop('disabled', false);
-
 
205
                NProgress.done();
-
 
206
            });
-
 
207
            return false;
-
 
208
        },
-
 
209
        invalidHandler: function(form, validator) {
-
 
210
        
-
 
211
        }
-
 
212
    });
-
 
213
 
-
 
214
    $('.btn-modal-feed-close').click(function(e) {
-
 
215
        e.preventDefault();
-
 
216
        $('#form-feed')[0].reset()
-
 
217
        $('#modal-feed-box').modal('hide');
-
 
218
        return false;
-
 
219
    });
-
 
220
 
-
 
221
    $('#description-main, #btn-description-main').click(function(e) {
-
 
222
        e.preventDefault();
-
 
223
 
-
 
224
        $('#form-feed')[0].reset()
-
 
225
        validatorFeed.resetForm();
-
 
226
        $("#modal-feed-box").modal('show'); 
-
 
227
    })
-
 
228
 
-
 
229
    var validatorFeedImage = $('#form-feed-image').validate({
-
 
230
        debug: true,
-
 
231
        onclick: false,
-
 
232
        onkeyup: false,
-
 
233
        onfocusout: false,
-
 
234
        ignore: [],
-
 
235
        rules: {
-
 
236
            'shared_with' : {
-
 
237
                required: true,
-
 
238
            },
-
 
239
           'description': {
-
 
240
                updateCkeditor:function() {
-
 
241
                        CKEDITOR.instances.description_image.updateElement();
-
 
242
                },
-
 
243
                required: true
-
 
244
            },
-
 
245
           'file': {
-
 
246
                required: true,
-
 
247
                extension: 'jpg|jpeg|png',
-
 
248
                accept: 'image/jpg,image/jpeg,image/png'
-
 
249
            },
-
 
250
        },
-
 
251
 
-
 
252
        submitHandler: function(form)
-
 
253
        {
-
 
254
            var formdata = false;
-
 
255
            if (window.FormData){
-
 
256
                formdata = new FormData(form); //form[0]);
-
 
257
            }
-
 
258
 
-
 
259
            $('input[type="submit"]').prop('disabled', true);
-
 
260
            NProgress.start();
-
 
261
            $.ajax({
-
 
262
                'dataType'  : 'json',
-
 
263
                'accept'    : 'application/json',
-
 
264
                'method'    : 'post',
-
 
265
                'url'       :  $('#form-feed-image').attr('action'),
-
 
266
                'data'      : formdata ? formdata : $('#form-feed-image').serialize(),
-
 
267
                'processData': false,
-
 
268
                'contentType': false,
-
 
269
            }).done(function(response) {
-
 
270
                if(response['success']) {
-
 
271
                    
-
 
272
 
-
 
273
                    var s = $( "#feedTemplate" ).render( response['data'] );
-
 
274
                    $(s).prependTo(".posts-section");  
-
 
275
 
-
 
276
                    $("#modal-feed-image-box").modal('hide');
-
 
277
                } else {
-
 
278
                    validatorFeedImage.resetForm();
-
 
279
                    if(jQuery.type(response['data']) == 'string') {
-
 
280
                        $.fn.showError(response['data']);
-
 
281
                    } else  {
-
 
282
                        $.each(response['data'], function( fieldname, errors ) {
-
 
283
                            $.fn.showFormErrorValidator('#form-feed-image #' + fieldname, errors);
-
 
284
                        });
-
 
285
                    }
-
 
286
                }
-
 
287
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
288
                $.fn.showError(textStatus);
-
 
289
            }).always(function() {
-
 
290
                $('input[type="submit"]').prop('disabled', false);
-
 
291
                NProgress.done();
-
 
292
            });
-
 
293
            return false;
-
 
294
        },
-
 
295
        invalidHandler: function(form, validator) {
-
 
296
        
-
 
297
        }
-
 
298
    });
-
 
299
 
-
 
300
    var validatorFeedVideo = $('#form-feed-video').validate({
-
 
301
        debug: true,
-
 
302
        onclick: false,
-
 
303
        onkeyup: false,
-
 
304
        onfocusout: false,
-
 
305
        ignore: [],
-
 
306
        rules: {
-
 
307
            'shared_with' : {
-
 
308
                required: true,
-
 
309
            },
-
 
310
           'description': {
-
 
311
                updateCkeditor:function() {
-
 
312
                        CKEDITOR.instances.description_video.updateElement();
-
 
313
                },
-
 
314
                required: true
-
 
315
            },
-
 
316
           'file': {
-
 
317
                required: true,
-
 
318
                extension: 'webm,mp4,webm',
-
 
319
                accept: 'video/webm,video/mpeg,video/mp4'
-
 
320
            },
-
 
321
        },
-
 
322
 
-
 
323
        submitHandler: function(form)
-
 
324
        {
-
 
325
            var formdata = false;
-
 
326
            if (window.FormData){
-
 
327
                formdata = new FormData(form); //form[0]);
-
 
328
            }
-
 
329
 
-
 
330
            $('input[type="submit"]').prop('disabled', true);
-
 
331
            NProgress.start();
-
 
332
            $.ajax({
-
 
333
                'dataType'  : 'json',
-
 
334
                'accept'    : 'application/json',
-
 
335
                'method'    : 'post',
-
 
336
                'url'       :  $('#form-feed-video').attr('action'),
-
 
337
                'data'      : formdata ? formdata : $('#form-feed-video').serialize(),
-
 
338
                'processData': false,
-
 
339
                'contentType': false,
-
 
340
            }).done(function(response) {
-
 
341
                if(response['success']) {
-
 
342
                    var s = $( "#feedTemplate" ).render( response['data'] );
-
 
343
                    $(s).prependTo(".posts-section");  
-
 
344
 
-
 
345
                    $("#modal-feed-video-box").modal('hide');
-
 
346
                } else {
-
 
347
                    validatorFeedVideo.resetForm();
-
 
348
                    if(jQuery.type(response['data']) == 'string') {
-
 
349
                        $.fn.showError(response['data']);
-
 
350
                    } else  {
-
 
351
                        $.each(response['data'], function( fieldname, errors ) {
-
 
352
                            $.fn.showFormErrorValidator('#form-feed-video #' + fieldname, errors);
-
 
353
                        });
-
 
354
                    }
-
 
355
                }
-
 
356
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
357
                $.fn.showError(textStatus);
-
 
358
            }).always(function() {
-
 
359
                $('input[type="submit"]').prop('disabled', false);
-
 
360
                NProgress.done();
-
 
361
            });
-
 
362
            return false;
-
 
363
        },
-
 
364
        invalidHandler: function(form, validator) {
-
 
365
        
-
 
366
        }
-
 
367
    });
-
 
368
 
-
 
369
    var validatorFeedDocument = $('#form-feed-document').validate({
-
 
370
        debug: true,
-
 
371
        onclick: false,
-
 
372
        onkeyup: false,
-
 
373
        onfocusout: false,
-
 
374
        ignore: [],
-
 
375
        rules: {
-
 
376
            'shared_with' : {
-
 
377
                required: true,
-
 
378
            },
-
 
379
           'description': {
-
 
380
                updateCkeditor:function() {
-
 
381
                        CKEDITOR.instances.description_document.updateElement();
-
 
382
                },
-
 
383
                required: true
-
 
384
            },
-
 
385
           'file': {
-
 
386
                required: true,
-
 
387
                extension: 'pdf',
-
 
388
                accept: 'application/pdf'
-
 
389
            },
-
 
390
        },
-
 
391
 
-
 
392
        submitHandler: function(form)
-
 
393
        {
-
 
394
            var formdata = false;
-
 
395
            if (window.FormData){
-
 
396
                formdata = new FormData(form); //form[0]);
-
 
397
            }
-
 
398
 
-
 
399
            $('input[type="submit"]').prop('disabled', true);
-
 
400
            NProgress.start();
-
 
401
            $.ajax({
-
 
402
                'dataType'  : 'json',
-
 
403
                'accept'    : 'application/json',
-
 
404
                'method'    : 'post',
-
 
405
                'url'       :  $('#form-feed-document').attr('action'),
-
 
406
                'data'      : formdata ? formdata : $('#form-feed-document').serialize(),
-
 
407
                'processData': false,
-
 
408
                'contentType': false,
-
 
409
            }).done(function(response) {
-
 
410
                if(response['success']) {
-
 
411
                    var s = $( "#feedTemplate" ).render( response['data'] );
-
 
412
                    $(s).prependTo(".posts-section");  
-
 
413
 
-
 
414
                    $("#modal-feed-document-box").modal('hide');
-
 
415
                } else {
-
 
416
                    validatorFeedDocument.resetForm();
-
 
417
                    if(jQuery.type(response['data']) == 'string') {
-
 
418
                        $.fn.showError(response['data']);
-
 
419
                    } else  {
-
 
420
                        $.each(response['data'], function( fieldname, errors ) {
-
 
421
                            $.fn.showFormErrorValidator('#form-feed-document #' + fieldname, errors);
-
 
422
                        });
-
 
423
                    }
-
 
424
                }
-
 
425
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
426
                $.fn.showError(textStatus);
-
 
427
            }).always(function() {
-
 
428
                $('input[type="submit"]').prop('disabled', false);
-
 
429
                NProgress.done();
-
 
430
            });
-
 
431
            return false;
-
 
432
        },
-
 
433
        invalidHandler: function(form, validator) {
-
 
434
        
-
 
435
        }
-
 
436
    });
-
 
437
 
-
 
438
    
-
 
439
 
-
 
440
 
-
 
441
 
-
 
442
    $('a.fa-file').on('click', function(e){
-
 
443
        e.preventDefault();
-
 
444
 
-
 
445
        $('#form-feed-document #shared_with').val('');
-
 
446
        $('#form-feed-document #file').val('');
-
 
447
        CKEDITOR.instances.description_document.setData('');
-
 
448
 
-
 
449
        $('#form-feed-document')[0].reset()
-
 
450
        validatorFeedDocument.resetForm();
-
 
451
        $('#modal-feed-document-box').modal('show');
-
 
452
    });
-
 
453
 
-
 
454
    $('#form-feed-document #file').fileinput({
-
 
455
        theme: 'fa',
-
 
456
        language: 'es',
-
 
457
        showUpload: false,
-
 
458
        dropZoneEnabled: false,
-
 
459
        maxFileCount: 1,
-
 
460
        allowedFileExtensions: ['pdf'],
-
 
461
    });
-
 
462
 
-
 
463
    
-
 
464
    $('.btn-modal-feed-document-close').on('click', function(e){
-
 
465
        e.preventDefault();
-
 
466
            
-
 
467
        $('#modal-feed-document-box').modal('hide');
-
 
468
        return false;
-
 
469
    });
-
 
470
 
-
 
471
 
-
 
472
    $('a.fa-camera').on('click', function(e){
-
 
473
        e.preventDefault();
-
 
474
 
-
 
475
        $('#form-feed-image #shared_with').val('');
-
 
476
        $('#form-feed-image #file').val('');
-
 
477
        CKEDITOR.instances.description_image.setData('');
-
 
478
 
-
 
479
        $('#form-feed-image')[0].reset()
-
 
480
        validatorFeedImage.resetForm();
-
 
481
        $('#modal-feed-image-box').modal('show');
-
 
482
    });
-
 
483
 
-
 
484
    $('#form-feed-image #file').fileinput({
-
 
485
        theme: 'fa',
-
 
486
        language: 'es',
-
 
487
        showUpload: false,
-
 
488
        dropZoneEnabled: false,
-
 
489
        maxFileCount: 1,
-
 
490
        allowedFileExtensions: ['jpg', 'jpeg', 'png', 'gif'],
-
 
491
    });
-
 
492
 
-
 
493
    
-
 
494
    $('.btn-modal-feed-image-close').on('click', function(e){
-
 
495
        e.preventDefault();
-
 
496
            
-
 
497
        $('#modal-feed-image-box').modal('hide');
-
 
498
        return false;
-
 
499
    });
-
 
500
 
-
 
501
 
-
 
502
    $('a.fa-video-camera').on('click', function(e){
-
 
503
        e.preventDefault();
-
 
504
 
Línea 12... Línea -...
12
const routeTimeline = "$routeTimeline";
-
 
Línea -... Línea 505...
-
 
505
        $('#form-feed-video #shared_with').val('');
-
 
506
        $('#form-feed-video #file').val('');
-
 
507
        CKEDITOR.instances.description_video.setData('');
-
 
508
 
-
 
509
 
-
 
510
        $('#form-feed-video')[0].reset()
-
 
511
        validatorFeedVideo.resetForm();
-
 
512
        $('#modal-feed-video-box').modal('show');
-
 
513
    });
-
 
514
 
-
 
515
    $('#form-feed-video #file').fileinput({
-
 
516
        theme: 'fa',
-
 
517
        language: 'es',
-
 
518
        showUpload: false,
-
 
519
        dropZoneEnabled: false,
-
 
520
        maxFileCount: 1,
-
 
521
        allowedFileExtensions: ['mp4', 'mpeg','webm'],
-
 
522
    });
-
 
523
 
-
 
524
    
-
 
525
    $('.btn-modal-feed-video-close').on('click', function(e){
-
 
526
        e.preventDefault();
-
 
527
            
-
 
528
        $('#modal-feed-video-box').modal('hide');
-
 
529
        return false;
-
 
530
    });
-
 
531
 
-
 
532
    $('body').on('click', 'a.btn-indicator', function(e) {
-
 
533
    
-
 
534
        e.preventDefault();
-
 
535
    });
-
 
536
 
-
 
537
 
-
 
538
 
-
 
539
   
-
 
540
 
-
 
541
 
-
 
542
    $('body').on('submit', 'form.form-comment-feed', function(e) {
-
 
543
        e.preventDefault();
-
 
544
 
-
 
545
        var form = $(this);
-
 
546
        var url = form.attr('action');
-
 
547
        var unique  = $(this).data('feed-unique');
-
 
548
 
-
 
549
        NProgress.start();
-
 
550
        $.ajax({
-
 
551
            'dataType'  : 'json',
-
 
552
            'accept'    : 'application/json',
-
 
553
            'method'    : 'post',
-
 
554
            'url'       :  url,
-
 
555
            'data'      : form.serialize(),
13
const allowFastSurvey = $allowFastSurvey;
556
        }).done(function(response) {
-
 
557
            if(response['success']) {
-
 
558
                $('#comment-' + unique).val('');
-
 
559
 
-
 
560
                var s = $( "#commentTemplate" ).render( response['data'] );
-
 
561
                $(s).appendTo('.comment-sec-' + unique + ' ul');  
-
 
562
 
-
 
563
                $('#btn-comments-' + unique).html('<i class="fa fa-comments"></i> ' + response['total_comments']);
-
 
564
 
-
 
565
                $('form.form-comment-feed > input[name="comment"]').val('');
-
 
566
                
-
 
567
            } else {
-
 
568
               $.fn.showError(response['data']);
-
 
569
            }
-
 
570
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
571
            $.fn.showError(textStatus);
-
 
572
        }).always(function() {
-
 
573
            NProgress.done();
-
 
574
        });
-
 
575
        return false;
-
 
576
 
-
 
577
    });
-
 
578
 
-
 
579
 
-
 
580
    $.fn.deleteFeed = function(url, feed_unique) {
-
 
581
 
-
 
582
 
-
 
583
        NProgress.start();
-
 
584
        $.ajax({
-
 
585
            'dataType'  : 'json',
-
 
586
            'accept'    : 'application/json',
-
 
587
            'method'    : 'post',
-
 
588
            'url'       :  url,
-
 
589
        }).done(function(response) {
-
 
590
            if(response['success']) {
-
 
591
              $('.post-bar-' +  feed_unique).remove();
-
 
592
 
-
 
593
                $.fn.showSuccess(response['data']);
-
 
594
            } else {
-
 
595
                $.fn.showError(response['data']);
-
 
596
            } 
-
 
597
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
598
            $.fn.showError(textStatus);
-
 
599
        }).always(function() {
-
 
600
            NProgress.done();
-
 
601
        });
-
 
602
 
-
 
603
    }
-
 
604
 
-
 
605
    $('body').on('click', 'a.btn-feed-trash', function(e) {
-
 
606
        e.preventDefault();
-
 
607
        var url = $(this).data('link');
-
 
608
        var feed_unique = $(this).data('feed-unique');
-
 
609
 
-
 
610
          swal.fire({
-
 
611
            title: 'LABEL_ARE_YOU_SURE',
-
 
612
            message: 'LABEL_QUESTION_DELETE_POST',
-
 
613
            icon: 'question',
-
 
614
            cancelButtonText: 'LABEL_NO',
-
 
615
            showCancelButton: true,
-
 
616
            confirmButtonText: 'LABEL_YES'
-
 
617
          }).then((result) => {
-
 
618
            if (result.isConfirmed) {
-
 
619
                $.fn.deleteFeed(url, feed_unique);
-
 
620
            }
-
 
621
        });
-
 
622
    });
-
 
623
 
-
 
624
 
-
 
625
    $.fn.deleteComment = function(url, unique) {
-
 
626
 
-
 
627
         var feed_unique = $('.comment-' + unique).closest('div.comment-sec').data('feed-unique');
-
 
628
 
-
 
629
        NProgress.start();
-
 
630
        $.ajax({
-
 
631
            'dataType'  : 'json',
-
 
632
            'accept'    : 'application/json',
-
 
633
            'method'    : 'post',
-
 
634
            'url'       :  url,
-
 
635
        }).done(function(response) {
-
 
636
            if(response['success']) {
-
 
637
 
-
 
638
                $('.comment-' + unique).closest('li').remove();
-
 
639
                $('#btn-comments-' + feed_unique).html('<i class="fa fa-comments"></i> ' + response['data']['total_comments']);
-
 
640
            
-
 
641
                $.fn.showSuccess(response['data']['message']);
-
 
642
            } else {
-
 
643
                $.fn.showError(response['data']);
-
 
644
            } 
-
 
645
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
646
            $.fn.showError(textStatus);
-
 
647
        }).always(function() {
-
 
648
            NProgress.done();
-
 
649
        });
-
 
650
 
-
 
651
 
-
 
652
    }
-
 
653
 
-
 
654
 
-
 
655
    $('body').on('click', 'a.btn-comment-trash', function(e) {
-
 
656
        e.preventDefault();
-
 
657
        var url = $(this).data('link');
-
 
658
        var unique = $(this).data('comment-unique');
-
 
659
        
-
 
660
          swal.fire({
-
 
661
            title: 'LABEL_ARE_YOU_SURE',
-
 
662
            message: 'LABEL_QUESTION_DELETE_COMMENT',
-
 
663
            icon: 'question',
-
 
664
            cancelButtonText: 'LABEL_NO',
-
 
665
            showCancelButton: true,
-
 
666
            confirmButtonText: 'LABEL_YES'
-
 
667
          }).then((result) => {
-
 
668
            if (result.isConfirmed) {
-
 
669
                   $.fn.deleteComment(url, unique);
-
 
670
            }
-
 
671
        });
-
 
672
    });
-
 
673
 
-
 
674
 
-
 
675
    $('div.modal').on("hide.bs.modal", function() {
-
 
676
    	$(".wrapper").removeClass("overlay");
-
 
677
    })
-
 
678
 
-
 
679
 
-
 
680
    $.fn.reload(1);
-
 
681
 
-
 
682
    CKEDITOR.replace('description_feed');
-
 
683
    CKEDITOR.replace('description_video');
-
 
684
    CKEDITOR.replace('description_image');
-
 
685
    CKEDITOR.replace('description_document');
-
 
686
 
14
JS;
687
 
-
 
688
});
15
 
689
 
Línea 16... Línea -...
16
$this->inlineScript()->appendScript($js);
-
 
17
 
-
 
18
$this->headLink()->appendStylesheet('/react-bundles/feeds/main.css');
690
 
-
 
691
JS;
-
 
692
$this->inlineScript()->captureEnd();
-
 
693
 
-
 
694
?>
-
 
695
 
-
 
696
<div class="container">
-
 
697
   <div class="card">
-
 
698
   		<h6 class="card-title">LABEL_FEEDS</h6>
-
 
699
   		<div class="card-body">
-
 
700
        	<div class="feed-container">
-
 
701
                <div class="">
-
 
702
                    <div class="main-ws-sec">
-
 
703
                        <div class="">
-
 
704
                            <div class="">
-
 
705
                                <div class="post-bar">
-
 
706
                                    <form id="form-main" name="form-main">
-
 
707
                                        <div class="post_topbar">
-
 
708
 
-
 
709
                                            <div class="mar-top clearfix">
-
 
710
                                                <div class="form-group">
-
 
711
                                                </div>
-
 
712
                                                <div class="form-group">
-
 
713
                                                    <textarea id="description-main" name="description-main" placeholder="¿Qué tienes en mente?" class="form-control" readonly="readonly" rows="2"></textarea>	
-
 
714
                                                </div>
-
 
715
                                            </div>	
-
 
716
                                            <div class="mar-top clearfix">
-
 
717
                                                <button class="btn btn-sm btn-primary pull-right" type="button" id="btn-description-main"><i class="fa fa-pencil fa-fw"></i> LABEL_SHARE </button>
-
 
718
                                                <a class="btn btn-trans btn-icon fa fa-video-camera add-tooltip" href="#"></a>
-
 
719
                                                <a class="btn btn-trans btn-icon fa fa-camera add-tooltip" href="#"></a>
-
 
720
                                                <a class="btn btn-trans btn-icon fa fa-file add-tooltip" href="#"></a>
-
 
721
                                            </div>
-
 
722
                                        </div>
-
 
723
                                    </form>
-
 
724
                                </div>
-
 
725
                            </div>
-
 
726
                        </div>
-
 
727
                            <!--posts-section star-->
-
 
728
                        <div class="posts-section" >
-
 
729
                            
-
 
730
                        </div>
-
 
731
                            
-
 
732
                        <div class="process-comm" id="paginator-process-comm" style="display: none"> 
-
 
733
                            <button class="btn btn-sm btn-primary" data-page="0" id="btn-page-previous"> <i class="fa fa-chevron-left" aria-hidden="true"></i> LABEL_PREVIOUS </button>
-
 
734
                            <button class="btn btn-sm btn-primary" data-page="0" id="btn-page-next"> LABEL_NEXT <i class="fa fa-chevron-right" aria-hidden="true"></i> </button>
-
 
735
                        </div>
-
 
736
                            <!--posts-section end-->
-
 
737
                    </div>
-
 
738
                </div> <!--main-ws-sec end-->
-
 
739
		    </div>
-
 
740
	    </div>
-
 
741
	</div>		
-
 
742
</div>
-
 
743
 
-
 
744
 
-
 
745
<div class="modal" tabindex="-1" role="dialog" id="modal-feed-image-box">
-
 
746
	<div class="modal-dialog" role="document">
-
 
747
		<?php 
-
 
748
		$form = $this->formFeed;
-
 
749
        $form->setAttributes([
-
 
750
            'method' => 'post',
-
 
751
            'action' => $this->url('feeds/add'),
-
 
752
            'name' => 'form-feed-image',
-
 
753
            'id' => 'form-feed-image',
-
 
754
            'enctype' => 'multipart/form-data' 
-
 
755
        ]);
-
 
756
        $form->prepare();
-
 
757
        echo $this->form()->openTag($form);
-
 
758
        
-
 
759
        
-
 
760
        ?> 
-
 
761
		<div class="modal-content">
-
 
762
    		<div class="modal-header">
-
 
763
         		<h3 class="modal-title">LABEL_SHARE_IMAGE</h3>
-
 
764
        	</div>
-
 
765
   			<div class="modal-body">
-
 
766
                <div class="form-group">
-
 
767
                	<?php 
-
 
768
                    $element = $form->get('description');
-
 
769
                    $element->setAttributes(['id' => 'description_image', 'rows' => '2', 'placeholder' => '¿Qué tienes en mente?', 'class' => 'form-control']);
-
 
770
                    echo $this->formTextArea($element);
-
 
771
                    ?>
-
 
772
   				</div>
-
 
773
   				<div class="form-group">
-
 
774
                	<div class="file-loading">
-
 
775
                 		<?php 
-
 
776
                        $element = $form->get('file');
-
 
777
                        $element->setAttributes(['accept' => 'image/jpg,image/jpeg,image/png']);
-
 
778
                        echo $this->formFile($element);
-
 
779
                        ?>
-
 
780
                	</div>
-
 
781
          		</div>
-
 
782
          	</div>	
-
 
783
           	<div class="modal-footer">
-
 
784
           		<button type="submit" class="btn btn-sm btn-primary save">LABEL_UPLOAD</button>
-
 
785
            	<button type="button" class="btn btn-light cancel btn-modal-feed-image-close">LABEL_CANCEL</button>
-
 
786
			</div>
-
 
787
			
-
 
788
		</div>	
-
 
789
    	<a href="#" title="" class="close-box btn-feed-image-close"><i class="la la-close"></i></a>
-
 
790
    	<?php echo $this->form()->closeTag($form); ?>		
-
 
791
	</div>
-
 
792
</div>
-
 
793
 
-
 
794
 
-
 
795
<div class="modal" tabindex="-1" role="dialog" id="modal-feed-video-box">
-
 
796
	<div class="modal-dialog" role="document">
-
 
797
		<?php 
-
 
798
		$form = $this->formFeed;
-
 
799
        $form->setAttributes([
-
 
800
            'method' => 'post',
-
 
801
            'action' => $this->url('feeds/add'),
-
 
802
            'name' => 'form-feed-video',
-
 
803
            'id' => 'form-feed-video',
-
 
804
            'enctype' => 'multipart/form-data' 
-
 
805
        ]);
-
 
806
        $form->prepare();
-
 
807
        echo $this->form()->openTag($form);
-
 
808
        
-
 
809
 
-
 
810
        ?> 
-
 
811
		<div class="modal-content">
-
 
812
    		<div class="modal-header">
-
 
813
         		<h3 class="modal-title">LABEL_SHARE_VIDEO</h3>
-
 
814
        	</div>
-
 
815
   			<div class="modal-body">
-
 
816
                <div class="form-group">
-
 
817
                	<?php 
-
 
818
                    $element = $form->get('description');
-
 
819
                    $element->setAttributes(['id' => 'description_video', 'rows' => '2', 'placeholder' => '¿Qué tienes en mente?', 'class' => 'form-control']);
-
 
820
                    echo $this->formTextArea($element);
-
 
821
                    ?>
-
 
822
   				</div>
-
 
823
   				<div class="form-group">
-
 
824
                	<div class="file-loading">
-
 
825
                 		<?php 
-
 
826
                        $element = $form->get('file');
-
 
827
                        $element->setAttributes(['accept' => 'video/webm,video/mpeg,video/mp4']);
-
 
828
                        echo $this->formFile($element);
-
 
829
                        ?>
-
 
830
                	</div>
-
 
831
          		</div>
-
 
832
         	</div>
-
 
833
         	<div class="modal-footer">
-
 
834
            	<button type="submit" class="btn btn-sm btn-primary save">LABEL_UPLOAD</button>
-
 
835
            	<button type="button" class="btn btn-light cancel btn-modal-feed-video-close">LABEL_CANCEL</button>
-
 
836
           	</div>
-
 
837
			
-
 
838
		</div>	
-
 
839
    	<a href="#" title="" class="close-box btn-feed-video-close"><i class="la la-close"></i></a>
-
 
840
    	<?php echo $this->form()->closeTag($form); ?>		
-
 
841
	</div>
-
 
842
</div>
-
 
843
 
-
 
844
<div class="modal" tabindex="-1" role="dialog" id="modal-feed-document-box">
-
 
845
	<div class="modal-dialog" role="document">
-
 
846
		<?php 
-
 
847
		$form = $this->formFeed;
-
 
848
        $form->setAttributes([
-
 
849
            'method' => 'post',
-
 
850
            'action' => $this->url('feeds/add'),
-
 
851
            'name' => 'form-feed-document',
-
 
852
            'id' => 'form-feed-document',
-
 
853
            'enctype' => 'multipart/form-data' 
-
 
854
        ]);
-
 
855
        $form->prepare();
-
 
856
        echo $this->form()->openTag($form);
-
 
857
        
-
 
858
 
-
 
859
        
-
 
860
        ?> 
-
 
861
		<div class="modal-content">
-
 
862
    		<div class="modal-header">
-
 
863
         		<h3 class="modal-title">LABEL_SHARE_DOCUMENT</h3>
-
 
864
        	</div>
-
 
865
   			<div class="modal-body">
-
 
866
                <div class="form-group">
-
 
867
                	<?php 
-
 
868
                    $element = $form->get('description');
-
 
869
                    $element->setAttributes(['id' => 'description_document', 'rows' => '2', 'placeholder' => '¿Qué tienes en mente?', 'class' => 'form-control']);
-
 
870
                    echo $this->formTextArea($element);
-
 
871
                    ?>
-
 
872
   				</div>
-
 
873
   				<div class="form-group">
-
 
874
                	<div class="file-loading">
-
 
875
                 		<?php 
-
 
876
                        $element = $form->get('file');
-
 
877
                        $element->setAttributes(['accept' => 'application/pdf']);
-
 
878
                        echo $this->formFile($element);
-
 
879
                        ?>
-
 
880
                	</div>
-
 
881
          		</div>
-
 
882
          	</div>	
-
 
883
            <div class="modal-footer">
-
 
884
            	<button type="submit" class="btn btn-sm btn-primary save">LABEL_UPLOAD</button>
-
 
885
            	<button type="button" class="btn btn-light cancel btn-modal-feed-document-close">LABEL_CANCEL</button>
-
 
886
            </div>
-
 
887
		</div>	
-
 
888
    	<a href="#" title="" class="close-box btn-feed-document-close"><i class="la la-close"></i></a>
-
 
889
    	<?php echo $this->form()->closeTag($form); ?>		
-
 
890
	</div>
-
 
891
</div>
-
 
892
 
-
 
893
<div class="modal" tabindex="-1" role="dialog" id="modal-feed-box">
-
 
894
	<div class="modal-dialog" role="document">
-
 
895
		<?php 
-
 
896
		$form = $this->formFeed;
-
 
897
        $form->setAttributes([
-
 
898
            'method' => 'post',
-
 
899
            'action' => $this->url('feeds/add'),
-
 
900
            'name' => 'form-feed',
-
 
901
            'id' => 'form-feed',
-
 
902
        ]);
-
 
903
        $form->prepare();
-
 
904
        echo $this->form()->openTag($form);
-
 
905
        
-
 
906
 
-
 
907
        
-
 
908
        ?> 
-
 
909
		<div class="modal-content">
-
 
910
    		<div class="modal-header">
-
 
911
         		<h3 class="modal-title">LABEL_SHARE</h3>
-
 
912
        	</div>
-
 
913
   			<div class="modal-body">
-
 
914
                <div class="form-group">
-
 
915
                	<?php 
-
 
916
                    $element = $form->get('description');
-
 
917
                    $element->setAttributes(['id' => 'description_feed', 'rows' => '2', 'placeholder' => '¿Qué tienes en mente?', 'class' => 'form-control']);
-
 
918
                    echo $this->formTextArea($element);
-
 
919
                    ?>
-
 
920
   				</div>
-
 
921
   			</div>	
-
 
922
            <div class="modal-footer">
-
 
923
            	<button type="submit" class="btn btn-sm btn-primary save">LABEL_SAVE</button>
-
 
924
            	<button type="button" class="btn btn-light cancel btn-modal-feed-close">LABEL_CANCEL</button>
-
 
925
            </div>
-
 
926
		</div>	
-
 
927
    	<a href="#" title="" class="close-box btn-modal-feed-close"><i class="la la-close"></i></a>
-
 
928
    	<?php echo $this->form()->closeTag($form); ?>		
-
 
929
	</div>
-
 
930
</div>
-
 
931
 
-
 
932
 
-
 
933
 
-
 
934
 
-
 
935
<script id="commentTemplate" type="text/x-jsrender">
-
 
936
                    <li>
-
 
937
				        <div class="comment-list">
-
 
938
							 <div class="comment comment-{{:unique}}" >
-
 
939
    					         <a href="{{>user_url}}"><h3>{{>user_name}}</h3>
-
 
940
    						     <span><img src="<?php echo $this->basePath('images/clock.png') ?>" alt="">{{>time_elapsed}} 
-
 
941
                                {{if link_delete}}
-
 
942
                                    <a href="#" class="btn-comment-trash" data-link="{{:link_delete}}" data-comment-unique="{{>unique}}"><i class="fa fa-trash"></i></a> 
-
 
943
                                {{/if}}
-
 
944
                                 </span>
-
 
945
                                
-
 
946
								 <p>{{>comment}}</p>
-
 
947
						     </div>
-
 
948
	                   </div>
-
 
949
	               </li>
-
 
950
</script>
-
 
951
 
-
 
952
<script id="feedTemplate" type="text/x-jsrender">
-
 
953
    <div class="post-bar post-bar-{{>feed_unique}}">
-
 
954
        <div class="post_topbar">
-
 
955
            <div class="usy-dt">
-
 
956
                <a href="{{>owner_url}}">
-
 
957
                    <img src="{{>owner_image}}" alt="" style="width:50px; height: auto">
-
 
958
                    <div class="usy-name">
-
 
959
                        <h3>{{>owner_name}}</h3>
-
 
960
                        <span>
-
 
961
                            <img src="<?php echo $this->basePath('images/clock.png') ?>" alt="">
-
 
962
                            {{>owner_time_elapse}} 
-
 
963
                            {{if feed_delete_url}}  
-
 
964
                                <a href="#" class="btn-feed-trash" data-link="{{:feed_delete_url}}" data-feed-unique="{{>feed_unique}}"><i class="fa fa-trash"></i></a>
-
 
965
                            {{/if}}
-
 
966
                        </span>  
-
 
967
                    </div>
-
 
968
                </a>
-
 
969
            </div>
-
 
970
        </div>
-
 
971
        <div class="job_descp">
-
 
972
            <p>
-
 
973
            <div  class="show-read-more">{{:owner_description}}</div>
-
 
974
            </p>
-
 
975
            {{if owner_file_image}}
-
 
976
             <img src="{{>owner_file_image}}" class="Entradas">
-
 
977
            {{/if}}
-
 
978
            {{if owner_file_video}}
-
 
979
             <video src="{{>owner_file_video}}" controls  poster="{{>owner_file_image_preview}}">
-
 
980
            {{/if}}
-
 
981
            {{if owner_file_document}}
-
 
982
                <a href="{{>owner_file_document}}" target="_blank">Descargar</a>
-
 
983
            {{/if}}
-
 
984
 
-
 
985
    {{if shared_name}}
-
 
986
    <div class="post-bar">
-
 
987
        <div class="post_topbar">
-
 
988
            <div class="usy-dt">
-
 
989
                <img src="{{>shared_image}}" alt="" style="width:50px; height: auto">
-
 
990
                <div class="usy-name">
-
 
991
                    <h3>{{>shared_name}}</h3>
-
 
992
                    <span><img style="width: 12px; height: auto" src="<?php echo $this->basePath('images/clock.png') ?>" alt="">{{>shared_time_elapse}}</span>       
-
 
993
                </div>
-
 
994
            </div>
-
 
995
        </div>
-
 
996
        <div class="job_descp">
-
 
997
            <p>
-
 
998
            <div  class="show-read-more">{{:shared_description}}</div>
-
 
999
            </p>
-
 
1000
            {{if shared_file_image}}
-
 
1001
             <img src="{{>shared_file_image}}" class="Entradas">
-
 
1002
            {{/if}}
-
 
1003
            {{if shared_file_video}}
-
 
1004
             <video src="{{>shared_file_video}}" controls  poster="{{>shared_file_image_preview}}">
-
 
1005
            {{/if}}
-
 
1006
            {{if shared_file_document}}
-
 
1007
                <a href="{{>shared_file_document}}" target="_blank">Descargar</a>
-
 
1008
            {{/if}}
-
 
1009
        </div>
-
 
1010
    </div>
-
 
1011
    {{/if}}
-
 
1012
 
-
 
1013
 
-
 
1014
        </div>
-
 
1015
        <div class="job-status-bar">
-
 
1016
            <ul class="like-com">
-
 
1017
                <li>
-
 
1018
                    <a href="#" id="btn-comments-{{>feed_unique}}" class="btn-indicator"><i class="fa fa-comments"></i> {{>owner_comments}}</a>
-
 
1019
                </li>
-
 
1020
                <li>
-
 
1021
                    <a href="#" id="btn-share-{{>feed_unique}}" class="btn-indicator"><i class="fa fa-share"></i> {{>owner_shared}}</a>
-
 
1022
                </li>
-
 
1023
            </ul>
-
 
1024
         
-
 
1025
        </div>
-
 
1026
        {{if comments}}
-
 
1027
            <div class="comment-section">
-
 
1028
                <div class="comment-sec comment-sec-{{>feed_unique}}" data-feed-unique="{{>feed_unique}}">
-
 
1029
                    <ul>
-
 
1030
                        {{for comments}}
-
 
1031
                            <li>
-
 
1032
                                <div class="comment-list">
-
 
1033
                                    <div class="comment comment-{{:unique}}" >
-
 
1034
                                        <span><img src="<?php echo $this->basePath('images/clock.png') ?>" alt="">{{>time_elapsed}} 
-
 
1035
                                        <a href="{{>user_url}}"><h3>{{>user_name}}</h3>
-
 
1036
                                        {{if link_delete}}
-
 
1037
                                            <a href="#" class="btn-comment-trash" data-link="{{:link_delete}}" 
-
 
1038
                                                data-comment-unique="{{>unique}}"><i class="fa fa-trash"></i></a> 
-
 
1039
                                        {{/if}}
-
 
1040
                                        </span>
-
 
1041
                                        
-
 
1042
                                        <p>{{>comment}}</p>
-
 
1043
                                    </div>
-
 
1044
                                </div>
-
 
1045
                            </li>
-
 
1046
                        {{/for}}
-
 
1047
                    </ul>
-
 
1048
                </div>
-
 
1049
            </div>
-
 
1050
        {{/if}}
-
 
1051
        <div class="comment_box">
-
 
1052
            <form  class="form-comment-feed" data-feed-unique="{{>feed_unique}}"  action="{{>comment_add_url}}">
-
 
1053
                <input type="text" name="comment" id="comment-{{>feed_unique}}" maxlength="256"  placeholder="LABEL_WRITE_A_COMMENT">
19
$this->inlineScript()->appendFile('/react-bundles/feeds/feedsBundle.js');
1054
                <button type="submit">LABEL_SEND</button>