Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 304 Rev 309
Línea 108... Línea 108...
108
                $items = [];
108
                $items = [];
109
                $records = $paginator->getCurrentItems();
109
                $records = $paginator->getCurrentItems();
110
                foreach($records as $record)
110
                foreach($records as $record)
111
                {
111
                {
112
                    $item = [
112
                    $item = [
113
                        'id' => $record->id,
113
                        'id' => $record->uid,
114
                        'name' => $record->name,
114
                        'name' => $record->name,
115
                        'description' => $record->description,
115
                        'description' => $record->description,
Línea 116... Línea 116...
116
            
116
            
117
                        'actions' => [
117
                        'actions' => [
Línea 172... Línea 172...
172
                $result = $habitValueMapper->insert($habitValue );
172
                $result = $habitValueMapper->insert($habitValue );
Línea 173... Línea 173...
173
                
173
                
174
                if($result) {
174
                if($result) {
Línea -... Línea 175...
-
 
175
                    $this->logger->info('Se agrego el valor : ' . $habitValue->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
-
 
176
                    
-
 
177
                    $habitValue = $habitValueMapper->fetchOne($habitValueMapper->id);
-
 
178
                    
-
 
179
                    $acl            = $this->getEvent()->getViewModel()->getVariable('acl');
-
 
180
                    $allowEdit      = $acl->isAllowed($currentUser->usertype_id, 'habits/values/edit');
175
                    $this->logger->info('Se agrego el valor : ' . $habitValue->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
181
                    $allowDelete    = $acl->isAllowed($currentUser->usertype_id, 'habits/values/delete');
176
                    
182
                    
177
                    $data = [
183
                    $data = [
-
 
184
                        'success'   => true,
-
 
185
                        'message'   => 'LABEL_RECORD_ADDED',
-
 
186
                        'data'      => [
-
 
187
                            'id' => $habitValue->uid,
-
 
188
                            'name' => $habitValue->name,
-
 
189
                            'description' => $habitValue->description,
-
 
190
                            
-
 
191
                            'actions' => [
-
 
192
                                'link_edit' => $allowEdit ? $this->url()->fromRoute('habits/values/edit', ['id' => $habitValue->uuid ], ['force_canonical' => true]) : '',
-
 
193
                                'link_delete' => $allowDelete ? $this->url()->fromRoute('habits/values/delete', ['id' => $habitValue->uuid ],  ['force_canonical' => true]) : '',
178
                        'success'   => true,
194
                            ]
179
                        'data'   => 'LABEL_RECORD_ADDED'
195
                        ]
180
                    ];
196
                    ];
181
                } else {
197
                } else {
182
                    $data = [
198
                    $data = [
Línea 275... Línea 291...
275
                $result = $habitValueMapper->update($habitValue);
291
                $result = $habitValueMapper->update($habitValue);
Línea 276... Línea 292...
276
                
292
                
277
                if($result) {
293
                if($result) {
Línea -... Línea 294...
-
 
294
                    $this->logger->info('Se edito el valor : ' . $habitValue->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
-
 
295
                    
-
 
296
      
-
 
297
                    
-
 
298
                    $acl            = $this->getEvent()->getViewModel()->getVariable('acl');
-
 
299
                    $allowEdit      = $acl->isAllowed($currentUser->usertype_id, 'habits/values/edit');
278
                    $this->logger->info('Se edito el valor : ' . $habitValue->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
300
                    $allowDelete    = $acl->isAllowed($currentUser->usertype_id, 'habits/values/delete');
279
                    
301
                    
280
                    $data = [
302
                    $data = [
-
 
303
                        'success'   => true,
-
 
304
                        'message'   => 'LABEL_RECORD_UPDATED',
-
 
305
                        'data'      => [
-
 
306
                            'id' => $habitValue->uid,
-
 
307
                            'name' => $habitValue->name,
-
 
308
                            'description' => $habitValue->description,
-
 
309
                            
-
 
310
                            'actions' => [
-
 
311
                                'link_edit' => $allowEdit ? $this->url()->fromRoute('habits/values/edit', ['id' => $habitValue->uuid ], ['force_canonical' => true]) : '',
-
 
312
                                'link_delete' => $allowDelete ? $this->url()->fromRoute('habits/values/delete', ['id' => $habitValue->uuid ],  ['force_canonical' => true]) : '',
281
                        'success'   => true,
313
                            ]
282
                        'data'   => 'LABEL_RECORD_UPDATED'
314
                        ]
283
                    ];
315
                    ];
284
                } else {
316
                } else {
285
                    $data = [
317
                    $data = [