Rev 2886 | AutorÃa | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;use LeadersLinked\Mapper\RecruitmentSelectionCandidateMapper;use LeadersLinked\Mapper\RecruitmentSelectionInterviewMapper;use LeadersLinked\Mapper\CompanySizeMapper;use LeadersLinked\Mapper\IndustryMapper;use LeadersLinked\Mapper\JobCategoryMapper;use LeadersLinked\Model\Job;use LeadersLinked\Mapper\JobDescriptionMapper;use LeadersLinked\Model\RecruitmentSelectionInterview;class RecruitmentSelectionInterviewFormForm extends Form{/**** @param AdapterInterface $adapter* @param int $company_id* @param int $vacancy_id*/public function __construct($adapter, $company_id, $vacancy_id = 0){parent::__construct();$this->setInputFilter(new RecruitmentSelectionInterviewFormFilter($adapter));$this->add(['name' => 'vacancy_uuid','type' => \Laminas\Form\Element\Select::class,'attributes' => ['id' => 'vacancy_uuid',],'options' => ['value_options' => $this->getSelectVacancyOptions($adapter, $company_id)]]);$this->add(['name' => 'candidate_uuid','type' => \Laminas\Form\Element\Select::class,'attributes' => ['id' => 'candidate_uuid',],'options' => ['value_options' => $this->getSelectCandidateOptions($adapter, $company_id, $vacancy_id)]]);$this->add(['name' => 'content','type' => \Laminas\Form\Element\Textarea::class,'attributes' => ['id' => 'content',]]);$this->add(['name' => 'comment','type' => \Laminas\Form\Element\Textarea::class,'attributes' => ['id' => 'comment',],]);$this->add(['name' => 'points','type' => \Laminas\Form\Element\Select::class,'options' => ['empty_option' => 'LABEL_EVALUATION','value_options' => [RecruitmentSelectionInterview::POINTS_0 => 'LABEL_ANOTHER',RecruitmentSelectionInterview::POINTS_1 => '25%',RecruitmentSelectionInterview::POINTS_2 => '50%',RecruitmentSelectionInterview::POINTS_3 => '75%',RecruitmentSelectionInterview::POINTS_4 => '100%',],],'attributes' => ['id' => 'points',]]);$this->add(['name' => 'status','type' => \Laminas\Form\Element\Select::class,'options' => ['empty_option' => 'LABEL_STATUS','value_options' => [RecruitmentSelectionInterview::STATUS_ACCEPTED => 'Aceptado',RecruitmentSelectionInterview::STATUS_REJECTED => 'Rechazado',],],'attributes' => ['id' => 'status',]]);$this->add(['name' => 'type','type' => \Laminas\Form\Element\Select::class,'options' => ['empty_option' => 'LABEL_INTERVIEWED_BY','value_options' => [RecruitmentSelectionInterview::STATUS_HUMAN_RESOURCE => 'Recursos Humanos',RecruitmentSelectionInterview::STATUS_BOSS => 'Jefe',],],'attributes' => ['id' => 'type',]]);}/**** @param AdapterInterface $adapter*/private function getSelectVacancyOptions($adapter, $company_id){$options = [];$mapper = RecruitmentSelectionVacancyMapper::getInstance($adapter);$records = $mapper->fetchAllByCompanyId($company_id);foreach($records as $record){$options[$record->uuid] = $record->name;}return $options;}/**** @param AdapterInterface $adapter*/public function getSelectCandidateOptions($adapter, $company_id, $vacancy_id){$options = [];$mapper = RecruitmentSelectionCandidateMapper::getInstance($adapter);$records = $mapper->fetchAllByCompanyIdAndVacancyId($company_id, $vacancy_id);foreach($records as $record){$options[$record->uuid] = $record->first_name;}return $options;}}