Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16769 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 16769 Rev 16842
Línea 137... Línea 137...
137
                
137
                
138
                $items = [];
138
                $items = [];
139
                $records = $paginator->getCurrentItems();
139
                $records = $paginator->getCurrentItems();
140
                foreach($records as $record)
140
                foreach($records as $record)
-
 
141
                {
-
 
142
                   
-
 
143
                    $description = trim(strip_tags($record->description));
-
 
144
                    if(strlen($description)) {
-
 
145
                        $description = substr($description, 0, 50) . '...';
-
 
146
                    }
141
                {
147
                    
142
                    $item = [
148
                    $item = [
143
                        'description' => $record->description,
149
                        'description' => $description,
144
                        'status' => $record->status,
150
                        'status' => $record->status,
145
                        'actions' => [
151
                        'actions' => [
146
                            'link_edit' => $allowEdit ?  $this->url()->fromRoute('jobs-description/behaviors/edit', ['id' => $record->uuid ]) : '',
152
                            'link_edit' => $allowEdit ?  $this->url()->fromRoute('jobs-description/behaviors/edit', ['id' => $record->uuid ]) : '',
147
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('jobs-description/behaviors/delete', ['id' => $record->uuid ]) : '',
153
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('jobs-description/behaviors/delete', ['id' => $record->uuid ]) : '',
Línea 185... Línea 191...
185
        $request = $this->getRequest();
191
        $request = $this->getRequest();
Línea 186... Línea 192...
186
 
192
 
Línea 187... Línea -...
187
 
-
 
188
        if ($request->isPost()) {
-
 
Línea 189... Línea 193...
189
            
193
 
190
            $inline = $this->params()->fromRoute('inline');
194
        if ($request->isPost()) {
191
            $inline = $inline == 'yes' ? true : false;
-
 
192
            
-
 
193
            $form = new BehaviorForm();
-
 
194
            $dataPost = $request->getPost()->toArray();
-
 
Línea 195... Línea 195...
195
            
195
            
196
            if($inline) {
196
            
Línea 197... Línea 197...
197
                $dataPost['status'] = Behavior::STATUS_ACTIVE;
197
            $form = new BehaviorForm();
Línea 217... Línea 217...
217
 
217
 
218
                $behaviorMapper = BehaviorMapper::getInstance($this->adapter);
218
                $behaviorMapper = BehaviorMapper::getInstance($this->adapter);
219
                $result = $behaviorMapper->insert($behavior);
219
                $result = $behaviorMapper->insert($behavior);
Línea 220... Línea -...
220
                if ($result) {
-
 
221
                    
-
 
222
                    if($inline) {
-
 
223
                        
-
 
224
                        $behavior = $behaviorMapper->fetchOne($behavior->id);
220
                if ($result) {
225
                        
-
 
226
                        $response = [
-
 
227
                            'success' => true,
-
 
228
                            'data' => [ 
-
 
229
                                'message' => 'LABEL_RECORD_ADDED',
-
 
230
                                'behavior' => [
-
 
231
                                    'uuid' => $behavior->uuid,
-
 
232
                                    'description' => $behavior->description,
-
 
233
                                ]
-
 
234
                            ]
-
 
235
                        ];
-
 
236
                    } else {
-
 
237
                    
221
                    
238
                        $response = [
222
                   $response = [
239
                            'success' => true,
223
                            'success' => true,
240
                            'data' => 'LABEL_RECORD_ADDED',
-
 
-
 
224
                            'data' => 'LABEL_RECORD_ADDED',
Línea 241... Línea 225...
241
                        ];
225
                        ];
Línea 242... Línea 226...
242
                    }
226
                    
243
                        
227
                        
244
                    $this->logger->info('Se agrego la conducta observable ' . $behavior->description, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
228
                    $this->logger->info('Se agrego la conducta observable ' . substr($behavior->description, 0, 50), ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
245
                        
229
                        
Línea 344... Línea 328...
344
                    $behavior->status = Behavior::STATUS_INACTIVE;
328
                    $behavior->status = Behavior::STATUS_INACTIVE;
345
                }
329
                }
Línea 346... Línea 330...
346
 
330
 
347
                $result = $behaviorMapper->update($behavior);
331
                $result = $behaviorMapper->update($behavior);
348
                if ($result) {
332
                if ($result) {
Línea 349... Línea 333...
349
                    $this->logger->info('Se actualizo la conducta observable ' . $behavior->description, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
333
                    $this->logger->info('Se actualizo la conducta observable ' .  substr($behavior->description, 0, 50), ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
350
 
334
 
351
                    $data = [
335
                    $data = [
352
                        'success' => true,
336
                        'success' => true,