Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 485 Rev 487
Línea 310... Línea 310...
310
 
310
 
311
        return new JsonModel($data);
311
        return new JsonModel($data);
Línea -... Línea 312...
-
 
312
    }
-
 
313
 
-
 
314
 
-
 
315
    public function reportAction() {
-
 
316
        $request = $this->getRequest();
-
 
317
        $currentUserPlugin = $this->plugin('currentUserPlugin');
-
 
318
        $currentCompany = $currentUserPlugin->getCompany();
-
 
319
        $currentUser = $currentUserPlugin->getUser();
-
 
320
 
-
 
321
        $request = $this->getRequest();
-
 
322
        $uuid = $this->params()->fromRoute('id');
-
 
323
 
-
 
324
 
-
 
325
        if (!$uuid) {
-
 
326
            $data = [
-
 
327
                'success' => false,
-
 
328
                'data' => 'ERROR_INVALID_PARAMETER'
-
 
329
            ];
-
 
330
 
-
 
331
            return new JsonModel($data);
-
 
332
        }
-
 
333
 
-
 
334
        $companySelfEvaluationTestMapper = CompanySelfEvaluationTestMapper::getInstance($this->adapter);
-
 
335
        $companySelfEvaluationTest = $companySelfEvaluationTestMapper->fetchOneByUuid($uuid);
-
 
336
        if (!$companySelfEvaluationTest) {
-
 
337
            $data = [
-
 
338
                'success' => false,
-
 
339
                'data' => 'ERROR_RECORD_NOT_FOUND'
-
 
340
            ];
-
 
341
 
-
 
342
            return new JsonModel($data);
-
 
343
        }
-
 
344
 
-
 
345
        if ($request->isGet()) {
-
 
346
            $hydrator = new ObjectPropertyHydrator();
-
 
347
 
-
 
348
            //get form data           
-
 
349
            $companySelfEvaluationFormMapper = CompanySelfEvaluationFormMapper::getInstance($this->adapter);
-
 
350
            $companySelfEvaluationForm = $companySelfEvaluationFormMapper->fetchOne($companySelfEvaluationTest->form_id);
-
 
351
 
-
 
352
            //get user data
-
 
353
            $CompanyUserMapper = UserMapper::getInstance($this->adapter);
-
 
354
            $userMapper = $CompanyUserMapper->fetchOne($companySelfEvaluationTest->user_id);
-
 
355
 
-
 
356
            if ($companySelfEvaluationForm && $userMapper) {
-
 
357
 
-
 
358
                $data = [
-
 
359
                    'success' => true,
-
 
360
                    'data' => [
-
 
361
                        'id' => $companySelfEvaluationTest->id,
-
 
362
                        'name' => $companySelfEvaluationForm->name,
-
 
363
                        'text' => $companySelfEvaluationForm->text,
-
 
364
                        'user' => $userMapper->first_name . ' ' . $userMapper->last_name,
-
 
365
                        'status' => $companySelfEvaluationTest->status,
-
 
366
                        'content' => json_decode($companySelfEvaluationTest->content),
-
 
367
                    ]
-
 
368
                ];
-
 
369
 
-
 
370
                return new JsonModel($data);
-
 
371
            } else {
-
 
372
 
-
 
373
                $data = [
-
 
374
                    'success' => false,
-
 
375
                    'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
376
                ];
-
 
377
 
-
 
378
                return new JsonModel($data);
-
 
379
            }
-
 
380
        } else {
-
 
381
            $data = [
-
 
382
                'success' => false,
-
 
383
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
384
            ];
312
    }
385
 
-
 
386
            return new JsonModel($data);
-
 
387
        }
Línea 313... Línea 388...
313
 
388