Rev 17108 | Rev 17112 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form\Microlearning;use Laminas\Form\Form;use Laminas\Form\Element\Select;use LeadersLinked\Mapper\MicrolearningCapsuleMapper;class TopicForm extends Form{public function __construct($adapter){parent::__construct();$this->setInputFilter(new TopicFilter($adapter));$this->add(['name' => 'title','type' => \Laminas\Form\Element\Text::class,'attributes' => ['maxlength' => 128,'id' => 'title',]]);$this->add(['name' => 'description','type' => \Laminas\Form\Element\Textarea::class,'attributes' => ['id' => 'description',]]);$this->add(['name' => 'status','type' => \Laminas\Form\Element\Checkbox::class,'attributes' => ['id' => 'status',],'options' => ['use_hidden_element' => false,'unchecked_value' => \LeadersLinked\Model\Topic::STATUS_INACTIVE,'checked_value'=> \LeadersLinked\Model\Topic::STATUS_ACTIVE,]]);}private function getSelectOptions($adapter, $company_id){$options = [];$mapper = MicrolearningCapsuleMapper::getInstance($adapter);$records = $mapper->fetchAllActiveByCompanyId($company_id);foreach($records as $record){$options[$record->uuid] = $record->name;}return $options;}}