Rev 6750 | AutorÃa | Comparar con el anterior | Ultima modificación | Ver Log |
<?php
declare(strict_types=1);
namespace LeadersLinked\Form\AccountSetting;
use Laminas\Form\Form;
use Laminas\Db\Adapter\AdapterInterface;
use LeadersLinked\Library\Functions;
use LeadersLinked\Mapper\SkillMapper;
use LeadersLinked\Model\User;
class BasicForm extends Form
{
public function __construct()
{
parent::__construct();
$this->setInputFilter(new BasicFilter());
$this->add([
'name' => 'phone',
'type' => \Laminas\Form\Element\Text::class,
'attributes' => [
'maxlength' => 18,
'id' => 'phone',
]
]);
$this->add([
'name' => 'first_name',
'type' => \Laminas\Form\Element\Hidden::class,
'attributes' => [
'id' => 'first_name',
]
]);
$this->add([
'name' => 'last_name',
'type' => \Laminas\Form\Element\Hidden::class,
'attributes' => [
'id' => 'last_name',
]
]);
$this->add([
'name' => 'gender',
'type' => \Laminas\Form\Element\Select::class,
'options' => [
'value_options' => [
User::GENDER_FEMALE => 'LABEL_FEMALE',
User::GENDER_MALE => 'LABEL_MALE'
],
],
'attributes' => [
'id' => 'gender',
]
]);
$this->add([
'name' => 'email',
'type' => \Laminas\Form\Element\Text::class,
'attributes' => [
'maxlength' => 250,
'id' => 'email',
]
]);
$this->add([
'name' => 'timezone',
'type' => \Laminas\Form\Element\Select::class,
'options' => [
'value_options' => $this->getTimeZones(),
],
'attributes' => [
'id' => 'timezone',
]
]);
$this->add([
'name' => 'is_adult',
'type' => \Laminas\Form\Element\Checkbox::class,
'attributes' => [
'id' => 'is_adult',
],
'options' => [
'use_hidden_element' => false,
'unchecked_value' => User::IS_ADULT_NO,
'checked_value' => User::IS_ADULT_YES,
]
]);
}
private function getTimeZones()
{
$options = [];
$records = Functions::getAllTimeZones();
foreach($records as $record)
{
$options[ $record ] = $record;
}
return $options;
}
}