AutorÃa | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use Laminas\Log\LoggerInterface;use LeadersLinked\Mapper\CompanySizeMapper;use LeadersLinked\Mapper\IndustryMapper;class NetworkCreateForm extends Form{/**** @param AdapterInterface $adapter*/public function __construct($adapter){parent::__construct();$this->setInputFilter(new NetworkCreateFilter($adapter));$this->add(['name' => 'first_name','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 64,'id' => 'first_name',]]);$this->add(['name' => 'last_name','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 64,'id' => 'last_name',]]);$this->add(['name' => 'email','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 64,'id' => 'email',]]);$this->add(['name' => 'password','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 16,'id' => 'password',]]);$this->add(['name' => 'confirmation','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 16,'id' => 'confirmation',]]);$this->add(['name' => 'company','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 128,'id' => 'company',]]);$this->add(['name' => 'industry_id','type' => \Laminas\Form\Element\Select::class,'options' => ['value_options' => $this->optionsIndustry($adapter),],'attributes' => ['id' => 'industry_id',]]);$this->add(['name' => 'company_size_id','type' => \Laminas\Form\Element\Select::class,'options' => ['value_options' => $this->optionsCompanySize($adapter),],'attributes' => ['id' => 'company_size_id',]]);$this->add(['name' => 'main_hostname','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 250,'id' => 'admin_hostname',]]);$this->add(['name' => 'admin_hostname','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 250,'id' => 'admin_hostname',]]);}/**** @param AdapterInterface $adapter* @param LoggerInterface $logger* @return array*/private function optionsCompanySize($adapter){$companySizeMapper = CompanySizeMapper::getInstance($adapter);$companySizes = $companySizeMapper->fetchAllActive();$options = [];foreach($companySizes as $companySize){$options[$companySize->uuid] = $companySize->name . ' ( ' . $companySize->minimum_no_of_employee . ' - ' . $companySize->maximum_no_of_employee . ' )';}return $options;}/**** @param AdapterInterface $adapter* @return array*/private function optionsIndustry($adapter){$industryMapper = IndustryMapper::getInstance($adapter);$industries = $industryMapper->fetchAllActive();$options = [];foreach($industries as $industry){$options[$industry->uuid] = $industry->name;}return $options;}}