Rev 7525 | 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\OrganizationalClimateTestMapper;use LeadersLinked\Mapper\OrganizationalClimateMapper;use LeadersLinked\Model\OrganizationalClimateTest;class OrganizationalClimateTestForm extends Form{/**** @param AdapterInterface $adapter* @param int $company_id*/public function __construct($adapter, $company_id){parent::__construct();$this->setInputFilter(new OrganizationalClimateTestFilter($adapter, $company_id));$this->add(['name' => 'first_name','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 128,'id' => 'first_name',]]);$this->add(['name' => 'last_name','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 128,'id' => 'last_name',]]);$this->add(['name' => 'email','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 128,'id' => 'email',]]);$this->add(['name' => 'organizational_climate_id','type' => \Laminas\Form\Element\Select::class,'attributes' => ['id' => 'organizational_climate_id',],'options' => ['value_options' => $this->getOrganizationalClimateSelectOptions($adapter, $company_id)]]);$this->add(['name' => 'content','type' => \Laminas\Form\Element\Textarea::class,'attributes' => ['id' => 'content',]]);}/**** @param AdapterInterface $adapter*/private function getOrganizationalClimateSelectOptions($adapter, $company_id){$options = [];$mapper = OrganizationalClimateMapper::getInstance($adapter);$records = $mapper->fetchAllByCompanyId($company_id);foreach($records as $record){$options[$record->uuid] = $record->name;}return $options;}}