Proyectos de Subversion LeadersLinked - Services

Rev

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

Rev 302 Rev 303
Línea 110... Línea 110...
110
                foreach($records as $record)
110
                foreach($records as $record)
111
                {
111
                {
112
                    $item = [
112
                    $item = [
113
                        'id' => $record->id,
113
                        'id' => $record->id,
114
                        'name' => $record->name,
114
                        'name' => $record->name,
115
 
-
 
-
 
115
                        'description' => $record->description,
116
                        'actions' => [
116
                        'actions' => [
117
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('habits/purposes/edit', ['id' => $record->uuid ], ['force_canonical' => true]) : '',
117
                            'link_edit' => $allowEdit ? $this->url()->fromRoute('habits/purposes/edit', ['id' => $record->uuid ], ['force_canonical' => true]) : '',
118
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('habits/purposes/delete', ['id' =>$record->uuid ],  ['force_canonical' => true]) : '',
118
                            'link_delete' => $allowDelete ? $this->url()->fromRoute('habits/purposes/delete', ['id' =>$record->uuid ],  ['force_canonical' => true]) : '',
119
                        ] 
119
                        ] 
120
                    ];
120
                    ];
Línea 160... Línea 160...
160
                
160
                
Línea 161... Línea 161...
161
                $dataPost = (array) $form->getData();
161
                $dataPost = (array) $form->getData();
162
 
162
 
163
 
163
 
-
 
164
                $habitPurpose = new HabitPurpose();
164
                $habitPurpose = new HabitPurpose();
165
                $habitPurpose->network_id   = $currentUser->network_id;
Línea 165... Línea 166...
165
                $habitPurpose->network_id = $currentUser->network_id;
166
                $habitPurpose->name         = $dataPost['name'];
166
                $habitPurpose->name       = $dataPost['name'];
167
                $habitPurpose->description  = $dataPost['description'];
Línea 167... Línea 168...
167
                $habitPurpose->user_id    = $currentUser->id;
168
                $habitPurpose->user_id      = $currentUser->id;
Línea 252... Línea 253...
252
        if($request->isGet()) {
253
        if($request->isGet()) {
253
            return new JsonModel([
254
            return new JsonModel([
254
                'success'   => true,
255
                'success'   => true,
255
                'data'   => [
256
                'data'   => [
256
                    'name' => $habitPurpose->name,
257
                    'name' => $habitPurpose->name,
-
 
258
                    'description' => $habitPurpose->description,
257
                ]
259
                ]
258
            ]);
260
            ]);
259
        } else if($request->isPost()) {
261
        } else if($request->isPost()) {
260
            $form = new  HabitPurposeForm($this->adapter);
262
            $form = new  HabitPurposeForm($this->adapter);
261
            $dataPost = $request->getPost()->toArray();
263
            $dataPost = $request->getPost()->toArray();
Línea 265... Línea 267...
265
            if($form->isValid()) {
267
            if($form->isValid()) {
Línea 266... Línea 268...
266
                
268
                
Línea 267... Línea 269...
267
                $dataPost = (array) $form->getData();
269
                $dataPost = (array) $form->getData();
-
 
270
                
Línea 268... Línea 271...
268
                
271
                $habitPurpose->name = $dataPost['name'];
Línea 269... Línea 272...
269
                $habitPurpose->name = $dataPost['name'];
272
                $habitPurpose->description  = $dataPost['description'];
270
                
273