| Línea 23... |
Línea 23... |
| 23 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationFormMapper;
|
23 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationFormMapper;
|
| 24 |
use LeadersLinked\Model\CompanyPerformanceEvaluationTest;
|
24 |
use LeadersLinked\Model\CompanyPerformanceEvaluationTest;
|
| 25 |
use Laminas\Db\Sql\Select;
|
25 |
use Laminas\Db\Sql\Select;
|
| 26 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationFormUserMapper;
|
26 |
use LeadersLinked\Mapper\CompanyPerformanceEvaluationFormUserMapper;
|
| 27 |
use LeadersLinked\Form\PerformanceEvaluation\PerformanceEvaluationTestForm;
|
27 |
use LeadersLinked\Form\PerformanceEvaluation\PerformanceEvaluationTestForm;
|
| - |
|
28 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
| 28 |
use LeadersLinked\Library\Functions;
|
29 |
use LeadersLinked\Library\Functions;
|
| Línea 29... |
Línea 30... |
| 29 |
|
30 |
|
| Línea 30... |
Línea 31... |
| 30 |
class PerformanceEvaluationController extends AbstractActionController {
|
31 |
class PerformanceEvaluationController extends AbstractActionController {
|
| Línea 76... |
Línea 77... |
| 76 |
public function indexAction() {
|
77 |
public function indexAction() {
|
| 77 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
78 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
| 78 |
$currentUser = $currentUserPlugin->getUser();
|
79 |
$currentUser = $currentUserPlugin->getUser();
|
| Línea 79... |
Línea 80... |
| 79 |
|
80 |
|
| 80 |
$request = $this->getRequest();
|
81 |
$request = $this->getRequest();
|
| 81 |
|
82 |
|
| 82 |
if ($request->isGet()) {
|
83 |
if ($request->isGet()) {
|
| 83 |
|
84 |
|
| 84 |
$headers = $request->getHeaders();
|
85 |
$headers = $request->getHeaders();
|
| 85 |
$isJson = false;
|
86 |
$isJson = false;
|
| 86 |
if ($headers->has('Accept')) {
|
87 |
if ($headers->has('Accept')) {
|
| Línea 103... |
Línea 104... |
| 103 |
|
104 |
|
| 104 |
$acl = $this->getEvent()->getViewModel()->getVariable('acl');
|
105 |
$acl = $this->getEvent()->getViewModel()->getVariable('acl');
|
| 105 |
$allowTakeATest = $acl->isAllowed($currentUser->usertype_id, 'profile/performance-evaluation/take-a-test');
|
106 |
$allowTakeATest = $acl->isAllowed($currentUser->usertype_id, 'profile/performance-evaluation/take-a-test');
|
| Línea 106... |
Línea -... |
| 106 |
$allowReport = $acl->isAllowed($currentUser->usertype_id, 'profile/performance-evaluation/report');
|
- |
|
| 107 |
|
- |
|
| 108 |
|
- |
|
| 109 |
|
107 |
$allowReport = $acl->isAllowed($currentUser->usertype_id, 'profile/performance-evaluation/report');
|
| Línea 110... |
Línea 108... |
| 110 |
|
108 |
|
| 111 |
$queryMapper = QueryMapper::getInstance($this->adapter);
|
109 |
$queryMapper = QueryMapper::getInstance($this->adapter);
|
| 112 |
|
110 |
|
| Línea 124... |
Línea 122... |
| 124 |
}
|
122 |
}
|
| 125 |
$select->order('name ASC, job_description_id ASC');
|
123 |
$select->order('name ASC, job_description_id ASC');
|
| Línea 126... |
Línea 124... |
| 126 |
|
124 |
|
| 127 |
$records = $queryMapper->fetchAll($select);
|
125 |
$records = $queryMapper->fetchAll($select);
|
| - |
|
126 |
$items = [];
|
| - |
|
127 |
|
| - |
|
128 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
| 128 |
$items = [];
|
129 |
|
| 129 |
foreach ($records as $record) {
|
130 |
foreach ($records as $record) {
|
| Línea 130... |
Línea 131... |
| 130 |
|
131 |
|
| Línea 131... |
Línea 132... |
| 131 |
|
132 |
|
| 132 |
switch ($record['status']) {
|
133 |
switch ($record['status']) {
|
| Línea 151... |
Línea 152... |
| 151 |
default :
|
152 |
default :
|
| 152 |
$status = 'LABEL_AVAILABLE';
|
153 |
$status = 'LABEL_AVAILABLE';
|
| 153 |
break;
|
154 |
break;
|
| 154 |
}
|
155 |
}
|
| Línea -... |
Línea 156... |
| - |
|
156 |
|
| - |
|
157 |
$jobDescription = $jobDescriptionMapper->fetchOne($record->job_description_id);
|
| - |
|
158 |
if ($jobDescription) {
|
| - |
|
159 |
$item = [
|
| - |
|
160 |
'name' => $record['name'],
|
| - |
|
161 |
'description' => $record['description'],
|
| - |
|
162 |
'text' => $record['text'],
|
| - |
|
163 |
'job_description' => $jobDescription->name,
|
| - |
|
164 |
'status' => $status,
|
| - |
|
165 |
'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']]) : '',
|
| - |
|
166 |
'link_report' => $allowReport && $record['status'] == CompanyPerformanceEvaluationTest::STATUS_COMPLETED ? $this->url()->fromRoute('profile/performance-evaluation/report', ['id' => $record['uuid']]) : '',
|
| Línea 155... |
Línea -... |
| 155 |
|
- |
|
| 156 |
|
- |
|
| 157 |
$item = [
|
- |
|
| 158 |
'name' => $record['name'],
|
- |
|
| 159 |
'description' => $record['description'],
|
- |
|
| 160 |
'text' => $record['text'],
|
- |
|
| 161 |
'language' => 'es',
|
- |
|
| 162 |
'status' => $status,
|
- |
|
| 163 |
'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']]) : '',
|
- |
|
| Línea 164... |
Línea -... |
| 164 |
'link_report' => $allowReport && $record['status'] == CompanyPerformanceEvaluationTest::STATUS_COMPLETED ? $this->url()->fromRoute('profile/performance-evaluation/report', ['id' => $record['uuid']]) : '',
|
- |
|
| 165 |
];
|
167 |
];
|
| - |
|
168 |
|
| 166 |
|
169 |
|
| Línea 206... |
Línea 209... |
| 206 |
$companyPerformanceEvaluationForm = $companyPerformanceEvaluationFormMapper->fetchOneByUuid($uuid);
|
209 |
$companyPerformanceEvaluationForm = $companyPerformanceEvaluationFormMapper->fetchOneByUuid($uuid);
|
| Línea 207... |
Línea 210... |
| 207 |
|
210 |
|
| 208 |
if (!$companyPerformanceEvaluationForm) {
|
211 |
if (!$companyPerformanceEvaluationForm) {
|
| 209 |
return new JsonModel([
|
212 |
return new JsonModel([
|
| 210 |
'success' => false,
|
213 |
'success' => false,
|
| 211 |
'data' => 'ERROR_FORM_SELF_EVALUATION_NOT_FOUND'
|
214 |
'data' => 'ERROR_FORM_EVALUATION_NOT_FOUND'
|
| 212 |
]);
|
215 |
]);
|
| Línea 213... |
Línea 216... |
| 213 |
}
|
216 |
}
|
| 214 |
|
217 |
|
| 215 |
if ($companyPerformanceEvaluationForm->status == CompanyPerformanceEvaluationForm::STATUS_INACTIVE) {
|
218 |
if ($companyPerformanceEvaluationForm->status == CompanyPerformanceEvaluationForm::STATUS_INACTIVE) {
|
| 216 |
return new JsonModel([
|
219 |
return new JsonModel([
|
| 217 |
'success' => false,
|
220 |
'success' => false,
|
| 218 |
'data' => 'ERROR_FORM_SELF_EVALUATION_IS_INACTIVE'
|
221 |
'data' => 'ERROR_FORM_EVALUATION_IS_INACTIVE'
|
| Línea 219... |
Línea 222... |
| 219 |
]);
|
222 |
]);
|
| 220 |
}
|
223 |
}
|
| 221 |
|
224 |
|
| 222 |
|
225 |
|
| 223 |
$companyPerformanceEvaluationFormUserMapper = CompanyPerformanceEvaluationFormUserMapper::getInstance($this->adapter);
|
226 |
$companyPerformanceEvaluationFormUserMapper = CompanyPerformanceEvaluationFormUserMapper::getInstance($this->adapter);
|
| 224 |
$companyPerformanceEvaluationFormUser = $companyPerformanceEvaluationFormUserMapper->fetchOneByFormIdAndUserId($companyPerformanceEvaluationForm->id, $currentUser->id);
|
227 |
$companyPerformanceEvaluationFormUser = $companyPerformanceEvaluationFormUserMapper->fetchOneByFormIdAndUserId($companyPerformanceEvaluationForm->id, $currentUser->id);
|
| 225 |
if (!$companyPerformanceEvaluationFormUser) {
|
228 |
if (!$companyPerformanceEvaluationFormUser) {
|
| 226 |
return new JsonModel([
|
229 |
return new JsonModel([
|
| Línea 227... |
Línea 230... |
| 227 |
'success' => false,
|
230 |
'success' => false,
|
| 228 |
'data' => 'ERROR_FORM_SELF_EVALUATION_YOU_CAN_NOT_TAKE'
|
231 |
'data' => 'ERROR_FORM_EVALUATION_YOU_CAN_NOT_TAKE'
|
| Línea 229... |
Línea 232... |
| 229 |
]);
|
232 |
]);
|
| 230 |
}
|
233 |
}
|
| 231 |
|
234 |
|
| 232 |
|
235 |
|
| 233 |
$companyPerformanceEvaluationTestMapper = CompanyPerformanceEvaluationTestMapper::getInstance($this->adapter);
|
236 |
$companyPerformanceEvaluationTestMapper = CompanyPerformanceEvaluationTestMapper::getInstance($this->adapter);
|
| 234 |
$companyPerformanceEvaluationTest = $companyPerformanceEvaluationTestMapper->fetchOneBy($companyPerformanceEvaluationForm->id, $currentUser->id);
|
237 |
$companyPerformanceEvaluationTest = $companyPerformanceEvaluationTestMapper->fetchOneBy($companyPerformanceEvaluationForm->id, $currentUser->id);
|
| Línea 235... |
Línea 238... |
| 235 |
|
238 |
|