Línea 24... |
Línea 24... |
24 |
use LeadersLinked\Mapper\CompetencyMapper;
|
24 |
use LeadersLinked\Mapper\CompetencyMapper;
|
25 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
25 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
26 |
use LeadersLinked\Mapper\JobDescriptionCompetencyMapper;
|
26 |
use LeadersLinked\Mapper\JobDescriptionCompetencyMapper;
|
27 |
use LeadersLinked\Mapper\CompetencyTypeMapper;
|
27 |
use LeadersLinked\Mapper\CompetencyTypeMapper;
|
28 |
use LeadersLinked\Mapper\CompetencyBehaviorMapper;
|
28 |
use LeadersLinked\Mapper\CompetencyBehaviorMapper;
|
29 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationTestMapper;
|
29 |
use LeadersLinked\Mapper\PerformanceEvaluationTestMapper;
|
30 |
use LeadersLinked\Mapper\NotificationMapper;
|
30 |
use LeadersLinked\Mapper\NotificationMapper;
|
31 |
use LeadersLinked\Mapper\QueryMapper;
|
31 |
use LeadersLinked\Mapper\QueryMapper;
|
32 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationFormMapper;
|
32 |
use LeadersLinked\Mapper\PerformanceEvaluationFormMapper;
|
Línea 33... |
Línea 33... |
33 |
|
33 |
|
34 |
use LeadersLinked\Model\Notification;
|
34 |
use LeadersLinked\Model\Notification;
|
35 |
use LeadersLinked\Model\CompanyPerformanceEvaluationTestUser;
|
35 |
use LeadersLinked\Model\PerformanceEvaluationTestUser;
|
36 |
use LeadersLinked\Model\CompanyPerformanceEvaluationForm;
|
36 |
use LeadersLinked\Model\PerformanceEvaluationForm;
|
Línea 37... |
Línea 37... |
37 |
use LeadersLinked\Model\CompanyPerformanceEvaluationTest;
|
37 |
use LeadersLinked\Model\PerformanceEvaluationTest;
|
Línea 38... |
Línea 38... |
38 |
|
38 |
|
Línea 119... |
Línea 119... |
119 |
|
119 |
|
Línea 120... |
Línea 120... |
120 |
$queryMapper = QueryMapper::getInstance($this->adapter);
|
120 |
$queryMapper = QueryMapper::getInstance($this->adapter);
|
121 |
|
121 |
|
122 |
$select = $queryMapper->getSql()->select();
|
122 |
$select = $queryMapper->getSql()->select();
|
123 |
$select->columns(['uuid', 'name', 'description', 'text', 'job_description_id']);
|
123 |
$select->columns(['uuid', 'name', 'description', 'text', 'job_description_id']);
|
124 |
$select->from(['f' => CompanyPerformanceEvaluationFormMapper::_TABLE]);
|
124 |
$select->from(['f' => PerformanceEvaluationFormMapper::_TABLE]);
|
125 |
$select->join(['fu' => CompanyPerformanceEvaluationTestUser::_TABLE], 'f.id = fu.form_id', []);
|
125 |
$select->join(['fu' => PerformanceEvaluationTestUser::_TABLE], 'f.id = fu.form_id', []);
|
126 |
$select->join(['t' => CompanyPerformanceEvaluationTestMapper::_TABLE], 'fu.form_id = t.form_id AND fu.user_id = t.user_id', ['status'], Select::JOIN_LEFT_OUTER);
|
126 |
$select->join(['t' => PerformanceEvaluationTestMapper::_TABLE], 'fu.form_id = t.form_id AND fu.user_id = t.user_id', ['status'], Select::JOIN_LEFT_OUTER);
|
Línea 127... |
Línea 127... |
127 |
$select->where->equalTo('f.status', CompanyPerformanceEvaluationForm::STATUS_ACTIVE);
|
127 |
$select->where->equalTo('f.status', PerformanceEvaluationForm::STATUS_ACTIVE);
|
128 |
$select->where->equalTo('fu.user_id', $currentUser->id);
|
128 |
$select->where->equalTo('fu.user_id', $currentUser->id);
|
Línea 141... |
Línea 141... |
141 |
foreach ($records as $record) {
|
141 |
foreach ($records as $record) {
|
Línea 142... |
Línea 142... |
142 |
|
142 |
|
Línea 143... |
Línea 143... |
143 |
|
143 |
|
144 |
switch ($record['status']) {
|
144 |
switch ($record['status']) {
|
145 |
|
145 |
|
Línea 146... |
Línea 146... |
146 |
case CompanyPerformanceEvaluationTest::STATUS_DRAFT :
|
146 |
case PerformanceEvaluationTest::STATUS_DRAFT :
|
147 |
$status = 'LABEL_DRAFT';
|
147 |
$status = 'LABEL_DRAFT';
|
148 |
break;
|
148 |
break;
|
Línea 149... |
Línea 149... |
149 |
|
149 |
|
150 |
case CompanyPerformanceEvaluationTest::STATUS_COMPLETED :
|
150 |
case PerformanceEvaluationTest::STATUS_COMPLETED :
|
151 |
$status = 'LABEL_COMPLETED';
|
151 |
$status = 'LABEL_COMPLETED';
|
Línea 152... |
Línea 152... |
152 |
break;
|
152 |
break;
|
153 |
|
153 |
|
154 |
case CompanyPerformanceEvaluationTest::STATUS_PENDING :
|
154 |
case PerformanceEvaluationTest::STATUS_PENDING :
|
Línea 155... |
Línea 155... |
155 |
$status = 'LABEL_PENDING';
|
155 |
$status = 'LABEL_PENDING';
|
Línea 171... |
Línea 171... |
171 |
'name' => $record['name'],
|
171 |
'name' => $record['name'],
|
172 |
'description' => $record['description'],
|
172 |
'description' => $record['description'],
|
173 |
'text' => $record['text'],
|
173 |
'text' => $record['text'],
|
174 |
'job_description' => $jobDescription->name,
|
174 |
'job_description' => $jobDescription->name,
|
175 |
'status' => $status,
|
175 |
'status' => $status,
|
176 |
'link_take_a_test' => $allowTakeATest && ( empty($record['status']) || $record['status'] == CompanyPerformanceEvaluationTest::STATUS_DRAFT) ? $this->url()->fromRoute('profile/performance-evaluation/take-a-test', ['id' => $record['uuid']]) : '',
|
176 |
'link_take_a_test' => $allowTakeATest && ( empty($record['status']) || $record['status'] == PerformanceEvaluationTest::STATUS_DRAFT) ? $this->url()->fromRoute('profile/performance-evaluation/take-a-test', ['id' => $record['uuid']]) : '',
|
177 |
'link_report' => $allowReport && $record['status'] == CompanyPerformanceEvaluationTest::STATUS_COMPLETED ? $this->url()->fromRoute('profile/performance-evaluation/report', ['id' => $record['uuid']]) : '',
|
177 |
'link_report' => $allowReport && $record['status'] == PerformanceEvaluationTest::STATUS_COMPLETED ? $this->url()->fromRoute('profile/performance-evaluation/report', ['id' => $record['uuid']]) : '',
|
178 |
];
|
178 |
];
|
Línea 179... |
Línea 179... |
179 |
|
179 |
|
180 |
array_push($items, $item);
|
180 |
array_push($items, $item);
|
181 |
}
|
181 |
}
|
Línea 209... |
Línea 209... |
209 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
209 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
210 |
$currentUser = $currentUserPlugin->getUser();
|
210 |
$currentUser = $currentUserPlugin->getUser();
|
Línea 211... |
Línea 211... |
211 |
|
211 |
|
Línea 212... |
Línea 212... |
212 |
$uuid = $this->params()->fromRoute('id');
|
212 |
$uuid = $this->params()->fromRoute('id');
|
213 |
|
213 |
|
Línea 214... |
Línea 214... |
214 |
$companyPerformanceEvaluationFormMapper = CompanyPerformanceEvaluationFormMapper::getInstance($this->adapter);
|
214 |
$companyPerformanceEvaluationFormMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
215 |
$companyPerformanceEvaluationForm = $companyPerformanceEvaluationFormMapper->fetchOneByUuid($uuid);
|
215 |
$companyPerformanceEvaluationForm = $companyPerformanceEvaluationFormMapper->fetchOneByUuid($uuid);
|
216 |
|
216 |
|
217 |
if (!$companyPerformanceEvaluationForm) {
|
217 |
if (!$companyPerformanceEvaluationForm) {
|
218 |
return new JsonModel([
|
218 |
return new JsonModel([
|
219 |
'success' => false,
|
219 |
'success' => false,
|
Línea 220... |
Línea 220... |
220 |
'data' => 'ERROR_FORM_EVALUATION_NOT_FOUND'
|
220 |
'data' => 'ERROR_FORM_EVALUATION_NOT_FOUND'
|
221 |
]);
|
221 |
]);
|
222 |
}
|
222 |
}
|
223 |
|
223 |
|
224 |
if ($companyPerformanceEvaluationForm->status == CompanyPerformanceEvaluationForm::STATUS_INACTIVE) {
|
224 |
if ($companyPerformanceEvaluationForm->status == PerformanceEvaluationForm::STATUS_INACTIVE) {
|
225 |
return new JsonModel([
|
225 |
return new JsonModel([
|
Línea 237... |
Línea 237... |
237 |
'data' => 'ERROR_FORM_EVALUATION_YOU_CAN_NOT_TAKE'
|
237 |
'data' => 'ERROR_FORM_EVALUATION_YOU_CAN_NOT_TAKE'
|
238 |
]);
|
238 |
]);
|
239 |
}
|
239 |
}
|
Línea 240... |
Línea 240... |
240 |
|
240 |
|
241 |
|
241 |
|
Línea 242... |
Línea 242... |
242 |
$companyPerformanceEvaluationTestMapper = CompanyPerformanceEvaluationTestMapper::getInstance($this->adapter);
|
242 |
$companyPerformanceEvaluationTestMapper = PerformanceEvaluationTestMapper::getInstance($this->adapter);
|
243 |
$companyPerformanceEvaluationTest = $companyPerformanceEvaluationTestMapper->fetchOneBy($companyPerformanceEvaluationForm->id, $currentUser->id);
|
243 |
$companyPerformanceEvaluationTest = $companyPerformanceEvaluationTestMapper->fetchOneBy($companyPerformanceEvaluationForm->id, $currentUser->id);
|
244 |
|
244 |
|
245 |
if ($companyPerformanceEvaluationTest && $companyPerformanceEvaluationTest->status != CompanyPerformanceEvaluationTest::STATUS_DRAFT) {
|
245 |
if ($companyPerformanceEvaluationTest && $companyPerformanceEvaluationTest->status != PerformanceEvaluationTest::STATUS_DRAFT) {
|
246 |
return new JsonModel([
|
246 |
return new JsonModel([
|
247 |
'success' => false,
|
247 |
'success' => false,
|
Línea 254... |
Línea 254... |
254 |
|
254 |
|
Línea 255... |
Línea 255... |
255 |
|
255 |
|
256 |
|
256 |
|
257 |
// set content
|
257 |
// set content
|
Línea 258... |
Línea 258... |
258 |
|
258 |
|
Línea 335... |
Línea 335... |
335 |
if ($form->isValid()) {
|
335 |
if ($form->isValid()) {
|
Línea 336... |
Línea 336... |
336 |
|
336 |
|
Línea 337... |
Línea 337... |
337 |
|
337 |
|
338 |
$dataPost = (array) $form->getData();
|
338 |
$dataPost = (array) $form->getData();
|
339 |
|
339 |
|
340 |
$performanceEvaluationTest = new CompanyPerformanceEvaluationTest();
|
340 |
$performanceEvaluationTest = new PerformanceEvaluationTest();
|
341 |
$performanceEvaluationTest->company_id = $companyPerformanceEvaluationForm->company_id;
|
341 |
$performanceEvaluationTest->company_id = $companyPerformanceEvaluationForm->company_id;
|
342 |
$performanceEvaluationTest->form_id = $companyPerformanceEvaluationForm->id;
|
342 |
$performanceEvaluationTest->form_id = $companyPerformanceEvaluationForm->id;
|