| 977 |
geraldo |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
declare(strict_types=1);
|
|
|
4 |
|
|
|
5 |
namespace LeadersLinked\Controller;
|
|
|
6 |
|
|
|
7 |
use Laminas\Db\Adapter\AdapterInterface;
|
| 16768 |
efrain |
8 |
|
| 977 |
geraldo |
9 |
use Laminas\Mvc\Controller\AbstractActionController;
|
|
|
10 |
use Laminas\Log\LoggerInterface;
|
|
|
11 |
use Laminas\View\Model\ViewModel;
|
|
|
12 |
use Laminas\View\Model\JsonModel;
|
| 15444 |
efrain |
13 |
use Laminas\Mvc\I18n\Translator;
|
|
|
14 |
|
| 977 |
geraldo |
15 |
use LeadersLinked\Library\Functions;
|
| 15444 |
efrain |
16 |
use LeadersLinked\Mapper\PerformanceEvaluationFormMapper;
|
|
|
17 |
use LeadersLinked\Form\PerformanceEvaluation\PerformanceEvaluationFormForm;
|
|
|
18 |
use LeadersLinked\Model\PerformanceEvaluationForm;
|
| 977 |
geraldo |
19 |
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
|
| 1052 |
geraldo |
20 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
| 1271 |
geraldo |
21 |
use LeadersLinked\Mapper\JobDescriptionCompetencyMapper;
|
| 1272 |
geraldo |
22 |
use LeadersLinked\Mapper\CompetencyMapper;
|
| 1337 |
efrain |
23 |
use LeadersLinked\Library\PerformanceEvaluationPdf;
|
| 1273 |
geraldo |
24 |
use LeadersLinked\Mapper\CompetencyTypeMapper;
|
| 15030 |
efrain |
25 |
use LeadersLinked\Mapper\CompetencyBehaviorMapper;
|
| 1320 |
efrain |
26 |
use LeadersLinked\Mapper\BehaviorMapper;
|
| 1275 |
geraldo |
27 |
use LeadersLinked\Mapper\JobDescriptionBehaviorCompetencyMapper;
|
| 15444 |
efrain |
28 |
use LeadersLinked\Mapper\JobDescriptionCompetencyBehaviorMapper;
|
|
|
29 |
|
| 15253 |
stevensc |
30 |
use LeadersLinked\Mapper\JobDescriptionSubordinateMapper;
|
| 1336 |
efrain |
31 |
use LeadersLinked\Model\Company;
|
| 15444 |
efrain |
32 |
use LeadersLinked\Model\JobDescription;
|
| 977 |
geraldo |
33 |
|
| 15253 |
stevensc |
34 |
class PerformanceEvaluationFormController extends AbstractActionController
|
|
|
35 |
{
|
| 977 |
geraldo |
36 |
|
|
|
37 |
/**
|
|
|
38 |
*
|
|
|
39 |
* @var AdapterInterface
|
|
|
40 |
*/
|
|
|
41 |
private $adapter;
|
|
|
42 |
|
|
|
43 |
|
|
|
44 |
/**
|
|
|
45 |
*
|
|
|
46 |
* @var LoggerInterface
|
|
|
47 |
*/
|
|
|
48 |
private $logger;
|
|
|
49 |
|
|
|
50 |
/**
|
|
|
51 |
*
|
|
|
52 |
* @var array
|
|
|
53 |
*/
|
|
|
54 |
private $config;
|
| 15444 |
efrain |
55 |
|
|
|
56 |
/**
|
|
|
57 |
*
|
|
|
58 |
* @var Translator
|
|
|
59 |
*/
|
|
|
60 |
private $translator;
|
| 977 |
geraldo |
61 |
|
|
|
62 |
/**
|
|
|
63 |
*
|
|
|
64 |
* @param AdapterInterface $adapter
|
|
|
65 |
* @param LoggerInterface $logger
|
|
|
66 |
* @param array $config
|
| 15444 |
efrain |
67 |
* @param Translator $translator
|
| 977 |
geraldo |
68 |
*/
|
| 16768 |
efrain |
69 |
public function __construct($adapter, $logger, $config, $translator)
|
| 15253 |
stevensc |
70 |
{
|
| 977 |
geraldo |
71 |
$this->adapter = $adapter;
|
|
|
72 |
$this->logger = $logger;
|
|
|
73 |
$this->config = $config;
|
| 15444 |
efrain |
74 |
$this->translator = $translator;
|
| 977 |
geraldo |
75 |
}
|
|
|
76 |
|
| 15253 |
stevensc |
77 |
public function indexAction()
|
|
|
78 |
{
|
| 977 |
geraldo |
79 |
$request = $this->getRequest();
|
|
|
80 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
81 |
$currentCompany = $currentUserPlugin->getCompany();
|
|
|
82 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
83 |
|
|
|
84 |
|
|
|
85 |
$request = $this->getRequest();
|
|
|
86 |
if ($request->isGet()) {
|
|
|
87 |
|
|
|
88 |
$headers = $request->getHeaders();
|
|
|
89 |
|
|
|
90 |
$isJson = false;
|
|
|
91 |
if ($headers->has('Accept')) {
|
|
|
92 |
$accept = $headers->get('Accept');
|
|
|
93 |
|
|
|
94 |
$prioritized = $accept->getPrioritized();
|
|
|
95 |
|
|
|
96 |
foreach ($prioritized as $key => $value) {
|
|
|
97 |
$raw = trim($value->getRaw());
|
|
|
98 |
|
|
|
99 |
if (!$isJson) {
|
|
|
100 |
$isJson = strpos($raw, 'json');
|
|
|
101 |
}
|
|
|
102 |
}
|
|
|
103 |
}
|
|
|
104 |
|
| 1336 |
efrain |
105 |
//$isJson = true;
|
| 977 |
geraldo |
106 |
if ($isJson) {
|
| 15253 |
stevensc |
107 |
$search = $this->params()->fromQuery('search');
|
| 16766 |
efrain |
108 |
$search = empty($search) ? '' : Functions::sanitizeFilterString($search);
|
| 977 |
geraldo |
109 |
|
| 15371 |
efrain |
110 |
$start = intval($this->params()->fromQuery('start', 0), 10);
|
| 977 |
geraldo |
111 |
$records_x_page = intval($this->params()->fromQuery('length', 10), 10);
|
| 15371 |
efrain |
112 |
$page = intval($start / $records_x_page);
|
|
|
113 |
$page++;
|
|
|
114 |
|
| 977 |
geraldo |
115 |
$order = $this->params()->fromQuery('order', []);
|
|
|
116 |
$order_field = empty($order[0]['column']) ? 99 : intval($order[0]['column'], 10);
|
| 16766 |
efrain |
117 |
$order_direction = empty($order[0]['dir']) ? 'ASC' : Functions::sanitizeFilterString(filter_var($order[0]['dir']));
|
| 977 |
geraldo |
118 |
|
|
|
119 |
$fields = ['name'];
|
|
|
120 |
$order_field = isset($fields[$order_field]) ? $fields[$order_field] : 'name';
|
|
|
121 |
|
|
|
122 |
if (!in_array($order_direction, ['ASC', 'DESC'])) {
|
|
|
123 |
$order_direction = 'ASC';
|
|
|
124 |
}
|
|
|
125 |
|
| 15444 |
efrain |
126 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
127 |
$paginator = $performanceEvaluationMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
|
| 977 |
geraldo |
128 |
|
| 1078 |
geraldo |
129 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
| 15444 |
efrain |
130 |
$jobsDescription = [];
|
|
|
131 |
|
|
|
132 |
|
| 1078 |
geraldo |
133 |
|
| 977 |
geraldo |
134 |
$items = [];
|
|
|
135 |
$records = $paginator->getCurrentItems();
|
|
|
136 |
foreach ($records as $record) {
|
|
|
137 |
|
| 1078 |
geraldo |
138 |
|
| 15444 |
efrain |
139 |
if(!isset($jobsDescription[$record->job_description_id])) {
|
|
|
140 |
$jobDescription = $jobDescriptionMapper->fetchOne($record->job_description_id);
|
|
|
141 |
|
|
|
142 |
if($jobDescription) {
|
|
|
143 |
$jobsDescription[ $record->job_description_id ] = $jobDescription;
|
|
|
144 |
}
|
|
|
145 |
} else {
|
|
|
146 |
$jobDescription = $jobsDescription[$record->job_description_id];
|
|
|
147 |
}
|
|
|
148 |
|
| 1078 |
geraldo |
149 |
|
| 15444 |
efrain |
150 |
|
| 1098 |
geraldo |
151 |
if ($jobDescription) {
|
| 977 |
geraldo |
152 |
|
| 15444 |
efrain |
153 |
|
|
|
154 |
$dt = \DateTime::createFromFormat('Y-m-d H:i:s', $record->updated_on);
|
|
|
155 |
|
|
|
156 |
if($record->tests) {
|
|
|
157 |
$actions = [
|
|
|
158 |
'link_report' => $this->url()->fromRoute('performance-evaluation/forms/report', ['id' => $record->uuid]),
|
|
|
159 |
'link_active' => $record->status == PerformanceEvaluationForm::STATUS_ACTIVE ? '' : $this->url()->fromRoute('performance-evaluation/forms/active', ['id' => $record->uuid]),
|
|
|
160 |
'link_inactive' => $record->status == PerformanceEvaluationForm::STATUS_INACTIVE ? '' : $this->url()->fromRoute('performance-evaluation/forms/inactive', ['id' => $record->uuid])
|
|
|
161 |
];
|
|
|
162 |
} else {
|
|
|
163 |
|
|
|
164 |
$actions = [
|
|
|
165 |
'link_report' => $this->url()->fromRoute('performance-evaluation/forms/report', ['id' => $record->uuid]),
|
|
|
166 |
'link_edit' => $this->url()->fromRoute('performance-evaluation/forms/edit', ['id' => $record->uuid]),
|
|
|
167 |
'link_delete' => $this->url()->fromRoute('performance-evaluation/forms/delete', ['id' => $record->uuid])
|
|
|
168 |
];
|
|
|
169 |
}
|
|
|
170 |
|
|
|
171 |
|
| 1098 |
geraldo |
172 |
$item = [
|
|
|
173 |
'id' => $record->id,
|
|
|
174 |
'name' => $record->name,
|
|
|
175 |
'job_description' => $jobDescription->name,
|
| 15444 |
efrain |
176 |
'tests' => $record->tests,
|
|
|
177 |
'date' => $dt->format('d/m/Y H:i a'),
|
| 1098 |
geraldo |
178 |
'status' => $record->status,
|
| 15444 |
efrain |
179 |
'actions' => $actions
|
| 1098 |
geraldo |
180 |
];
|
|
|
181 |
}
|
|
|
182 |
|
| 977 |
geraldo |
183 |
array_push($items, $item);
|
|
|
184 |
}
|
|
|
185 |
|
|
|
186 |
return new JsonModel([
|
|
|
187 |
'success' => true,
|
|
|
188 |
'data' => [
|
|
|
189 |
'items' => $items,
|
|
|
190 |
'total' => $paginator->getTotalItemCount(),
|
|
|
191 |
]
|
|
|
192 |
]);
|
|
|
193 |
} else {
|
|
|
194 |
|
| 15444 |
efrain |
195 |
$form = new PerformanceEvaluationFormForm($this->adapter, $currentCompany->id);
|
| 977 |
geraldo |
196 |
|
| 15444 |
efrain |
197 |
$jobsDescription = [];
|
| 1051 |
geraldo |
198 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
| 15444 |
efrain |
199 |
$records = $jobDescriptionMapper->fetchAllByCompanyId($currentCompany->id);
|
|
|
200 |
foreach($records as $record)
|
|
|
201 |
{
|
|
|
202 |
$jobsDescription[ $record->uuid ] = $this->url()->fromRoute('performance-evaluation/forms/job-description', ['id' => $record->uuid]);
|
|
|
203 |
|
|
|
204 |
|
|
|
205 |
}
|
| 1051 |
geraldo |
206 |
|
| 977 |
geraldo |
207 |
$this->layout()->setTemplate('layout/layout-backend');
|
|
|
208 |
$viewModel = new ViewModel();
|
|
|
209 |
$viewModel->setTemplate('leaders-linked/performance-evaluation-forms/index.phtml');
|
| 15444 |
efrain |
210 |
$viewModel->setVariables([
|
|
|
211 |
'jobsDescription' => $jobsDescription,
|
|
|
212 |
'form' => $form,
|
|
|
213 |
]);
|
| 977 |
geraldo |
214 |
return $viewModel;
|
|
|
215 |
}
|
|
|
216 |
} else {
|
|
|
217 |
return new JsonModel([
|
|
|
218 |
'success' => false,
|
|
|
219 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
| 15253 |
stevensc |
220 |
]);;
|
| 977 |
geraldo |
221 |
}
|
|
|
222 |
}
|
|
|
223 |
|
| 15253 |
stevensc |
224 |
public function addAction()
|
|
|
225 |
{
|
| 977 |
geraldo |
226 |
$request = $this->getRequest();
|
|
|
227 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
228 |
$currentCompany = $currentUserPlugin->getCompany();
|
|
|
229 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
230 |
|
|
|
231 |
$request = $this->getRequest();
|
|
|
232 |
|
|
|
233 |
|
|
|
234 |
if ($request->isPost()) {
|
|
|
235 |
$dataPost = $request->getPost()->toArray();
|
| 15444 |
efrain |
236 |
$dataPost['status'] = isset($dataPost['status']) ? $dataPost['status'] : PerformanceEvaluationForm::STATUS_INACTIVE;
|
| 1059 |
geraldo |
237 |
|
| 15444 |
efrain |
238 |
$form = new PerformanceEvaluationFormForm($this->adapter, $currentCompany->id);
|
| 977 |
geraldo |
239 |
$form->setData($dataPost);
|
|
|
240 |
|
|
|
241 |
if ($form->isValid()) {
|
| 1058 |
geraldo |
242 |
|
|
|
243 |
|
| 977 |
geraldo |
244 |
$dataPost = (array) $form->getData();
|
|
|
245 |
|
|
|
246 |
$hydrator = new ObjectPropertyHydrator();
|
| 15444 |
efrain |
247 |
$performanceEvaluation = new PerformanceEvaluationForm();
|
|
|
248 |
$hydrator->hydrate($dataPost, $performanceEvaluation);
|
| 977 |
geraldo |
249 |
|
| 1075 |
geraldo |
250 |
|
| 15444 |
efrain |
251 |
$performanceEvaluation->company_id = $currentCompany->id;
|
|
|
252 |
|
|
|
253 |
|
| 1075 |
geraldo |
254 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
|
|
255 |
$jobDescription = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id']);
|
| 15444 |
efrain |
256 |
$performanceEvaluation->job_description_id = $jobDescription->id;
|
|
|
257 |
$performanceEvaluation->content = $this->serialize($jobDescription);
|
| 1075 |
geraldo |
258 |
|
| 15444 |
efrain |
259 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
260 |
|
|
|
261 |
|
|
|
262 |
$result = $performanceEvaluationMapper->insert($performanceEvaluation);
|
| 1076 |
geraldo |
263 |
|
| 977 |
geraldo |
264 |
|
|
|
265 |
if ($result) {
|
| 15444 |
efrain |
266 |
$this->logger->info('Se agrego el Formulario de Evaluación de Desempeño : ' . $performanceEvaluation->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
| 977 |
geraldo |
267 |
|
|
|
268 |
// Get record by id
|
| 15444 |
efrain |
269 |
$record = $performanceEvaluationMapper->fetchOne($performanceEvaluation->id);
|
| 977 |
geraldo |
270 |
|
|
|
271 |
if ($record) {
|
| 1098 |
geraldo |
272 |
|
| 977 |
geraldo |
273 |
$data = [
|
|
|
274 |
'success' => true,
|
|
|
275 |
'data' => 'LABEL_RECORD_ADDED'
|
|
|
276 |
];
|
|
|
277 |
} else {
|
| 1098 |
geraldo |
278 |
|
| 977 |
geraldo |
279 |
$data = [
|
|
|
280 |
'success' => false,
|
|
|
281 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
282 |
];
|
|
|
283 |
}
|
|
|
284 |
} else {
|
|
|
285 |
$data = [
|
|
|
286 |
'success' => false,
|
| 15444 |
efrain |
287 |
'data' => $performanceEvaluationMapper->getError()
|
| 977 |
geraldo |
288 |
];
|
|
|
289 |
}
|
|
|
290 |
|
|
|
291 |
return new JsonModel($data);
|
|
|
292 |
} else {
|
|
|
293 |
$messages = [];
|
|
|
294 |
$form_messages = (array) $form->getMessages();
|
|
|
295 |
foreach ($form_messages as $fieldname => $field_messages) {
|
|
|
296 |
|
|
|
297 |
$messages[$fieldname] = array_values($field_messages);
|
|
|
298 |
}
|
|
|
299 |
|
|
|
300 |
return new JsonModel([
|
|
|
301 |
'success' => false,
|
|
|
302 |
'data' => $messages
|
|
|
303 |
]);
|
|
|
304 |
}
|
|
|
305 |
} else {
|
|
|
306 |
$data = [
|
|
|
307 |
'success' => false,
|
|
|
308 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
309 |
];
|
|
|
310 |
|
|
|
311 |
return new JsonModel($data);
|
|
|
312 |
}
|
|
|
313 |
|
|
|
314 |
return new JsonModel($data);
|
|
|
315 |
}
|
|
|
316 |
|
| 15253 |
stevensc |
317 |
public function editAction()
|
|
|
318 |
{
|
| 977 |
geraldo |
319 |
$request = $this->getRequest();
|
|
|
320 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
321 |
$currentCompany = $currentUserPlugin->getCompany();
|
|
|
322 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
323 |
|
|
|
324 |
$request = $this->getRequest();
|
|
|
325 |
$uuid = $this->params()->fromRoute('id');
|
|
|
326 |
|
|
|
327 |
|
|
|
328 |
if (!$uuid) {
|
|
|
329 |
$data = [
|
|
|
330 |
'success' => false,
|
|
|
331 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
332 |
];
|
|
|
333 |
|
|
|
334 |
return new JsonModel($data);
|
|
|
335 |
}
|
|
|
336 |
|
| 15444 |
efrain |
337 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
338 |
$performanceEvaluation = $performanceEvaluationMapper->fetchOneByUuid($uuid);
|
|
|
339 |
if (!$performanceEvaluation) {
|
| 977 |
geraldo |
340 |
$data = [
|
|
|
341 |
'success' => false,
|
|
|
342 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
343 |
];
|
|
|
344 |
|
|
|
345 |
return new JsonModel($data);
|
|
|
346 |
}
|
|
|
347 |
|
| 15444 |
efrain |
348 |
if ($performanceEvaluation->company_id != $currentCompany->id) {
|
| 977 |
geraldo |
349 |
return new JsonModel([
|
|
|
350 |
'success' => false,
|
|
|
351 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
352 |
]);
|
|
|
353 |
}
|
|
|
354 |
|
|
|
355 |
|
|
|
356 |
if ($request->isPost()) {
|
|
|
357 |
$dataPost = $request->getPost()->toArray();
|
| 15444 |
efrain |
358 |
$dataPost['status'] = isset($dataPost['status']) ? $dataPost['status'] : PerformanceEvaluationForm::STATUS_INACTIVE;
|
|
|
359 |
|
|
|
360 |
$form = new PerformanceEvaluationFormForm($this->adapter, $currentCompany->id);
|
| 977 |
geraldo |
361 |
$form->setData($dataPost);
|
|
|
362 |
|
|
|
363 |
if ($form->isValid()) {
|
|
|
364 |
$dataPost = (array) $form->getData();
|
|
|
365 |
|
|
|
366 |
$hydrator = new ObjectPropertyHydrator();
|
| 15444 |
efrain |
367 |
$hydrator->hydrate($dataPost, $performanceEvaluation);
|
| 977 |
geraldo |
368 |
|
| 15444 |
efrain |
369 |
if (!$performanceEvaluation->status) {
|
|
|
370 |
$performanceEvaluation->status = PerformanceEvaluationForm::STATUS_INACTIVE;
|
| 977 |
geraldo |
371 |
}
|
|
|
372 |
|
| 1080 |
geraldo |
373 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
|
|
374 |
$jobDescription = $jobDescriptionMapper->fetchOneByUuid($dataPost['job_description_id']);
|
| 15444 |
efrain |
375 |
|
|
|
376 |
$performanceEvaluation->job_description_id = $jobDescription->id;
|
|
|
377 |
$performanceEvaluation->content = $this->serialize($jobDescription);
|
|
|
378 |
|
|
|
379 |
|
|
|
380 |
$result = $performanceEvaluationMapper->update($performanceEvaluation);
|
| 1080 |
geraldo |
381 |
|
| 977 |
geraldo |
382 |
if ($result) {
|
| 15444 |
efrain |
383 |
$this->logger->info('Se actualizo el Formulario de Evaluación de Desempeño : ' . $performanceEvaluation->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
| 977 |
geraldo |
384 |
$data = [
|
|
|
385 |
'success' => true,
|
|
|
386 |
'data' => 'LABEL_RECORD_UPDATED'
|
|
|
387 |
];
|
|
|
388 |
} else {
|
|
|
389 |
$data = [
|
|
|
390 |
'success' => false,
|
| 15444 |
efrain |
391 |
'data' => $performanceEvaluationMapper->getError()
|
| 977 |
geraldo |
392 |
];
|
|
|
393 |
}
|
|
|
394 |
|
|
|
395 |
return new JsonModel($data);
|
|
|
396 |
} else {
|
|
|
397 |
$messages = [];
|
|
|
398 |
$form_messages = (array) $form->getMessages();
|
|
|
399 |
foreach ($form_messages as $fieldname => $field_messages) {
|
|
|
400 |
$messages[$fieldname] = array_values($field_messages);
|
|
|
401 |
}
|
|
|
402 |
|
|
|
403 |
return new JsonModel([
|
|
|
404 |
'success' => false,
|
|
|
405 |
'data' => $messages
|
|
|
406 |
]);
|
|
|
407 |
}
|
|
|
408 |
} else if ($request->isGet()) {
|
|
|
409 |
|
| 1098 |
geraldo |
410 |
|
| 15444 |
efrain |
411 |
$content = json_decode($performanceEvaluation->content);
|
|
|
412 |
|
| 977 |
geraldo |
413 |
$data = [
|
|
|
414 |
'success' => true,
|
|
|
415 |
'data' => [
|
| 15444 |
efrain |
416 |
'name' => $performanceEvaluation->name,
|
|
|
417 |
'description' => $performanceEvaluation->description,
|
|
|
418 |
'job_description_id' => $content->uuid,
|
|
|
419 |
'status' => $performanceEvaluation->status,
|
|
|
420 |
'content' => $content,
|
|
|
421 |
|
| 977 |
geraldo |
422 |
]
|
|
|
423 |
];
|
|
|
424 |
|
|
|
425 |
return new JsonModel($data);
|
|
|
426 |
} else {
|
|
|
427 |
$data = [
|
|
|
428 |
'success' => false,
|
|
|
429 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
430 |
];
|
|
|
431 |
|
|
|
432 |
return new JsonModel($data);
|
|
|
433 |
}
|
|
|
434 |
|
|
|
435 |
return new JsonModel($data);
|
|
|
436 |
}
|
|
|
437 |
|
| 15253 |
stevensc |
438 |
public function deleteAction()
|
|
|
439 |
{
|
| 977 |
geraldo |
440 |
$request = $this->getRequest();
|
|
|
441 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
442 |
$currentCompany = $currentUserPlugin->getCompany();
|
|
|
443 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
444 |
|
|
|
445 |
$request = $this->getRequest();
|
|
|
446 |
$uuid = $this->params()->fromRoute('id');
|
|
|
447 |
|
|
|
448 |
if (!$uuid) {
|
|
|
449 |
$data = [
|
|
|
450 |
'success' => false,
|
|
|
451 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
452 |
];
|
|
|
453 |
|
|
|
454 |
return new JsonModel($data);
|
|
|
455 |
}
|
|
|
456 |
|
| 15444 |
efrain |
457 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
458 |
$performanceEvaluation = $performanceEvaluationMapper->fetchOneByUuid($uuid);
|
|
|
459 |
if (!$performanceEvaluation) {
|
| 977 |
geraldo |
460 |
$data = [
|
|
|
461 |
'success' => false,
|
|
|
462 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
463 |
];
|
|
|
464 |
|
|
|
465 |
return new JsonModel($data);
|
|
|
466 |
}
|
|
|
467 |
|
| 15444 |
efrain |
468 |
if ($performanceEvaluation->company_id != $currentCompany->id) {
|
| 977 |
geraldo |
469 |
return new JsonModel([
|
|
|
470 |
'success' => false,
|
|
|
471 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
472 |
]);
|
|
|
473 |
}
|
|
|
474 |
|
|
|
475 |
if ($request->isPost()) {
|
|
|
476 |
|
|
|
477 |
|
| 15444 |
efrain |
478 |
$result = $performanceEvaluationMapper->delete($performanceEvaluation->id);
|
| 977 |
geraldo |
479 |
if ($result) {
|
| 15444 |
efrain |
480 |
$this->logger->info('Se borro el Formulario de Evaluación de Desempeño : ' . $performanceEvaluation->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
| 977 |
geraldo |
481 |
|
|
|
482 |
$data = [
|
|
|
483 |
'success' => true,
|
|
|
484 |
'data' => 'LABEL_RECORD_DELETED'
|
|
|
485 |
];
|
|
|
486 |
} else {
|
|
|
487 |
|
|
|
488 |
$data = [
|
|
|
489 |
'success' => false,
|
| 15444 |
efrain |
490 |
'data' => $performanceEvaluationMapper->getError()
|
| 977 |
geraldo |
491 |
];
|
|
|
492 |
|
|
|
493 |
return new JsonModel($data);
|
|
|
494 |
}
|
|
|
495 |
} else {
|
|
|
496 |
$data = [
|
|
|
497 |
'success' => false,
|
|
|
498 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
499 |
];
|
|
|
500 |
|
|
|
501 |
return new JsonModel($data);
|
|
|
502 |
}
|
|
|
503 |
|
|
|
504 |
return new JsonModel($data);
|
|
|
505 |
}
|
| 15444 |
efrain |
506 |
|
|
|
507 |
public function activeAction()
|
| 15253 |
stevensc |
508 |
{
|
| 15444 |
efrain |
509 |
$request = $this->getRequest();
|
| 1263 |
geraldo |
510 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
| 15444 |
efrain |
511 |
$currentCompany = $currentUserPlugin->getCompany();
|
| 1263 |
geraldo |
512 |
$currentUser = $currentUserPlugin->getUser();
|
| 15444 |
efrain |
513 |
|
|
|
514 |
$request = $this->getRequest();
|
|
|
515 |
$uuid = $this->params()->fromRoute('id');
|
|
|
516 |
|
|
|
517 |
if (!$uuid) {
|
|
|
518 |
$data = [
|
|
|
519 |
'success' => false,
|
|
|
520 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
521 |
];
|
|
|
522 |
|
|
|
523 |
return new JsonModel($data);
|
|
|
524 |
}
|
|
|
525 |
|
|
|
526 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
527 |
$performanceEvaluation = $performanceEvaluationMapper->fetchOneByUuid($uuid);
|
|
|
528 |
if (!$performanceEvaluation) {
|
|
|
529 |
$data = [
|
|
|
530 |
'success' => false,
|
|
|
531 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
532 |
];
|
|
|
533 |
|
|
|
534 |
return new JsonModel($data);
|
|
|
535 |
}
|
|
|
536 |
|
|
|
537 |
if ($performanceEvaluation->company_id != $currentCompany->id) {
|
|
|
538 |
return new JsonModel([
|
|
|
539 |
'success' => false,
|
|
|
540 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
541 |
]);
|
|
|
542 |
}
|
|
|
543 |
|
|
|
544 |
if($performanceEvaluation->status == PerformanceEvaluationForm::STATUS_ACTIVE) {
|
|
|
545 |
return new JsonModel([
|
|
|
546 |
'success' => false,
|
|
|
547 |
'data' => 'ERROR_RECORD_IS_CURRENTLY_ACTIVE'
|
|
|
548 |
]);
|
|
|
549 |
|
|
|
550 |
}
|
|
|
551 |
|
|
|
552 |
if ($request->isPost()) {
|
|
|
553 |
|
|
|
554 |
|
|
|
555 |
$result = $performanceEvaluationMapper->active($performanceEvaluation);
|
|
|
556 |
if ($result) {
|
|
|
557 |
$this->logger->info('Se activo el Formulario de Evaluación de Desempeño : ' . $performanceEvaluation->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
|
|
558 |
|
|
|
559 |
$data = [
|
|
|
560 |
'success' => true,
|
|
|
561 |
'data' => 'LABEL_RECORD_ACTIVED'
|
|
|
562 |
];
|
|
|
563 |
} else {
|
|
|
564 |
|
|
|
565 |
$data = [
|
|
|
566 |
'success' => false,
|
|
|
567 |
'data' => $performanceEvaluationMapper->getError()
|
|
|
568 |
];
|
|
|
569 |
|
|
|
570 |
return new JsonModel($data);
|
|
|
571 |
}
|
|
|
572 |
} else {
|
|
|
573 |
$data = [
|
|
|
574 |
'success' => false,
|
|
|
575 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
576 |
];
|
|
|
577 |
|
|
|
578 |
return new JsonModel($data);
|
|
|
579 |
}
|
|
|
580 |
|
|
|
581 |
return new JsonModel($data);
|
|
|
582 |
}
|
|
|
583 |
|
|
|
584 |
public function inactiveAction()
|
|
|
585 |
{
|
|
|
586 |
$request = $this->getRequest();
|
|
|
587 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
| 1277 |
geraldo |
588 |
$currentCompany = $currentUserPlugin->getCompany();
|
| 15444 |
efrain |
589 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
590 |
|
|
|
591 |
$request = $this->getRequest();
|
| 1263 |
geraldo |
592 |
$uuid = $this->params()->fromRoute('id');
|
| 15444 |
efrain |
593 |
|
|
|
594 |
if (!$uuid) {
|
|
|
595 |
$data = [
|
|
|
596 |
'success' => false,
|
|
|
597 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
598 |
];
|
|
|
599 |
|
|
|
600 |
return new JsonModel($data);
|
|
|
601 |
}
|
|
|
602 |
|
|
|
603 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
604 |
$performanceEvaluation = $performanceEvaluationMapper->fetchOneByUuid($uuid);
|
|
|
605 |
if (!$performanceEvaluation) {
|
|
|
606 |
$data = [
|
|
|
607 |
'success' => false,
|
|
|
608 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
609 |
];
|
|
|
610 |
|
|
|
611 |
return new JsonModel($data);
|
|
|
612 |
}
|
|
|
613 |
|
|
|
614 |
if ($performanceEvaluation->company_id != $currentCompany->id) {
|
| 1263 |
geraldo |
615 |
return new JsonModel([
|
|
|
616 |
'success' => false,
|
| 15444 |
efrain |
617 |
'data' => 'ERROR_UNAUTHORIZED'
|
| 1263 |
geraldo |
618 |
]);
|
|
|
619 |
}
|
| 15444 |
efrain |
620 |
|
|
|
621 |
if($performanceEvaluation->status == PerformanceEvaluationForm::STATUS_INACTIVE) {
|
| 1263 |
geraldo |
622 |
return new JsonModel([
|
|
|
623 |
'success' => false,
|
| 15444 |
efrain |
624 |
'data' => 'ERROR_RECORD_IS_CURRENTLY_INACTIVE'
|
| 1263 |
geraldo |
625 |
]);
|
| 15444 |
efrain |
626 |
|
| 1263 |
geraldo |
627 |
}
|
| 15444 |
efrain |
628 |
|
|
|
629 |
if ($request->isPost()) {
|
|
|
630 |
|
|
|
631 |
|
|
|
632 |
$result = $performanceEvaluationMapper->inactive($performanceEvaluation);
|
|
|
633 |
if ($result) {
|
|
|
634 |
$this->logger->info('Se inactivo el Formulario de Evaluación de Desempeño : ' . $performanceEvaluation->name, ['user_id' => $currentUser->id, 'ip' => Functions::getUserIP()]);
|
|
|
635 |
|
|
|
636 |
$data = [
|
|
|
637 |
'success' => true,
|
|
|
638 |
'data' => 'LABEL_RECORD_ACTIVED'
|
|
|
639 |
];
|
|
|
640 |
} else {
|
|
|
641 |
|
|
|
642 |
$data = [
|
|
|
643 |
'success' => false,
|
|
|
644 |
'data' => $performanceEvaluationMapper->getError()
|
|
|
645 |
];
|
|
|
646 |
|
|
|
647 |
return new JsonModel($data);
|
|
|
648 |
}
|
|
|
649 |
} else {
|
|
|
650 |
$data = [
|
|
|
651 |
'success' => false,
|
|
|
652 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
653 |
];
|
|
|
654 |
|
|
|
655 |
return new JsonModel($data);
|
|
|
656 |
}
|
|
|
657 |
|
|
|
658 |
return new JsonModel($data);
|
|
|
659 |
}
|
| 1263 |
geraldo |
660 |
|
| 15444 |
efrain |
661 |
public function reportAction()
|
|
|
662 |
{
|
|
|
663 |
$request = $this->getRequest();
|
|
|
664 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
665 |
$currentCompany = $currentUserPlugin->getCompany();
|
|
|
666 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
667 |
|
|
|
668 |
$request = $this->getRequest();
|
|
|
669 |
$uuid = $this->params()->fromRoute('id');
|
|
|
670 |
|
|
|
671 |
if (!$uuid) {
|
|
|
672 |
$data = [
|
|
|
673 |
'success' => false,
|
|
|
674 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
675 |
];
|
|
|
676 |
|
|
|
677 |
return new JsonModel($data);
|
|
|
678 |
}
|
|
|
679 |
|
|
|
680 |
$performanceEvaluationMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
|
|
|
681 |
$performanceEvaluation = $performanceEvaluationMapper->fetchOneByUuid($uuid);
|
|
|
682 |
if (!$performanceEvaluation) {
|
|
|
683 |
$data = [
|
|
|
684 |
'success' => false,
|
|
|
685 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
686 |
];
|
|
|
687 |
|
|
|
688 |
return new JsonModel($data);
|
|
|
689 |
}
|
|
|
690 |
|
|
|
691 |
if ($performanceEvaluation->company_id != $currentCompany->id) {
|
| 1263 |
geraldo |
692 |
return new JsonModel([
|
|
|
693 |
'success' => false,
|
| 15444 |
efrain |
694 |
'data' => 'ERROR_UNAUTHORIZED'
|
| 1263 |
geraldo |
695 |
]);
|
|
|
696 |
}
|
| 15444 |
efrain |
697 |
|
|
|
698 |
if($performanceEvaluation->status == PerformanceEvaluationForm::STATUS_INACTIVE) {
|
| 1263 |
geraldo |
699 |
return new JsonModel([
|
|
|
700 |
'success' => false,
|
| 15444 |
efrain |
701 |
'data' => 'ERROR_RECORD_IS_CURRENTLY_INACTIVE'
|
| 1263 |
geraldo |
702 |
]);
|
| 15444 |
efrain |
703 |
|
| 1263 |
geraldo |
704 |
}
|
|
|
705 |
|
|
|
706 |
$request = $this->getRequest();
|
|
|
707 |
if ($request->isGet()) {
|
| 15444 |
efrain |
708 |
|
|
|
709 |
$filename = Functions::normalizeStringFilename($performanceEvaluation->name . '-' . date('Y-m-d H:i a') . '.pdf');
|
|
|
710 |
|
|
|
711 |
|
|
|
712 |
|
|
|
713 |
|
|
|
714 |
$content = base64_encode($this->renderPDF($performanceEvaluation));
|
|
|
715 |
$data = [
|
|
|
716 |
'success' => true,
|
|
|
717 |
'data' => [
|
|
|
718 |
'basename' => $filename,
|
|
|
719 |
'content' => $content
|
|
|
720 |
]
|
|
|
721 |
];
|
|
|
722 |
|
|
|
723 |
return new JsonModel($data);
|
|
|
724 |
|
|
|
725 |
/*
|
|
|
726 |
|
|
|
727 |
$content = $this->renderPdf($currentCompany, $jobDescription);
|
|
|
728 |
$response = new Response();
|
|
|
729 |
$response->setStatusCode(200);
|
|
|
730 |
$response->setContent($content);
|
|
|
731 |
|
|
|
732 |
|
|
|
733 |
|
|
|
734 |
$headers = $response->getHeaders();
|
|
|
735 |
$headers->clearHeaders();
|
|
|
736 |
|
|
|
737 |
$headers->addHeaderLine('Content-Description: File Transfer');
|
|
|
738 |
$headers->addHeaderLine('Content-Type: application/pdf');
|
|
|
739 |
//$headers->addHeaderLine('Content-Disposition: attachment; filename=' . $filename);
|
|
|
740 |
$headers->addHeaderLine('Content-Transfer-Encoding: binary');
|
|
|
741 |
$headers->addHeaderLine('Expires: 0');
|
|
|
742 |
$headers->addHeaderLine('Cache-Control: must-revalidate');
|
|
|
743 |
$headers->addHeaderLine('Pragma: public');
|
|
|
744 |
return $response;
|
|
|
745 |
*/
|
|
|
746 |
|
| 1263 |
geraldo |
747 |
|
|
|
748 |
|
|
|
749 |
|
| 15444 |
efrain |
750 |
return ;
|
|
|
751 |
} else {
|
| 1263 |
geraldo |
752 |
|
|
|
753 |
|
| 15444 |
efrain |
754 |
return new JsonModel([
|
|
|
755 |
'success' => false,
|
|
|
756 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
757 |
]);
|
| 1263 |
geraldo |
758 |
}
|
|
|
759 |
}
|
| 1292 |
geraldo |
760 |
|
| 1277 |
geraldo |
761 |
/**
|
|
|
762 |
* Render PDF
|
| 15444 |
efrain |
763 |
* @param PerformanceEvaluationForm $performanceEvaluation
|
|
|
764 |
|
| 1336 |
efrain |
765 |
* @return mixed
|
| 1277 |
geraldo |
766 |
*/
|
| 15444 |
efrain |
767 |
private function renderPDF($performanceEvaluation)
|
| 15253 |
stevensc |
768 |
{
|
| 15444 |
efrain |
769 |
$request = $this->getRequest();
|
|
|
770 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
771 |
$currentCompany = $currentUserPlugin->getCompany();
|
|
|
772 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
773 |
|
| 1263 |
geraldo |
774 |
|
| 1277 |
geraldo |
775 |
//Generate New PDF
|
|
|
776 |
$pdf = new PerformanceEvaluationPdf();
|
|
|
777 |
|
| 15444 |
efrain |
778 |
$target_path = $this->config['leaderslinked.fullpath.company'] . DIRECTORY_SEPARATOR . $currentCompany->uuid;
|
|
|
779 |
$header = $currentCompany->header ? $target_path . DIRECTORY_SEPARATOR . $currentCompany->header : '';
|
| 15253 |
stevensc |
780 |
if (empty($header) || !file_exists($header)) {
|
| 15079 |
efrain |
781 |
$header = $this->config['leaderslinked.images_default.company_pdf_header'];
|
| 1277 |
geraldo |
782 |
}
|
| 15253 |
stevensc |
783 |
|
| 15444 |
efrain |
784 |
$footer = $currentCompany->footer ? $target_path . DIRECTORY_SEPARATOR . $currentCompany->footer : '';
|
| 15253 |
stevensc |
785 |
if (empty($footer) || !file_exists($footer)) {
|
| 15079 |
efrain |
786 |
$footer = $this->config['leaderslinked.images_default.company_pdf_footer'];
|
|
|
787 |
}
|
| 15444 |
efrain |
788 |
|
|
|
789 |
$content = json_decode($performanceEvaluation->content);
|
| 15253 |
stevensc |
790 |
|
| 15079 |
efrain |
791 |
$pdf->header = $header;
|
|
|
792 |
$pdf->footer = $footer;
|
| 15444 |
efrain |
793 |
$pdf->translator = $this->translator;
|
| 1277 |
geraldo |
794 |
|
|
|
795 |
$pdf->SetMargins(10, 0, 10);
|
|
|
796 |
|
|
|
797 |
$pdf->AliasNbPages();
|
|
|
798 |
$pdf->AddPage();
|
| 15444 |
efrain |
799 |
|
|
|
800 |
$dt = \DateTime::createFromFormat('Y-m-d H:i:s', $performanceEvaluation->updated_on);
|
| 1277 |
geraldo |
801 |
|
|
|
802 |
|
|
|
803 |
$rows = [
|
| 15444 |
efrain |
804 |
[
|
|
|
805 |
'title' => $this->translator->translate('LABEL_PDF_PERFORMANCE_EVALUATION_POSITION') . ' : ',
|
|
|
806 |
'content' => $content->name,
|
|
|
807 |
],
|
|
|
808 |
[
|
|
|
809 |
'title' => $this->translator->translate('LABEL_PDF_PERFORMANCE_EVALUATION_EVALUATED') . ' : ',
|
| 1277 |
geraldo |
810 |
'content' => ''
|
| 15444 |
efrain |
811 |
],
|
|
|
812 |
|
|
|
813 |
[
|
|
|
814 |
'title' => $this->translator->translate('LABEL_PDF_PERFORMANCE_EVALUATION_EVALUATE_SIGNATURE') . ' : ',
|
| 1277 |
geraldo |
815 |
'content' => ''
|
| 15444 |
efrain |
816 |
],
|
|
|
817 |
[
|
|
|
818 |
'title' => $this->translator->translate('LABEL_PDF_PERFORMANCE_EVALUATION_EVALUATOR') . ' : ',
|
| 1277 |
geraldo |
819 |
'content' => ''
|
| 15444 |
efrain |
820 |
],
|
|
|
821 |
[
|
|
|
822 |
'title' => $this->translator->translate('LABEL_PDF_PERFORMANCE_EVALUATION_EVALUATOR_SIGNATURE') . ' : ',
|
| 1277 |
geraldo |
823 |
'content' => ''
|
| 15444 |
efrain |
824 |
],
|
|
|
825 |
[
|
|
|
826 |
'title' => $this->translator->translate( 'LABEL_PDF_PERFORMANCE_EVALUATION_MANAGER_SIGNATURE') . ' : ',
|
|
|
827 |
'content' => ''
|
|
|
828 |
],
|
|
|
829 |
[
|
|
|
830 |
'title' => $this->translator->translate('LABEL_DATE'),
|
|
|
831 |
'content' => $dt->format('d/m/Y H:i a')
|
|
|
832 |
]
|
| 1277 |
geraldo |
833 |
];
|
| 15444 |
efrain |
834 |
|
| 1277 |
geraldo |
835 |
|
| 1292 |
geraldo |
836 |
|
| 15444 |
efrain |
837 |
$pdf->borderTable($this->translator->translate('LABEL_PDF_PERFORMANCE_EVALUATION_TITLE'), $rows);
|
|
|
838 |
|
|
|
839 |
$pdf->evaluationTable();
|
|
|
840 |
|
|
|
841 |
|
| 1292 |
geraldo |
842 |
//Sections
|
| 15444 |
efrain |
843 |
/*
|
| 1282 |
geraldo |
844 |
$sections = json_decode($performanceEvaluation->content, true);
|
| 1277 |
geraldo |
845 |
|
| 1309 |
geraldo |
846 |
for ($s = 0; $s < count($sections); $s++) {
|
| 1277 |
geraldo |
847 |
|
| 1317 |
geraldo |
848 |
$pdf->singleTable($sections[$s]['title'], [
|
|
|
849 |
array(
|
|
|
850 |
'content' => $sections[$s]['type'] != 'multiple' ? $sections[$s]['text'] : ''
|
| 15253 |
stevensc |
851 |
)
|
|
|
852 |
]);
|
| 1277 |
geraldo |
853 |
|
| 1310 |
geraldo |
854 |
if ($sections[$s]['type'] == 'multiple') {
|
| 15253 |
stevensc |
855 |
|
| 1318 |
geraldo |
856 |
$pdf->titleOptionTable($sections[$s]['text']);
|
| 1288 |
geraldo |
857 |
|
| 1309 |
geraldo |
858 |
for ($o = 0; $o < count($sections[$s]['options']); $o++) {
|
| 1292 |
geraldo |
859 |
|
| 1309 |
geraldo |
860 |
$pdf->optionTable($sections[$s]['options'][$o]['title']);
|
| 1292 |
geraldo |
861 |
}
|
| 1307 |
geraldo |
862 |
$pdf->Ln();
|
| 1292 |
geraldo |
863 |
}
|
| 1312 |
geraldo |
864 |
if ($s % 2 == 0 && $s > 1) {
|
| 1317 |
geraldo |
865 |
$pdf->AddPage();
|
| 1308 |
geraldo |
866 |
}
|
| 15444 |
efrain |
867 |
}*/
|
| 1292 |
geraldo |
868 |
// Competencies
|
| 15444 |
efrain |
869 |
if ($content->competencies_selected) {
|
| 1292 |
geraldo |
870 |
|
|
|
871 |
// add new page
|
|
|
872 |
|
|
|
873 |
$pdf->AddPage();
|
| 15444 |
efrain |
874 |
/*
|
|
|
875 |
$competencies_header[] = [
|
|
|
876 |
'content' => 'Indique el nivel de desempeño del evaluado en relación a sus conductas y actitudes frente a cada valor, según la clasificación siguiente:'
|
|
|
877 |
|
|
|
878 |
];
|
| 1292 |
geraldo |
879 |
|
|
|
880 |
$pdf->singleTable('Anexo de valores:', $competencies_header);
|
|
|
881 |
|
|
|
882 |
|
|
|
883 |
// Add scale section
|
|
|
884 |
$pdf->sectionScale();
|
| 15444 |
efrain |
885 |
*/
|
|
|
886 |
|
| 1292 |
geraldo |
887 |
$i = 0;
|
|
|
888 |
|
| 15444 |
efrain |
889 |
$max = count($content->competencies_selected);
|
|
|
890 |
for($i = 0; $i < $max; $i++)
|
|
|
891 |
{
|
| 1305 |
geraldo |
892 |
|
| 15444 |
efrain |
893 |
$competency_selected = $content->competencies_selected[$i];
|
| 1292 |
geraldo |
894 |
|
| 15444 |
efrain |
895 |
$j = $i + 1;
|
|
|
896 |
$last = $j == $max;
|
|
|
897 |
$pdf->competencyTable($i, $competency_selected, $content->competencies, $content->competency_types, $content->behaviors, $last);
|
| 1317 |
geraldo |
898 |
|
| 15444 |
efrain |
899 |
/*
|
| 1305 |
geraldo |
900 |
$pdf->singleTable('Comentarios Finales :', [array('content' => '')]);
|
| 1292 |
geraldo |
901 |
|
| 15444 |
efrain |
902 |
if ($i % 3 == 0 && $i < $max) {
|
| 1292 |
geraldo |
903 |
$pdf->AddPage();
|
| 15444 |
efrain |
904 |
}*/
|
| 1292 |
geraldo |
905 |
}
|
| 15444 |
efrain |
906 |
|
| 1292 |
geraldo |
907 |
}
|
|
|
908 |
|
| 15444 |
efrain |
909 |
return $pdf->Output('S');
|
| 1277 |
geraldo |
910 |
}
|
| 15253 |
stevensc |
911 |
|
| 15079 |
efrain |
912 |
public function jobDescriptionAction()
|
|
|
913 |
{
|
| 15253 |
stevensc |
914 |
|
|
|
915 |
|
| 15079 |
efrain |
916 |
$request = $this->getRequest();
|
|
|
917 |
if ($request->isGet()) {
|
| 15253 |
stevensc |
918 |
|
| 15079 |
efrain |
919 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
920 |
$currentUser = $currentUserPlugin->getUser();
|
|
|
921 |
$currentCompany = $currentUserPlugin->getCompany();
|
| 15253 |
stevensc |
922 |
|
|
|
923 |
|
| 15444 |
efrain |
924 |
$id = $this->params()->fromRoute('id');
|
|
|
925 |
if (!$id) {
|
| 15079 |
efrain |
926 |
$data = [
|
|
|
927 |
'success' => false,
|
|
|
928 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
929 |
];
|
| 15253 |
stevensc |
930 |
|
| 15079 |
efrain |
931 |
return new JsonModel($data);
|
|
|
932 |
}
|
| 15253 |
stevensc |
933 |
|
| 15079 |
efrain |
934 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
| 15444 |
efrain |
935 |
$jobDescription = $jobDescriptionMapper->fetchOneByUuid($id);
|
| 15079 |
efrain |
936 |
if (!$jobDescription) {
|
|
|
937 |
$data = [
|
|
|
938 |
'success' => false,
|
|
|
939 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
940 |
];
|
| 15253 |
stevensc |
941 |
|
| 15079 |
efrain |
942 |
return new JsonModel($data);
|
|
|
943 |
}
|
| 15253 |
stevensc |
944 |
|
| 15079 |
efrain |
945 |
if ($currentCompany && $jobDescription->company_id != $currentCompany->id) {
|
|
|
946 |
$data = [
|
|
|
947 |
'success' => false,
|
|
|
948 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
949 |
];
|
| 15253 |
stevensc |
950 |
|
| 15079 |
efrain |
951 |
return new JsonModel($data);
|
|
|
952 |
}
|
| 15253 |
stevensc |
953 |
|
| 15444 |
efrain |
954 |
if ($jobDescription->job_description_id_boss) {
|
|
|
955 |
|
|
|
956 |
$jobDescriptionBoss = $jobDescriptionMapper->fetchOne($jobDescription->job_description_id_boss);
|
| 15079 |
efrain |
957 |
if ($jobDescriptionBoss) {
|
| 15444 |
efrain |
958 |
$job_description_uuid_boss = $jobDescriptionBoss->uuid;
|
| 15079 |
efrain |
959 |
} else {
|
| 15444 |
efrain |
960 |
$job_description_uuid_boss = '';
|
| 15079 |
efrain |
961 |
}
|
|
|
962 |
} else {
|
| 15444 |
efrain |
963 |
$job_description_uuid_boss = '';
|
| 15079 |
efrain |
964 |
}
|
| 15444 |
efrain |
965 |
|
|
|
966 |
if($currentCompany) {
|
|
|
967 |
$records = $jobDescriptionMapper->fetchAllActiveByCompanyId($currentCompany->id);
|
|
|
968 |
} else {
|
| 15253 |
stevensc |
969 |
$jobDescriptionMapper->fetchAllActiveByDefault();
|
| 15444 |
efrain |
970 |
}
|
|
|
971 |
|
|
|
972 |
$jobsDescription = [];
|
|
|
973 |
|
|
|
974 |
foreach ($records as $record)
|
|
|
975 |
{
|
|
|
976 |
|
|
|
977 |
if($jobDescription->id != $record->id) {
|
|
|
978 |
|
|
|
979 |
$jobsDescription[ $record->uuid ] = $record->name;
|
|
|
980 |
}
|
|
|
981 |
}
|
|
|
982 |
|
|
|
983 |
$behaviors = [];
|
|
|
984 |
$behaviorMapper = BehaviorMapper::getInstance($this->adapter);
|
|
|
985 |
|
|
|
986 |
|
|
|
987 |
if($currentCompany) {
|
|
|
988 |
$records = $behaviorMapper->fetchAllActiveByCompanyId($currentCompany->id);
|
|
|
989 |
} else {
|
|
|
990 |
$records = $behaviorMapper->fetchAllActiveByDefault();
|
|
|
991 |
}
|
|
|
992 |
|
|
|
993 |
$behaviorIds = [];
|
|
|
994 |
foreach($records as $record)
|
|
|
995 |
{
|
|
|
996 |
|
|
|
997 |
$behaviorIds[ $record->id ] = $record->uuid;
|
|
|
998 |
|
|
|
999 |
array_push($behaviors, [
|
|
|
1000 |
'uuid' => $record->uuid,
|
|
|
1001 |
'description' => $record->description
|
| 15079 |
efrain |
1002 |
]);
|
|
|
1003 |
}
|
| 15444 |
efrain |
1004 |
|
|
|
1005 |
|
|
|
1006 |
$competencyTypes = [];
|
|
|
1007 |
|
|
|
1008 |
|
|
|
1009 |
$competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
|
|
|
1010 |
|
|
|
1011 |
if($currentCompany) {
|
|
|
1012 |
$records = $competencyTypeMapper->fetchAllActiveByCompanyId($currentCompany->id);
|
|
|
1013 |
} else {
|
|
|
1014 |
$records = $competencyTypeMapper->fetchAllActiveByDefault();
|
|
|
1015 |
}
|
|
|
1016 |
|
|
|
1017 |
|
|
|
1018 |
$competencyTypeIds = [];
|
|
|
1019 |
foreach($records as $record)
|
|
|
1020 |
{
|
|
|
1021 |
$competencyTypeIds[ $record->id ] = $record->uuid;
|
|
|
1022 |
|
|
|
1023 |
|
|
|
1024 |
array_push($competencyTypes, [
|
|
|
1025 |
'uuid' => $record->uuid,
|
|
|
1026 |
'name' => $record->name,
|
|
|
1027 |
]);
|
|
|
1028 |
}
|
|
|
1029 |
|
|
|
1030 |
$competencyMapper = CompetencyMapper::getInstance($this->adapter);
|
|
|
1031 |
if($currentCompany) {
|
|
|
1032 |
$records = $competencyMapper->fetchAllActiveByCompanyId($currentCompany->id);
|
|
|
1033 |
} else {
|
|
|
1034 |
$records = $competencyMapper->fetchAllActiveByDefault();
|
|
|
1035 |
}
|
|
|
1036 |
|
| 15079 |
efrain |
1037 |
$competencyBehaviorMapper = CompetencyBehaviorMapper::getInstance($this->adapter);
|
| 15444 |
efrain |
1038 |
|
|
|
1039 |
|
|
|
1040 |
|
|
|
1041 |
$competencies = [];
|
|
|
1042 |
|
|
|
1043 |
foreach($records as $record)
|
|
|
1044 |
{
|
|
|
1045 |
if(!isset($competencyTypeIds[ $record->competency_type_id ])) {
|
|
|
1046 |
continue;
|
|
|
1047 |
}
|
|
|
1048 |
|
|
|
1049 |
$behaviors_by_competency = [];
|
|
|
1050 |
|
|
|
1051 |
$competencyBehaviors = $competencyBehaviorMapper->fetchAllByCompetencyId($record->id);
|
|
|
1052 |
foreach($competencyBehaviors as $competencyBehavior)
|
|
|
1053 |
{
|
|
|
1054 |
if(!isset($behaviorIds[ $competencyBehavior->behavior_id ])) {
|
|
|
1055 |
continue;
|
| 15079 |
efrain |
1056 |
}
|
| 15444 |
efrain |
1057 |
|
|
|
1058 |
array_push($behaviors_by_competency, $behaviorIds[ $competencyBehavior->behavior_id ]);
|
|
|
1059 |
}
|
|
|
1060 |
|
|
|
1061 |
|
|
|
1062 |
if($behaviors_by_competency) {
|
|
|
1063 |
array_push($competencies, [
|
|
|
1064 |
'competency_type_uuid' => $competencyTypeIds[ $record->competency_type_id ],
|
|
|
1065 |
'uuid' => $record->uuid,
|
| 15079 |
efrain |
1066 |
'name' => $record->name,
|
| 15444 |
efrain |
1067 |
'behaviors' => $behaviors_by_competency,
|
| 15079 |
efrain |
1068 |
]);
|
|
|
1069 |
}
|
| 15444 |
efrain |
1070 |
|
|
|
1071 |
|
| 15079 |
efrain |
1072 |
}
|
| 15444 |
efrain |
1073 |
|
|
|
1074 |
|
|
|
1075 |
|
|
|
1076 |
|
|
|
1077 |
|
| 15079 |
efrain |
1078 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
| 15444 |
efrain |
1079 |
if($currentCompany) {
|
|
|
1080 |
$records = $jobDescriptionMapper->fetchAllActiveByCompanyId($currentCompany->id);
|
|
|
1081 |
} else {
|
|
|
1082 |
$jobDescriptionMapper->fetchAllActiveByDefault();
|
|
|
1083 |
}
|
|
|
1084 |
|
|
|
1085 |
$jobsDescription = [];
|
|
|
1086 |
|
|
|
1087 |
foreach ($records as $record)
|
|
|
1088 |
{
|
|
|
1089 |
$jobsDescription[ $record->uuid ] = $record->name;
|
|
|
1090 |
}
|
|
|
1091 |
|
|
|
1092 |
|
|
|
1093 |
$data = [
|
|
|
1094 |
'name' => $jobDescription->name,
|
|
|
1095 |
'functions' => $jobDescription->functions,
|
|
|
1096 |
'objectives' => $jobDescription->objectives,
|
|
|
1097 |
'status' => $jobDescription->status,
|
|
|
1098 |
'job_description_id_boss' => $job_description_uuid_boss,
|
|
|
1099 |
'jobs_description' => $jobsDescription,
|
|
|
1100 |
'subordinates_selected' => [],
|
|
|
1101 |
'competencies_selected' => [],
|
|
|
1102 |
'behaviors' => $behaviors,
|
|
|
1103 |
'competency_types' => $competencyTypes,
|
|
|
1104 |
'competencies' => $competencies,
|
|
|
1105 |
];
|
|
|
1106 |
|
|
|
1107 |
$behaviorMapper = BehaviorMapper::getInstance($this->adapter);
|
|
|
1108 |
$competencyMapper = CompetencyMapper::getInstance($this->adapter);
|
|
|
1109 |
$competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
|
|
|
1110 |
|
|
|
1111 |
$competencyTypes = [];
|
|
|
1112 |
|
|
|
1113 |
$jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
|
|
|
1114 |
$jobDescriptionCompetencyBehaviorMapper = JobDescriptionCompetencyBehaviorMapper::getInstance($this->adapter);
|
|
|
1115 |
|
|
|
1116 |
$jobDescriptionCompetencies = $jobDescriptionCompetencyMapper->fetchAllByJobDescriptionId($jobDescription->id);
|
|
|
1117 |
foreach($jobDescriptionCompetencies as $jobDescriptionCompetency)
|
|
|
1118 |
{
|
|
|
1119 |
|
|
|
1120 |
|
|
|
1121 |
|
|
|
1122 |
$competency = $competencyMapper->fetchOne($jobDescriptionCompetency->competency_id);
|
|
|
1123 |
if(!$competency) {
|
|
|
1124 |
continue;
|
| 15079 |
efrain |
1125 |
}
|
| 15444 |
efrain |
1126 |
|
|
|
1127 |
if(isset($competencyTypes[$competency->competency_type_id])) {
|
|
|
1128 |
$competencyType = $competencyTypes[$competency->competency_type_id];
|
|
|
1129 |
} else {
|
|
|
1130 |
|
|
|
1131 |
$competencyType = $competencyTypeMapper->fetchOne($competency->competency_type_id);
|
|
|
1132 |
if(!$competencyType) {
|
|
|
1133 |
continue;
|
|
|
1134 |
}
|
|
|
1135 |
|
|
|
1136 |
$competencyTypes[$competency->competency_type_id] = $competencyType;
|
|
|
1137 |
}
|
|
|
1138 |
|
|
|
1139 |
$competency_selected = [
|
|
|
1140 |
'uuid' => $competency->uuid,
|
|
|
1141 |
'competency_type_uuid' => $competencyType->uuid,
|
|
|
1142 |
'behaviors' => []
|
|
|
1143 |
];
|
|
|
1144 |
|
|
|
1145 |
|
|
|
1146 |
$jobDescriptionCompetencyBehaviors = $jobDescriptionCompetencyBehaviorMapper->fetchAllByJobDescriptionIdAndCompetencyId($jobDescriptionCompetency->job_description_id, $jobDescriptionCompetency->competency_id);
|
|
|
1147 |
foreach($jobDescriptionCompetencyBehaviors as $jobDescriptionCompetencyBehavior)
|
|
|
1148 |
{
|
|
|
1149 |
$behavior = $behaviorMapper->fetchOne($jobDescriptionCompetencyBehavior->behavior_id);
|
|
|
1150 |
if($behavior) {
|
|
|
1151 |
array_push($competency_selected['behaviors'], ['uuid' => $behavior->uuid, 'level' => $jobDescriptionCompetencyBehavior->level]);
|
|
|
1152 |
|
|
|
1153 |
}
|
|
|
1154 |
|
|
|
1155 |
}
|
|
|
1156 |
|
|
|
1157 |
array_push($data['competencies_selected'], $competency_selected);
|
|
|
1158 |
|
|
|
1159 |
|
|
|
1160 |
|
| 15079 |
efrain |
1161 |
}
|
| 15444 |
efrain |
1162 |
|
| 15079 |
efrain |
1163 |
$jobDescriptionSubordinateMapper = JobDescriptionSubordinateMapper::getInstance($this->adapter);
|
| 15444 |
efrain |
1164 |
$jobDescriptionSubordinates = $jobDescriptionSubordinateMapper->fetchAllByJobDescriptionIdTopLevel($jobDescription->id);
|
|
|
1165 |
|
|
|
1166 |
foreach($jobDescriptionSubordinates as $jobDescriptionSubordinate)
|
|
|
1167 |
{
|
|
|
1168 |
$jobDescriptionForSubordinate = $jobDescriptionMapper->fetchOne($jobDescriptionSubordinate->job_description_id_low_level);
|
|
|
1169 |
if($jobDescriptionForSubordinate) {
|
|
|
1170 |
array_push($data['subordinates_selected'], ['uuid' => $jobDescriptionForSubordinate->uuid ]);
|
| 15079 |
efrain |
1171 |
}
|
|
|
1172 |
}
|
| 15444 |
efrain |
1173 |
|
|
|
1174 |
|
|
|
1175 |
|
| 15079 |
efrain |
1176 |
$response = [
|
|
|
1177 |
'success' => true,
|
|
|
1178 |
'data' => $data
|
|
|
1179 |
];
|
| 15253 |
stevensc |
1180 |
|
| 15079 |
efrain |
1181 |
return new JsonModel($response);
|
|
|
1182 |
} else {
|
|
|
1183 |
$data = [
|
|
|
1184 |
'success' => false,
|
|
|
1185 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
1186 |
];
|
| 15253 |
stevensc |
1187 |
|
| 15079 |
efrain |
1188 |
return new JsonModel($data);
|
|
|
1189 |
}
|
|
|
1190 |
}
|
| 15444 |
efrain |
1191 |
|
|
|
1192 |
/**
|
|
|
1193 |
*
|
|
|
1194 |
* @param JobDescription $jobDescription
|
|
|
1195 |
* @return String
|
|
|
1196 |
*/
|
|
|
1197 |
public function serialize($jobDescription)
|
|
|
1198 |
{
|
|
|
1199 |
|
|
|
1200 |
|
|
|
1201 |
|
|
|
1202 |
|
|
|
1203 |
$behaviorMapper = BehaviorMapper::getInstance($this->adapter);
|
|
|
1204 |
$competencyMapper = CompetencyMapper::getInstance($this->adapter);
|
|
|
1205 |
$competencyTypeMapper = CompetencyTypeMapper::getInstance($this->adapter);
|
|
|
1206 |
|
|
|
1207 |
$competencyTypes = [];
|
|
|
1208 |
$competencies = [];
|
|
|
1209 |
$behaviors = [];
|
|
|
1210 |
$competencies_selected = [];
|
|
|
1211 |
$subordinates_selected = [];
|
|
|
1212 |
|
|
|
1213 |
$jobDescriptionCompetencyMapper = JobDescriptionCompetencyMapper::getInstance($this->adapter);
|
|
|
1214 |
$jobDescriptionCompetencyBehaviorMapper = JobDescriptionCompetencyBehaviorMapper::getInstance($this->adapter);
|
|
|
1215 |
|
|
|
1216 |
$jobDescriptionCompetencies = $jobDescriptionCompetencyMapper->fetchAllByJobDescriptionId($jobDescription->id);
|
|
|
1217 |
foreach($jobDescriptionCompetencies as $jobDescriptionCompetency)
|
|
|
1218 |
{
|
|
|
1219 |
|
|
|
1220 |
if(isset($competencies[$jobDescriptionCompetency->competency_id])) {
|
|
|
1221 |
$competency = $competencies[$jobDescriptionCompetency->competency_id];
|
|
|
1222 |
} else {
|
|
|
1223 |
|
|
|
1224 |
$competency = $competencyMapper->fetchOne($jobDescriptionCompetency->competency_id);
|
|
|
1225 |
if(!$competency) {
|
|
|
1226 |
continue;
|
|
|
1227 |
}
|
|
|
1228 |
|
|
|
1229 |
|
|
|
1230 |
|
|
|
1231 |
$competencies[$jobDescriptionCompetency->competency_id] = new \stdClass();
|
|
|
1232 |
$competencies[$jobDescriptionCompetency->competency_id]->uuid = $competency->uuid;
|
|
|
1233 |
$competencies[$jobDescriptionCompetency->competency_id]->name = $competency->name;
|
|
|
1234 |
$competencies[$jobDescriptionCompetency->competency_id]->description = $competency->description;
|
|
|
1235 |
|
|
|
1236 |
}
|
|
|
1237 |
|
|
|
1238 |
|
|
|
1239 |
if(isset($competencyTypes[$competency->competency_type_id])) {
|
|
|
1240 |
$competencyType = $competencyTypes[$competency->competency_type_id];
|
|
|
1241 |
} else {
|
|
|
1242 |
|
|
|
1243 |
$competencyType = $competencyTypeMapper->fetchOne($competency->competency_type_id);
|
|
|
1244 |
if(!$competencyType) {
|
|
|
1245 |
continue;
|
|
|
1246 |
}
|
|
|
1247 |
|
|
|
1248 |
$competencyTypes[$competency->competency_type_id] = new \stdClass();
|
|
|
1249 |
$competencyTypes[$competency->competency_type_id]->uuid = $competencyType->uuid;
|
|
|
1250 |
$competencyTypes[$competency->competency_type_id]->name = $competencyType->name;
|
|
|
1251 |
$competencyTypes[$competency->competency_type_id]->description = $competencyType->description;
|
|
|
1252 |
|
|
|
1253 |
}
|
|
|
1254 |
|
|
|
1255 |
$competency_selected = [
|
|
|
1256 |
'uuid' => $competency->uuid,
|
|
|
1257 |
'competency_type_uuid' => $competencyType->uuid,
|
|
|
1258 |
'behaviors' => []
|
|
|
1259 |
];
|
|
|
1260 |
|
|
|
1261 |
|
|
|
1262 |
$jobDescriptionCompetencyBehaviors = $jobDescriptionCompetencyBehaviorMapper->fetchAllByJobDescriptionIdAndCompetencyId($jobDescriptionCompetency->job_description_id, $jobDescriptionCompetency->competency_id);
|
|
|
1263 |
foreach($jobDescriptionCompetencyBehaviors as $jobDescriptionCompetencyBehavior)
|
|
|
1264 |
{
|
|
|
1265 |
|
|
|
1266 |
|
|
|
1267 |
if(isset($behaviors[$jobDescriptionCompetencyBehavior->behavior_id])) {
|
|
|
1268 |
$behavior = $behaviors[$jobDescriptionCompetencyBehavior->behavior_id];
|
|
|
1269 |
} else {
|
|
|
1270 |
|
|
|
1271 |
$behavior = $behaviorMapper->fetchOne($jobDescriptionCompetencyBehavior->behavior_id);
|
|
|
1272 |
if(!$behavior) {
|
|
|
1273 |
|
|
|
1274 |
continue;
|
|
|
1275 |
}
|
|
|
1276 |
|
|
|
1277 |
$behaviors[$jobDescriptionCompetencyBehavior->behavior_id] = new \stdClass();
|
|
|
1278 |
$behaviors[$jobDescriptionCompetencyBehavior->behavior_id]->uuid = $behavior->uuid;
|
|
|
1279 |
$behaviors[$jobDescriptionCompetencyBehavior->behavior_id]->description = $behavior->description;
|
|
|
1280 |
|
|
|
1281 |
}
|
|
|
1282 |
|
|
|
1283 |
|
|
|
1284 |
|
|
|
1285 |
|
|
|
1286 |
array_push($competency_selected['behaviors'], ['uuid' => $behavior->uuid, 'level' => $jobDescriptionCompetencyBehavior->level]);
|
|
|
1287 |
|
|
|
1288 |
|
|
|
1289 |
}
|
|
|
1290 |
|
|
|
1291 |
array_push($competencies_selected, $competency_selected);
|
|
|
1292 |
|
|
|
1293 |
|
|
|
1294 |
|
|
|
1295 |
}
|
|
|
1296 |
|
|
|
1297 |
|
|
|
1298 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
|
|
1299 |
|
|
|
1300 |
$jobDescriptionSubordinateMapper = JobDescriptionSubordinateMapper::getInstance($this->adapter);
|
|
|
1301 |
$jobDescriptionSubordinates = $jobDescriptionSubordinateMapper->fetchAllByJobDescriptionIdTopLevel($jobDescription->id);
|
|
|
1302 |
|
|
|
1303 |
foreach($jobDescriptionSubordinates as $jobDescriptionSubordinate)
|
|
|
1304 |
{
|
|
|
1305 |
$jobDescriptionForSubordinate = $jobDescriptionMapper->fetchOne($jobDescriptionSubordinate->job_description_id_low_level);
|
|
|
1306 |
if($jobDescriptionForSubordinate) {
|
|
|
1307 |
array_push($subordinates_selected, ['uuid' => $jobDescriptionForSubordinate->uuid ]);
|
|
|
1308 |
}
|
|
|
1309 |
|
|
|
1310 |
|
|
|
1311 |
|
|
|
1312 |
}
|
|
|
1313 |
|
|
|
1314 |
if($jobDescription->job_description_id_boss) {
|
|
|
1315 |
|
|
|
1316 |
$jobDescriptionBoss = $jobDescriptionMapper->fetchOne($jobDescription->job_description_id_boss);
|
|
|
1317 |
if($jobDescriptionBoss) {
|
|
|
1318 |
$job_description_id_boss = $jobDescriptionBoss->uuid;
|
|
|
1319 |
}
|
|
|
1320 |
} else {
|
|
|
1321 |
$job_description_id_boss = '';
|
|
|
1322 |
}
|
|
|
1323 |
|
|
|
1324 |
$content = [
|
|
|
1325 |
'uuid' => $jobDescription->uuid,
|
|
|
1326 |
'name' => $jobDescription->name,
|
|
|
1327 |
'functions' => $jobDescription->functions,
|
|
|
1328 |
'objectives' => $jobDescription->objectives,
|
|
|
1329 |
'job_description_id_boss' => $job_description_id_boss,
|
|
|
1330 |
'competency_types' => $competencyTypes,
|
|
|
1331 |
'competencies' => $competencies,
|
|
|
1332 |
'behaviors' => $behaviors,
|
|
|
1333 |
'competencies_selected' => $competencies_selected,
|
|
|
1334 |
'subordinates_selected' => $subordinates_selected,
|
|
|
1335 |
|
|
|
1336 |
];
|
|
|
1337 |
|
|
|
1338 |
return json_encode($content);
|
|
|
1339 |
}
|
| 977 |
geraldo |
1340 |
}
|