Línea 8... |
Línea 8... |
8 |
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
|
8 |
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
|
9 |
use Laminas\Mvc\Controller\AbstractActionController;
|
9 |
use Laminas\Mvc\Controller\AbstractActionController;
|
10 |
use Laminas\Log\LoggerInterface;
|
10 |
use Laminas\Log\LoggerInterface;
|
11 |
use Laminas\View\Model\ViewModel;
|
11 |
use Laminas\View\Model\ViewModel;
|
12 |
use Laminas\View\Model\JsonModel;
|
12 |
use Laminas\View\Model\JsonModel;
|
13 |
use LeadersLinked\Form\RecruitmentSelectionVacancyForm;
|
13 |
use LeadersLinked\Form\RecruitmentSelection\RecruitmentSelectionVacancyForm;
|
14 |
use LeadersLinked\Library\Functions;
|
14 |
use LeadersLinked\Library\Functions;
|
15 |
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
|
15 |
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
|
16 |
use LeadersLinked\Model\RecruitmentSelectionVacancy;
|
16 |
use LeadersLinked\Model\RecruitmentSelectionVacancy;
|
17 |
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
|
17 |
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
|
18 |
use LeadersLinked\Model\Location;
|
18 |
use LeadersLinked\Model\Location;
|
19 |
use LeadersLinked\Mapper\LocationMapper;
|
19 |
use LeadersLinked\Mapper\LocationMapper;
|
20 |
use LeadersLinked\Mapper\IndustryMapper;
|
20 |
use LeadersLinked\Mapper\IndustryMapper;
|
21 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
21 |
use LeadersLinked\Mapper\JobDescriptionMapper;
|
22 |
use LeadersLinked\Mapper\BehaviorMapper;
|
- |
|
23 |
use LeadersLinked\Mapper\JobDescriptionBehaviorCompetencyMapper;
|
- |
|
24 |
use LeadersLinked\Mapper\CompanyMapper;
|
- |
|
25 |
use LeadersLinked\Model\Company;
|
- |
|
26 |
use LeadersLinked\Mapper\JobCategoryMapper;
|
22 |
use LeadersLinked\Mapper\JobCategoryMapper;
|
- |
|
23 |
use Laminas\Paginator\Adapter\DbSelect;
|
- |
|
24 |
use Laminas\Paginator\Paginator;
|
- |
|
25 |
use LeadersLinked\Mapper\QueryMapper;
|
- |
|
26 |
use Laminas\Hydrator\ArraySerializableHydrator;
|
- |
|
27 |
use Laminas\Db\ResultSet\HydratingResultSet;
|
Línea 27... |
Línea 28... |
27 |
|
28 |
|
28 |
class RecruitmentSelectionVacancyController extends AbstractActionController
|
29 |
class RecruitmentSelectionVacancyController extends AbstractActionController
|
Línea 29... |
Línea 30... |
29 |
{
|
30 |
{
|
Línea 123... |
Línea 124... |
123 |
$order_direction = 'ASC';
|
124 |
$order_direction = 'ASC';
|
124 |
}
|
125 |
}
|
Línea 125... |
Línea 126... |
125 |
|
126 |
|
126 |
$acl = $this->getEvent()->getViewModel()->getVariable('acl');
|
127 |
$acl = $this->getEvent()->getViewModel()->getVariable('acl');
|
127 |
$allowDelete = $acl->isAllowed($currentUser->usertype_id, 'recruitment-and-selection/vacancies/delete');
|
- |
|
128 |
|
128 |
$allowDelete = $acl->isAllowed($currentUser->usertype_id, 'recruitment-and-selection/vacancies/delete');
|
Línea 129... |
Línea 129... |
129 |
$allowEdit = $acl->isAllowed($currentUser->usertype_id, 'recruitment-and-selection/vacancies/edit');
|
129 |
$allowEdit = $acl->isAllowed($currentUser->usertype_id, 'recruitment-and-selection/vacancies/edit');
|
- |
|
130 |
|
- |
|
131 |
|
- |
|
132 |
$queryMapper = QueryMapper::getInstance($this->adapter);
|
130 |
|
133 |
$select = $queryMapper->getSql()->select();
|
- |
|
134 |
$select->from(['tb1' => RecruitmentSelectionVacancyMapper::_TABLE]);
|
- |
|
135 |
$select->columns(['uuid', 'name', 'last_date', 'status']);
|
131 |
|
136 |
$select->join(['tb2' => JobDescriptionMapper::_TABLE], 'tb1.job_description_id = tb2.id AND tb1.company_id = tb2.company_id', ['job_description' => 'name']);
|
- |
|
137 |
|
- |
|
138 |
$select->where->equalTo('tb1.company_id', $currentCompany->network_id);
|
- |
|
139 |
|
- |
|
140 |
if($search) {
|
- |
|
141 |
$select->where->like('tb1.name', '%' . $search . '%');
|
- |
|
142 |
}
|
- |
|
143 |
$select->order($order_field . ' ' . $order_direction);
|
- |
|
144 |
|
- |
|
145 |
//echo $select->getSqlString($this->adapter->platform); exit;
|
- |
|
146 |
|
132 |
$recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
|
147 |
$hydrator = new ArraySerializableHydrator();
|
133 |
$paginator = $recruitmentSelectionVacancyMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
|
148 |
$resultset = new HydratingResultSet($hydrator);
|
134 |
|
149 |
|
- |
|
150 |
$adapter = new DbSelect($select, $queryMapper->getSql(), $resultset);
|
- |
|
151 |
$paginator = new Paginator($adapter);
|
- |
|
152 |
$paginator->setItemCountPerPage($records_x_page);
|
Línea 135... |
Línea 153... |
135 |
$jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
|
153 |
$paginator->setCurrentPageNumber($page);
|
136 |
$industryMapper = IndustryMapper::getInstance($this->adapter);
|
154 |
|
Línea 137... |
Línea 155... |
137 |
$jobCategoryMapper = JobCategoryMapper::getInstance($this->adapter);
|
155 |
|
138 |
|
156 |
|
- |
|
157 |
$items = [];
|
139 |
$items = [];
|
158 |
$records = $paginator->getCurrentItems();
|
- |
|
159 |
|
- |
|
160 |
foreach ($records as $record) {
|
- |
|
161 |
$dt = \DateTime::createFromFormat('Y-m-d', $record['last_date']);
|
- |
|
162 |
|
140 |
$records = $paginator->getCurrentItems();
|
163 |
switch($record['status'])
|
141 |
|
164 |
{
|
142 |
foreach ($records as $record) {
|
165 |
case RecruitmentSelectionVacancy::STATUS_ACTIVE :
|
143 |
$jobDescription = $jobDescriptionMapper->fetchOne($record->job_description_id);
|
166 |
$status = 'LABEL_ACTIVE';
|
- |
|
167 |
break;
|
144 |
if ($jobDescription) {
|
168 |
|
145 |
|
169 |
case RecruitmentSelectionVacancy::STATUS_INACTIVE :
|
146 |
$item = [
|
170 |
$status = 'LABEL_INACTIVE';
|
- |
|
171 |
break;
|
147 |
'id' => $record->id,
|
172 |
|
148 |
'name' => $record->name,
|
173 |
case RecruitmentSelectionVacancy::STATUS_EXPIRED :
|
149 |
'job_description' => $jobDescription->name,
|
174 |
$status = 'LABEL_EXPIRED';
|
- |
|
175 |
break;
|
- |
|
176 |
|
- |
|
177 |
case RecruitmentSelectionVacancy::STATUS_COMPLETED :
|
150 |
'status' => $record->status,
|
178 |
$status = 'LABEL_COMPLETED';
|
- |
|
179 |
break;
|
151 |
'actions' => [
|
180 |
|
- |
|
181 |
default :
|
- |
|
182 |
$status = 'LABEL_UNKNOWN';
|
- |
|
183 |
break;
|
- |
|
184 |
|
- |
|
185 |
}
|
- |
|
186 |
|
- |
|
187 |
$item = [
|
- |
|
188 |
'name' => $record['name'],
|
- |
|
189 |
'job_description' => $record['job_description'],
|
- |
|
190 |
'last_date' => $dt->format('d/m/Y'),
|
- |
|
191 |
'status' => $record->status,
|
- |
|
192 |
'actions' => [
|
Línea 152... |
Línea 193... |
152 |
'link_edit' => $this->url()->fromRoute('recruitment-and-selection/vacancies/edit', ['id' => $record->uuid]),
|
193 |
'link_edit' => $allowEdit ? $this->url()->fromRoute('recruitment-and-selection/vacancies/edit', ['id' => $record['uuid']]) : '',
|
153 |
'link_delete' => $this->url()->fromRoute('recruitment-and-selection/vacancies/delete', ['id' => $record->uuid])
|
194 |
'link_delete' => $allowDelete ? $this->url()->fromRoute('recruitment-and-selection/vacancies/delete', ['id' => $record['uuid']]) : ''
|
Línea 154... |
Línea 195... |
154 |
]
|
195 |
]
|