Rev 17020 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form\Job;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use Laminas\Log\LoggerInterface;use LeadersLinked\Mapper\CompanySizeMapper;use LeadersLinked\Mapper\IndustryMapper;use LeadersLinked\Mapper\JobCategoryMapper;use LeadersLinked\Model\Job;class JobCreateForm extends Form{/**** @param AdapterInterface $adapter*/public function __construct($adapter){parent::__construct();$this->setInputFilter(new JobCreateFilter($adapter));$this->add(['name' => 'title','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 128,'id' => 'title',]]);$this->add(['name' => 'last_date_of_application','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 10,'id' => 'last_date_of_application',]]);$this->add(['name' => 'job_category_id','type' => \Laminas\Form\Element\Select::class,'options' => ['value_options' => $this->optionsJobCategory($adapter),],'attributes' => ['id' => 'job_category_id',]]);$this->add(['name' => 'employment_type','type' => \Laminas\Form\Element\Select::class,'options' => ['value_options' => [Job::EMPLOYMENT_TYPE_FULL_TIME => 'LABEL_EMPLOYMENT_TYPE_FULL_TIME',Job::EMPLOYMENT_TYPE_PART_TIME => 'LABEL_EMPLOYMENT_TYPE_PART_TIME',Job::EMPLOYMENT_TYPE_CONTRACT => 'LABEL_EMPLOYMENT_TYPE_CONTRACT',Job::EMPLOYMENT_TYPE_TEMPORARY => 'LABEL_EMPLOYMENT_TYPE_TEMPORARY',Job::EMPLOYMENT_TYPE_FREELANCE => 'LABEL_EMPLOYMENT_TYPE_FREELANCE',]],'attributes' => ['id' => 'employment_type',]]);$this->add(['name' => 'location_search','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 250,'id' => 'location_search',]]);$this->add(['name' => 'formatted_address','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'formatted_address',]]);$this->add(['name' => 'address1','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'address1',]]);$this->add(['name' => 'address2','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'address2',]]);$this->add(['name' => 'country','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'country',]]);$this->add(['name' => 'state','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'state',]]);$this->add(['name' => 'city1','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'city1',]]);$this->add(['name' => 'city2','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'city2',]]);$this->add(['name' => 'postal_code','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'postal_code',]]);$this->add(['name' => 'latitude','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'latitude',]]);$this->add(['name' => 'longitude','type' => \Laminas\Form\Element\Hidden::class,'attributes' => ['id' => 'longitude',]]);}/**** @param AdapterInterface $adapter* @param LoggerInterface $logger* @return array*/private function optionsJobCategory($adapter){$jobCategoryMapper = JobCategoryMapper::getInstance($adapter);$jobCategories = $jobCategoryMapper->fetchAllActive();$options = [];foreach ($jobCategories as $jobCategory) {$options[$jobCategory->uuid] = $jobCategory->name;}return $options;}}