Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

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

Rev 492 Rev 493
Línea 112... Línea 112...
112
 
112
 
113
                $select = $queryMapper->getSql()->select();
113
                $select = $queryMapper->getSql()->select();
114
                $select->columns(['uuid', 'name', 'description', 'text', 'language']);
114
                $select->columns(['uuid', 'name', 'description', 'text', 'language']);
115
                $select->from(['f' => CompanySelfEvaluationFormMapper::_TABLE]);
115
                $select->from(['f' => CompanySelfEvaluationFormMapper::_TABLE]);
116
                $select->join(['fu' => CompanySelfEvaluationFormUserMapper::_TABLE], 'f.id = fu.form_id', []);
116
                $select->join(['fu' => CompanySelfEvaluationFormUserMapper::_TABLE], 'f.id = fu.form_id', []);
117
                $select->join(['t' => CompanySelfEvaluationTestMapper::_TABLE], 'fu.form_id = t.form_id AND fu.user_id = t.user_id', ['status','uuid'],['t.uuid'=>'test_uuid'],Select::JOIN_LEFT_OUTER);
117
                $select->join(['t' => CompanySelfEvaluationTestMapper::_TABLE], 'fu.form_id = t.form_id AND fu.user_id = t.user_id', ['status'], Select::JOIN_LEFT_OUTER);
118
                $select->where->equalTo('f.status', CompanySelfEvaluationForm::STATUS_ACTIVE);
118
                $select->where->equalTo('f.status', CompanySelfEvaluationForm::STATUS_ACTIVE);
Línea 119... Línea 119...
119
                $select->where->equalTo('fu.user_id', $currentUser->id);
119
                $select->where->equalTo('fu.user_id', $currentUser->id);
Línea 184... Línea 184...
184
 
184
 
185
 
185
 
186
 
186
 
187
                $response = [
187
                $response = [
Línea 188... Línea 188...
188
                    'success' => true,
188
                    'success' => true,
189
                    'data' => $records
189
                    'data' => $items
Línea 334... Línea 334...
334
        $currentUserPlugin = $this->plugin('currentUserPlugin');
334
        $currentUserPlugin = $this->plugin('currentUserPlugin');
335
        $currentUser = $currentUserPlugin->getUser();
335
        $currentUser = $currentUserPlugin->getUser();
Línea 336... Línea 336...
336
 
336
 
Línea -... Línea 337...
-
 
337
        $uuid = $this->params()->fromRoute('id');
-
 
338
 
-
 
339
        $companySelfEvaluationFormMapper = CompanySelfEvaluationFormMapper::getInstance($this->adapter);
-
 
340
        $companySelfEvaluationForm = $companySelfEvaluationFormMapper->fetchOneByUuid($uuid);
-
 
341
 
-
 
342
        if (!$companySelfEvaluationForm) {
-
 
343
            return new JsonModel([
-
 
344
                'success' => false,
-
 
345
                'data' => 'ERROR_FORM_SELF_EVALUATION_NOT_FOUND'
-
 
346
            ]);
-
 
347
        }
-
 
348
 
-
 
349
        if ($companySelfEvaluationForm->status == CompanySelfEvaluationForm::STATUS_INACTIVE) {
-
 
350
            return new JsonModel([
-
 
351
                'success' => false,
-
 
352
                'data' => 'ERROR_FORM_SELF_EVALUATION_IS_INACTIVE'
-
 
353
            ]);
-
 
354
        }
-
 
355
 
-
 
356
 
-
 
357
        $companySelfEvaluationFormUserMapper = CompanySelfEvaluationFormUserMapper::getInstance($this->adapter);
-
 
358
        $companySelfEvaluationFormUser = $companySelfEvaluationFormUserMapper->fetchOneByFormIdAndUserId($companySelfEvaluationForm->id, $currentUser->id);
-
 
359
        if (!$companySelfEvaluationFormUser) {
-
 
360
            return new JsonModel([
-
 
361
                'success' => false,
-
 
362
                'data' => 'ERROR_FORM_SELF_EVALUATION_YOU_CAN_NOT_TAKE'
-
 
363
            ]);
-
 
364
        }
337
        $uuid = $this->params()->fromRoute('id');
365
 
338
 
366
 
Línea 339... Línea 367...
339
        $companySelfEvaluationTestMapper = CompanySelfEvaluationTestMapper::getInstance($this->adapter);
367
        $companySelfEvaluationTestMapper = CompanySelfEvaluationTestMapper::getInstance($this->adapter);
340
        $companySelfEvaluationTest = $companySelfEvaluationTestMapper->fetchOneByUuid($uuid);
368
        $companySelfEvaluationTest = $companySelfEvaluationTestMapper->fetchOneBy($companySelfEvaluationForm->id, $currentUser->id);
341
 
369
 
342
        if (!$companySelfEvaluationTest) {
370
        if (!$companySelfEvaluationTest) {
Línea 352... Línea 380...
352
                'data' => 'ERROR_FORM_SELF_EVALUATION_TEST_IS_INCOPLETE'
380
                'data' => 'ERROR_FORM_SELF_EVALUATION_TEST_IS_INCOPLETE'
353
            ]);
381
            ]);
