Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
<?phpdeclare(strict_types=1);namespace LeadersLinked\Form\Habit;use Laminas\Form\Form;use Laminas\Db\Adapter\AdapterInterface;use Laminas\Log\LoggerInterface;use LeadersLinked\Mapper\CompanySizeMapper;use LeadersLinked\Mapper\IndustryMapper;use LeadersLinked\Model\Feed;class HabitSkillRegisterForm extends Form{/**** @param \Laminas\Db\Adapter\AdapterInterface $adapter* @param int $user_id*/public function __construct($adapter, $user_id){parent::__construct();$this->setInputFilter(new HabitSkillRegisterFilter());$this->add(['name' => 'date','type' => \Laminas\Form\Element\Text::class,'attributes' => ['id' => 'date','maxlength' => 10]]);$this->add(['name' => 'skill_id','type' => \Laminas\Form\Element\Select::class,'options' => ['value_options' => $this->getOptionsSkillId($adapter, $user_id),],'attributes' => ['id' => 'intelligence',]]);$this->add(['name' => 'quantitative_value','type' => \Laminas\Form\Element\Text::class,'attributes' => ['id' => 'quantitative_value','maxlength' => 5]]);$this->add(['name' => 'qualitative_description','type' => \Laminas\Form\Element\Text::class,'attributes' => ['id' => 'qualitative_description','maxlength' => 50]]);}/**** @param \Laminas\Db\Adapter\AdapterInterface $ad* @param int $user_id*/private function getOptionsSkillId($adapter, $user_id){$items = [];$mapper = \LeadersLinked\Mapper\HabitSkillMapper::getInstance($adapter);$records = $mapper->fetchAllByUserId($user_id);foreach($records as $record){$items[ $record->uuid] = $record->name;}return $items;}}