Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 8767 Rev 11152
Línea 1... Línea 1...
1
<?php
1
<?php
2
 
-
 
3
use LeadersLinked\Model\UserExperience;
2
use LeadersLinked\Model\UserExperience;
4
 
-
 
5
$acl = $this->viewModel()
3
$acl = $this->viewModel()
6
    ->getRoot()
4
    ->getRoot()
7
    ->getVariable('acl');
5
    ->getVariable('acl');
8
$currentUserHelper = $this->currentUserHelper();
6
$currentUserHelper = $this->currentUserHelper();
9
$currentUser = $currentUserHelper->getUser();
7
$currentUser = $currentUserHelper->getUser();
Línea 22... Línea 20...
22
$routeImageUpload = $this->url('profile/image', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
20
$routeImageUpload = $this->url('profile/image', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
23
$routeCoverUpload = $this->url('profile/cover', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
21
$routeCoverUpload = $this->url('profile/cover', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
24
$routeFooterUpload = $this->url('profile/footer', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
22
$routeFooterUpload = $this->url('profile/footer', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
25
$routeHeaderUpload = $this->url('profile/header', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
23
$routeHeaderUpload = $this->url('profile/header', ['id' => $currentCompany->uuid, 'operation' => 'upload']);
Línea 26... Línea -...
26
 
-
 
27
$this->headLink()->appendStylesheet($this->basePath('plugins/nprogress/nprogress.css'));
-
 
28
$this->inlineScript()->appendFile($this->basePath('plugins/nprogress/nprogress.js'));
-
 
29
 
-
 
30
$this->inlineScript()->appendFile($this->basePath('plugins/ckeditor/ckeditor.js'));
-
 
31
 
-
 
32
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/css/fileinput.min.css'));
-
 
33
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.css'));
-
 
34
 
-
 
35
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/piexif.js'));
-
 
36
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/plugins/sortable.js'));
-
 
37
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/fileinput.js'));
-
 
38
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/js/locales/es.js'));
-
 
39
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/fas/theme.js'));
-
 
40
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap-fileinput/themes/explorer-fas/theme.js'));
-
 
41
 
-
 
42
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/jquery.validate.js'));
-
 
43
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/additional-methods.js'));
-
 
44
$this->inlineScript()->appendFile($this->basePath('plugins/jquery-validation/localization/messages_es.js'));
-
 
45
 
-
 
46
$this->headLink()->appendStylesheet($this->basePath('plugins/select2/css/select2.min.css'));
-
 
47
$this->headLink()->appendStylesheet($this->basePath('plugins/select2-bootstrap4-theme/select2-bootstrap4.min.css'));
-
 
48
$this->inlineScript()->appendFile($this->basePath('plugins/select2/js/select2.min.js'));
-
 
49
 
-
 
50
$this->headLink()->appendStylesheet($this->basePath('plugins/bootstrap4-toggle/css/bootstrap4-toggle.min.css'));
-
 
51
$this->inlineScript()->appendFile($this->basePath('plugins/bootstrap4-toggle/js/bootstrap4-toggle.min.js'));
-
 
52
 
-
 
53
 
-
 
54
$this->inlineScript()->captureStart();
-
 
55
echo <<<JS
-
 
56
jQuery( document ).ready(function( $ ) {
-
 
57
 
-
 
58
    $.validator.addMethod('greaterThan', function (value, element, param) {
-
 
59
        var otherElement = $(param);
-
 
60
        return parseInt(value, 10) > parseInt(otherElement.val(), 10);
-
 
61
    }, 'ERROR_INVALID_MINIMUM');
-
 
62
    
-
 
63
            $.validator.setDefaults({
-
 
64
            debug: true,
-
 
65
            highlight: function(element) {
-
 
66
                $(element).addClass('is-invalid');
-
 
67
            },
-
 
68
            unhighlight: function(element) {
-
 
69
                $(element).removeClass('is-invalid');
-
 
70
            },
-
 
71
            errorElement: 'span',
-
 
72
            errorClass: 'error invalid-feedback',
-
 
73
            errorPlacement: function(error, element) {
-
 
74
                if(element.parent('.form-group').length) {
-
 
75
                    error.insertAfter(element);
-
 
76
                } else if(element.parent('.toggle').length) {
-
 
77
                    error.insertAfter(element.parent().parent());
-
 
78
                } else {
-
 
79
                    error.insertAfter(element.parent());
-
 
80
                }
-
 
81
            }
-
 
82
        });
-
 
83
    
-
 
84
    
-
 
85
        $.fn.showFormErrorValidator = function(fieldname, errors) {
-
 
86
            var field = $(fieldname);
-
 
87
            if(field) {
-
 
88
                $(field).addClass('is-invalid');
-
 
89
    
-
 
90
 
-
 
91
                var error = $('<span id="' + fieldname +'-error" class="error invalid-feedback">' + errors + '</div>');
-
 
92
                if(field.parent('.form-group').length) {
-
 
93
                    error.insertAfter(field);
-
 
94
                } else  if(field.parent('.toggle').length) {
-
 
95
                    error.insertAfter(field.parent().parent());
-
 
96
                } else {
-
 
97
                    error.insertAfter(field.parent());
-
 
98
                }
-
 
99
            }
-
 
100
        };
-
 
101
    
-
 
102
    var validatorExtended = $('#form-extended').validate({
-
 
103
        debug: true,
-
 
104
        onclick: false,
-
 
105
        onkeyup: false,
-
 
106
        onfocusout: false,
-
 
107
        ignore: [],
-
 
108
        rules: {
-
 
109
            'description': {
-
 
110
                updateCkeditor:function() {
-
 
111
                        CKEDITOR.instances.description.updateElement();
-
 
112
                },
-
 
113
                required: false,
-
 
114
            },
-
 
115
        },
-
 
116
 
-
 
117
        submitHandler: function(form)
-
 
118
        {
-
 
119
            NProgress.start();
-
 
120
            $.ajax({
-
 
121
                'dataType'  : 'json',
-
 
122
                'accept'    : 'application/json',
-
 
123
                'method'    : 'post',
-
 
124
                'url'       :  $('#form-extended').attr('action'),
-
 
125
                'data'      :  $('#form-extended').serialize()
-
 
126
            }).done(function(response) {
-
 
127
                if(response['success']) {
-
 
128
 
-
 
129
                    $('#overview-description').html(response['data']['description']);
-
 
130
                    $("#extended-box").modal('hide');
-
 
131
                } else {
-
 
132
                    validatorExtended.resetForm();
-
 
133
                    if(jQuery.type(response['data']) == 'string') {
-
 
134
                        $.fn.showError(response['data']);
-
 
135
                    } else  {
-
 
136
                        $.each(response['data'], function( fieldname, errors ) {
-
 
137
                            $.fn.showFormErrorValidator('#form-extended #' + fieldname, errors);
-
 
138
                        });
-
 
139
                    }
-
 
140
                }
-
 
141
            }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
142
                $.fn.showError(textStatus);
-
 
143
            }).always(function() {
-
 
144
                NProgress.done();
-
 
145
            });
-
 
146
            return false;
-
 
147
        },
-
 
148
        invalidHandler: function(form, validator) {
-
 
149
        
-
 
150
        }
-
 
151
    });
-
 
152
 
-
 
153
 
-
 
154
    $('.btn-extended-edit').on("click", function(e){
-
 
155
        e.preventDefault();
-
 
156
 
-
 
157
        NProgress.start();
-
 
158
        $.ajax({
-
 
159
            'dataType'  : 'json',
-
 
160
            'accept'    : 'application/json',
-
 
161
            'method'    : 'get',
-
 
162
            'url'       : '$routeExtended',
-
 
163
        }).done(function(response) {
-
 
164
           if(response['success']) {
-
 
165
                CKEDITOR.instances.description.setData(response['data']['description']);
-
 
166
                validatorExtended.resetForm();
-
 
167
 
-
 
168
                $("#extended-box").modal('show');
-
 
169
            } else {
-
 
170
                $.fn.showError(response['data']);
-
 
171
            }
-
 
172
        }).fail(function( jqXHR, textStatus, errorThrown) {
-
 
173
            $.fn.showError(textStatus);
-
 
174
        }).always(function() {
-
 
175
            NProgress.done();
-
 
176
        });
-
 
177
        return false;
-
 
178
 
-
 
179
    });
-
 
180
    
-
 
181
    $('.btn-extended-close').on("click", function(e){
-
 
182
        e.preventDefault();
-
 
183
        
-
 
184
        $("#extended-box").modal('hide');
-
 
185
        return false;
-
 
186
    });
-
 
187
    
-
 
188
    CKEDITOR.replace('description', {
-
 
189
        toolbar: [
-
 
190
                    { name: 'editing', items: ['Scayt'] },
-
 
191
                    { name: 'links', items: ['Link', 'Unlink'] },
-
 
192
                    { name: 'paragraph', items: ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent', 'Blockquote'] },
-
 
193
                    { name: 'basicstyles', items: ['Bold', 'Italic', 'Strike', 'RemoveFormat'] },
-
 
194
                    '/',
-
 
195
                    { name: 'insert', items: ['Image', 'Table', 'HorizontalRule', 'SpecialChar'] },
-
 
196
                    { name: 'styles', items: ['Styles', 'Format'] },
-
 
197
                    { name: 'tools', items: ['Maximize'] }
-
 
198
                ],
-
 
199
                removePlugins: 'elementspath,Anchor',
-
 
200
                heigth: 100
-
 
201
    });
-
 
202
    
-
 
203
});
-
 
204
 
-
 
205
 
-
 
206
JS;
-
 
207
$this->inlineScript()->captureEnd();
-
 
208
 
24
 
Línea 209... Línea 25...
209
$jsonLocations = json_encode($locations);
25
$jsonLocations = json_encode($locations);
210
 
26
 
211
$js = <<<JS
27
$js = <<<JS
Línea 262... Línea 78...
262
    }
78
    }
263
</style>
79
</style>
Línea 264... Línea 80...
264
 
80
 
265
<!-- Content Header (Page header) -->
81
<!-- Content Header (Page header) -->
266
<div id="profile">
-
 
267
</div>
-
 
268
 
-
 
269
<div class="modal" tabindex="-1" role="dialog" id="extended-box">
-
 
270
    <div class="modal-dialog" role="document">
-
 
271
        <?php
-
 
272
        $form = $this->formExtended;
-
 
273
        $form->setAttributes([
-
 
274
            'method' => 'post',
-
 
275
            'action' => $routeExtended,
-
 
276
            'name' => 'form-extended',
-
 
277
            'id' => 'form-extended'
-
 
278
        ]);
-
 
279
        $form->prepare();
-
 
280
        echo $this->form()->openTag($form);
-
 
281
        ?>
-
 
282
        <div class="modal-content">
-
 
283
            <div class="modal-header">
-
 
284
                <h3 class="modal-title">LABEL_CHANGE</h3>
-
 
285
            </div>
-
 
286
            <div class="modal-body">
-
 
287
                <div class="form-group">
-
 
288
                    <?php
-
 
289
                    $element = $form->get('description');
-
 
290
                    $element->setAttributes(['class' => 'form-control']);
-
 
291
                    $element->setOptions(['label' => 'LABEL_OVERVIEW']);
-
 
292
                    echo $this->formLabel($element);
-
 
293
                    echo $this->formTextArea($element);
-
 
294
                    ?>
-
 
295
                </div>
-
 
296
            </div>
-
 
297
            <div class="modal-footer">
-
 
298
                <button type="submit" class="btn btn-primary">LABEL_SAVE</button>
-
 
299
                <button type="button" class="btn btn-default btn-extended-close">LABEL_CANCEL</button>
-
 
300
            </div>
-
 
301
            <?php echo $this->form()->closeTag($form); ?>
-
 
302
        </div>
-
 
303
    </div>
82
<div id="profile">
304
</div>
83
</div>