354
        }
382
        }
Línea 355... Línea -...
355
 
-
 
356
 
-
 
357
        return new JsonModel([
-
 
358
            'success' => true,
-
 
359
            'data' => 'ERROR_FORM_SELF_EVALUATION_ALREADY_YOUR_APPLICATION_IN_THIS_TEST'
-
 
360
        ]);
-
 
361
 
383
 
362
 
384
 
363
        $request = $this->getRequest();
-
 
364
        if ($request->isGet()) {
-
 
365
 
-
 
366
            //get form data           
-
 
367
            $companySelfEvaluationFormMapper = CompanySelfEvaluationFormMapper::getInstance($this->adapter);
-
 
368
            $companySelfEvaluationForm = $companySelfEvaluationFormMapper->fetchOne($companySelfEvaluationTest->form_id);
385
        $request = $this->getRequest();
369
 
-
 
370
            //get user data
-
 
371
            $CompanyUserMapper = UserMapper::getInstance($this->adapter);
-
 
372
            $userMapper = $CompanyUserMapper->fetchOne($companySelfEvaluationTest->user_id);
-
 
373
 
-
 
374
            if ($companySelfEvaluationForm && $userMapper) {
-
 
375
 
386
        if ($request->isGet()) {
376
                $data = [
387
            return new JsonModel([
377
                    'success' => true,
-
 
378
                    'data' => [
388
                'success' => false,
379
                        'id' => $companySelfEvaluationTest->id,
389
                'data' => [
380
                        'name' => $companySelfEvaluationForm->name,
-
 
381
                        'text' => $companySelfEvaluationForm->text,
390
                    'name' => $companySelfEvaluationForm->name,
382
                        'user' => $userMapper->first_name . ' ' . $userMapper->last_name,
391
                    'description' => $companySelfEvaluationForm->description,
383
                        'status' => $companySelfEvaluationTest->status,
-
 
384
                        'content' => json_decode($companySelfEvaluationTest->content),
-
 
385
                    ]
-
 
386
                ];
-
 
387
 
-
 
388
                return new JsonModel($data);
-
 
389
            } else {
-
 
390
 
-
 
391
                $data = [
-
 
392
                    'success' => false,
392
                    'text' => $companySelfEvaluationForm->text,
393
                    'data' => 'ERROR_METHOD_NOT_ALLOWED'
-
 
394
                ];
-
 
395
 
393
                    'content' => json_decode($companySelfEvaluationTest->content)
396
                return new JsonModel($data);
394
                ]
Línea -... Línea 395...
-
 
395
            ]);
397
            }
396
        }
398
        }
397
 
399
 
398
 
400
        return new JsonModel([
399
        return new JsonModel([
401
            'success' => false,
400
            'success' => false,