/** * @param null|string $name */ public function __construct($serviceLocator, $options = null) { parent::__construct('signin'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $this->setOptions(['layout' => 'fluid']); $filter = $this->getInputFilter(); //$groupBasic = new DisplayGroup('groupBasic'); //$this->add($groupBasic); $fullName = new Text('fullName'); $fullName->setLabel('Tên đầy đủ:'); $this->add($fullName); //$groupBasic->addElement($username); $filter->add(array('name' => 'fullName', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên')))))); $cityId = new Select('cityId'); $this->loadCities($cityId); $filter->add(array('name' => 'cityId', 'required' => false, 'filters' => array())); $this->add($cityId); $districtId = new Select('districtId'); $this->loadDistricts($districtId, $cityId, $options); $this->add($districtId); $filter->add(array('name' => 'districtId', 'required' => false, 'filters' => array())); $address = new Text('address'); $address->setLabel('Địa chỉ: '); $filter->add(array('name' => 'address', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); $this->add($address); // code $description = new Textarea('description'); $description->setLabel('Mô tả bản thân:'); $description->setAttributes(['class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả')))))); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSignin', 'class' => 'btn btn btn-primary'))); //$groupBasic->addElement($this->get('submit')); }
public function __construct(EntityManager $entityManager) { parent::__construct(); $this->entityManager = $entityManager; $this->setAttributes(array("method" => "post", "enctype" => "multipart/form-data", "class" => "form")); $this->setInputFilter(new FaqPerguntasFilters()); // Campo de titulo $titulo = new Text('titulo'); $titulo->setLabel("* Título")->setAttributes(array("maxLength" => "200", "class" => "form-control", "required" => "required")); // Campo de resposta $resposta = new Textarea('resposta'); $resposta->setLabel('* Resposta'); $resposta->setAttributes(array('class' => 'file form-control editor', 'cols' => '30', 'rows' => '10')); // Campo de titulo $tags = new Text('tags'); $tags->setLabel("* Tags")->setAttributes(array("maxLength" => "1000", "class" => "form-control count-character", "required" => "required")); // Campo categoria $categorias = new Select('id_categoria'); $categorias->setLabel("* Categoria")->setAttribute("class", "select")->setValueOptions($this->getCategorias()); // Botão de Submit $botao = new Submit("submit"); $botao->setAttributes(array("value" => "Salvar")); // Adiciona campos $this->add($titulo)->add($resposta)->add($tags)->add($categorias)->add($botao); }
/** * @SuppressWarnings(PHPMD.ExcessiveMethodLength) */ public function __construct($entityManager) { parent::__construct('contatoForm'); $this->setAttribute('method', 'post'); $this->setAttribute('id', 'fileupload'); $this->setEntityManager($entityManager); $idContato = new Element('idContato'); $idContato->setLabel('Contato'); $idContato->setAttributes(array('name' => 'idContato', 'id' => 'idContato', 'type' => 'hidden')); $this->add($idContato); $email = new Element('email'); $email->setLabel('Email'); $email->setAttributes(array('name' => 'email', 'id' => 'email', 'type' => 'text', 'class' => 'form-control')); $this->add($email); $assunto = new Element('assunto'); $assunto->setLabel('Assunto'); $assunto->setAttributes(array('name' => 'assunto', 'id' => 'assunto', 'type' => 'text', 'class' => 'form-control')); $this->add($assunto); $mensagem = new Element\Textarea('mensagem'); $mensagem->setLabel('Mensagem'); $mensagem->setAttributes(array('name' => 'mensagem', 'id' => 'mensagem', 'type' => 'textarea', 'class' => 'form-control')); $this->add($mensagem); $submit = new Element('submit'); $submit->setValue('Salvar'); $submit->setAttributes(array('type' => 'submit')); $this->add($submit); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm danh mục môn học'); $this->add($group); // name $name = new Text('name'); $name->setLabel('Tên danh mục:'); $name->setAttributes(['maxlength' => 255]); $this->add($name); $group->addElement($name); $filter->add(array('name' => 'name', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên danh mục')))))); // code $description = new Textarea('description'); $description->setLabel('Mô tả danh mục:'); $description->setAttributes(['maxlength' => 255, 'class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả danh mục')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/subject/addcategory'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/subject/addcategory' => 'Tiếp tục nhập', '/admin/subject/category' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * Get the HTML editor textarea markup. * * @param PhpRenderer $view * @param string $id HTML ID for the textarea * @param string $value Value to pre-fill * * @return string */ protected function getForm(PhpRenderer $view, $id, $value = '') { $view->ckEditor(); $textarea = new Textarea('o:media[__index__][html]'); $textarea->setOptions(['label' => $view->translate('HTML'), 'info' => $view->translate('HTML or plain text.')]); $textarea->setAttributes(['rows' => 15, 'id' => $id, 'required' => true, 'class' => 'media-html', 'value' => $value]); $field = $view->formRow($textarea); $field .= "\n <script type='text/javascript'>\n \$('#{$id}').ckeditor();\n </script>\n "; return $field; }
public function __construct($name = null) { parent::__construct('page'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $title_text = new Element\Text('title'); $title_text->setLabel('Title'); $title_text->setLabelAttributes(array('class' => 'type_text type_text_short')); $title_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require')); $url_text = new Element\Text('url'); $url_text->setLabel('Url'); $url_text->setLabelAttributes(array('class' => 'type_text type_text_short')); $url_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require')); $text_textarea = new Element\Textarea('text'); $text_textarea->setLabel('Text'); $text_textarea->setLabelAttributes(array('class' => 'type_text')); $text_textarea->setAttributes(array('placeholder' => 'Type something...')); $auto_check = new Element\Checkbox('auto'); $auto_check->setLabel('Automatically'); $auto_check->setLabelAttributes(array('class' => 'type_text type_check')); $auto_check->setUseHiddenElement(true); $auto_check->setCheckedValue("1"); $auto_check->setUncheckedValue("0"); $auto_check->setValue('1'); $meta_text = new Element\Text('meta'); $meta_text->setLabel('Meta'); $meta_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker')); $meta_text->setAttributes(array('class' => 'type_text_input')); $keywords_text = new Element\Text('keywords'); $keywords_text->setLabel('Keywords'); $keywords_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker')); $keywords_text->setAttributes(array('class' => 'type_text_input')); $desc_text = new Element\Text('description'); $desc_text->setLabel('Description'); $desc_text->setLabelAttributes(array('class' => 'type_text type_text_mod_darker')); $desc_text->setAttributes(array('class' => 'type_text_input')); $submit_button = new Element\Submit('submit'); $submit_button->setValue('Submit'); $submit_button->setAttributes(array('class' => 'btn btn_white')); $cancel_button = new Element\Submit('cancel'); $cancel_button->setValue('Cancel'); $cancel_button->setAttributes(array('class' => 'btn btn_rozy')); $this->add($id_hidden); $this->add($title_text); $this->add($url_text); $this->add($text_textarea); $this->add($auto_check); $this->add($meta_text); $this->add($keywords_text); $this->add($desc_text); $this->add($submit_button); $this->add($cancel_button); }
public function addElements() { $this->setAttribute('method', 'post'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $element = new Element\Text('title'); $element->setAttributes(array('class' => 'username', 'size' => '30', 'class' => 'form-control', 'placeholder' => 'title')); $this->add($element); $element = new Element\Textarea('body'); $element->setAttributes(array('size' => '30', 'class' => 'form-control editor', 'placeholder' => 'body')); $this->add($element); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Thêm mentor'); $this->add($group); // name $userName = new Text('userName'); $userName->setLabel('Người dùng: '); $userName->setAttributes(['maxlength' => 255]); if ($options == 'edit') { $userName->setAttribute('disabled', 'disabled'); } $this->add($userName); $group->addElement($userName); $filter->add(array('name' => 'userName', 'required' => $options == 'edit' ? false : true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); $userId = new Hidden('userId'); $this->add($userId); $group->addElement($userId); $filter->add(array('name' => 'userId', 'required' => $options == 'edit' ? false : true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập người dùng')))))); // code $description = new Textarea('description'); $description->setLabel('Mô tả mentor:'); $description->setAttributes(['class' => 'form-control basicEditor ', 'style' => 'min-height: 300px;']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả môn học')))))); $subject = new Text('subject'); $subject->setLabel('Tên môn:'); $subject->setAttributes(['maxlength' => 255, 'style' => 'width:100% !important', 'placeholder' => 'Tên môn học']); $subject->setOptions(array('tagsinput' => true, 'description' => 'Tên môn học')); $this->add($subject); $group->addElement($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $subjectId = new Hidden('subjectId'); $subjectId->setLabel('Tên môn:'); $this->add($subjectId); $group->addElement($subjectId); $filter->add(array('name' => 'subjectId', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên môn')))))); $this->add(array('name' => 'afterSubmit', 'type' => 'radio', 'attributes' => array('value' => '/admin/expert/add'), 'options' => array('layout' => 'fluid', 'clearBefore' => true, 'label' => 'Sau khi lưu dữ liệu:', 'value_options' => array('/admin/expert/add' => 'Tiếp tục nhập', '/admin/expert/index' => 'Hiện danh sách vừa nhập')))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Search'); $group->setLabel('Tìm kiếm trợ giúp ??'); $this->add($group); // search $search = new Text('search'); $search->setLabel('Tôi cần giúp về: '); $search->setAttributes(['maxlength' => 255, 'class' => 'input-title', 'placeholder' => 'e.g. Need help debugging SASS/CSS for frontend in Rails app']); $this->add($search); $group->addElement($search); $filter->add(array('name' => 'search', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $searchDetail = new Textarea('searchDetail'); $searchDetail->setAttributes(['placeholder' => 'Thêm chi tiết giúp bạn nhận hỗ trợ nhanh hơn', 'class' => 'input-description']); $this->add($searchDetail); $group->addElement($searchDetail); $filter->add(array('name' => 'searchDetail', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $subject = new Text('subject'); $subject->setAttributes(['placeholder' => 'Thêm môn học']); $this->add($subject); $filter->add(array('name' => 'subject', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $subjectId = new Hidden('subjectId'); $this->add($subjectId); $filter->add(array('name' => 'subjectId', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn cần điền ít nhất là 1 môn học')))))); $budget = new Radio('budget'); $budget->setValueOptions(['5' => '20', '10' => '40']); $this->add($budget); $filter->add(array('name' => 'budget', 'required' => false, 'filters' => array(array('name' => 'StringTrim')))); $email = new Text('email'); $email->setLabel('Email'); $this->add($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ')))))); $password = new Password('password'); $password->setAttributes(array('type' => 'password', 'id' => 'password')); $password->setLabel('Mật khẩu:'); $this->add($password); //$groupBasic->addElement($password); $filter->add(array('name' => 'password', 'required' => false, 'validators' => array(array('name' => 'NotEmpty', 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mật khẩu')))))); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
/** * Form initialization. * * @return void */ public function __construct() { parent::__construct(); // Job Name $name = new Element\Text('name'); $name->setLabel('Job Name'); $name->setAttributes(array('autocomplete' => 'off', 'class' => 'form-control')); $this->add($name); // Expression $expression = new Element\Text('expression'); $expression->setLabel('Time'); $expression->setValue('* * * * *'); $expression->setAttributes(array('autocomplete' => 'off', 'class' => 'form-control')); $this->add($expression); // Command $command = new Element\Textarea('command'); $command->setLabel('Command'); $command->setAttributes(array('autocomplete' => 'off', 'class' => 'form-control command')); $this->add($command); }
public function __construct($name = null) { parent::__construct('links'); $weight_hidden = new Element\Hidden('weight'); $title_text = new Element\Text('name'); $title_text->setLabel('Title'); $title_text->setLabelAttributes(array('class' => 'type_text')); $title_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $url_text = new Element\Url('ref'); $url_text->setLabel('Url'); $url_text->setLabelAttributes(array('class' => 'type_text')); $url_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => true)); $description_textarea = new Element\Textarea('description'); $description_textarea->setLabel('Description'); $description_textarea->setLabelAttributes(array('class' => 'type_text')); $description_textarea->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...')); $this->add($weight_hidden); $this->add($title_text); $this->add($url_text); $this->add($description_textarea); }
public function addElements() { $this->setAttribute('method', 'post'); $this->add(array('name' => 'id', 'attributes' => array('type' => 'hidden'))); $element = new Element\Text('title'); $element->setAttributes(array('size' => '30', 'class' => 'form-control', 'placeholder' => 'title')); $this->add($element); $element = new Element\Text('name'); $element->setAttributes(array('size' => '30', 'class' => 'form-control', 'placeholder' => 'Название на английском одним словом', 'alt' => 'Название на английском одним словом', 'title' => 'Название на английском одним словом')); $this->add($element); $element = new Element\Select('category_id'); $element->setAttributes(array('class' => 'form-control ', 'placeholder' => 'category')); $this->add($element); $element = new Element\File('thumb', array('required' => false)); $element->setLabel('Preview')->setOptions(array('required' => false))->setAttributes(array('required' => false, 'class' => 'form-control', 'placeholder' => 'preview')); $this->add($element); $element = new Element\Textarea('body'); $element->setAttributes(array('size' => '30', 'class' => 'form-control editor', 'placeholder' => 'body')); $this->add($element); $this->add(array('name' => 'submit', 'attributes' => array('type' => 'submit', 'value' => 'Send', 'id' => 'submitbutton', 'class' => 'form-control btn btn-primary'))); }
public function __construct($name = null) { parent::__construct('filmes'); $this->setAttribute('enctype', 'multipart/form-data'); $id = new Hidden('filmes_id'); $nome = new Text('filmes_nome'); $nome->setLabel('Nome: '); $nome->setAttributes(array('class' => 'form-control', 'id' => 'filmes_nome')); $preco = new Text('filmes_preco'); $preco->setLabel('Valor Aluguel: '); $preco->setAttributes(array('class' => 'form-control', 'id' => 'filmes_preco')); $categoria = new Select('categoria_id'); $categoria->setLabel('Categoria: '); $categoria->setAttributes(array('class' => 'form-control', 'id' => 'categoria_id', 'empty_option' => 'Please select an author', 'value_options' => $this->getOptionsForSelect())); $foto = new File('filmes_foto'); $foto->setLabel('Cartaz: '); $foto->setAttributes(array('class' => 'form-control')); $descricao = new Textarea('filmes_descricao'); $descricao->setLabel('Dados do Filme: '); $descricao->setAttributes(array('style' => 'height: 100px;', 'class' => 'form-control', 'id' => 'filmes_descricao')); $status = new Checkbox('filmes_status'); $status->setLabel("Mostrar?"); $status->setValue(1); $submit = new Button('submit'); $submit->setLabel('Cadastrar'); $submit->setAttributes(array('type' => 'submit', 'class' => 'btn btn-success')); $cancel = new Button('cancel'); $cancel->setLabel('Cancelar'); $cancel->setAttributes(array('type' => 'button', 'class' => 'btn btn-default', 'onclick' => 'javascript:history.go(-1)')); $this->add($id); $this->add($nome); $this->add($preco); $this->add($foto); $this->add($descricao); $this->add($categoria); $this->add($status); $this->add($submit); $this->add($cancel); }
public function __construct(EntityManager $entityManager) { parent::__construct(); $this->entityManager = $entityManager; $this->setAttributes(array("method" => "post", "enctype" => "multipart/form-data", "class" => "form")); $this->setInputFilter(new GuiaVersoesFilters()); // Campo de titulo $titulo = new Text('titulo'); $titulo->setLabel("* Título")->setAttributes(array("maxLength" => "200", "class" => "form-control", "required" => "required")); // Campo de resposta $descricao = new Textarea('descricao'); $descricao->setLabel('* Descrição'); $descricao->setAttributes(array('class' => 'file form-control editor', 'cols' => '30', 'rows' => '10')); // Campo de midia $file = new File("midia"); $file->setLabel('*Imagem (Tamanho exato de ' . \Base\Constant\Upload::VERSOES_WIDTH . 'x' . \Base\Constant\Upload::VERSOES_HEIGTH . ' px | ' . \Base\Constant\Upload::VERSOES_MAX_SIZE . ')')->setAttribute('name', 'midia')->setAttribute('id', 'image'); // Botão de Submit $botao = new Submit("submit"); $botao->setAttributes(array("value" => "Salvar")); // Adiciona campos $this->add($titulo)->add($descricao)->add($file)->add($botao); }
public function __construct($name = null) { parent::__construct('terms'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $orders_radio = new Element\Radio('custom_orders'); $orders_radio->setLabel('Custom orders'); $orders_radio->setValueOptions(array('0' => 'No', '1' => 'Yes')); $shipping_select = new Element\Select('shipping'); $shipping_select->setLabel('Shipping'); $shipping_select->setLabelAttributes(array('class' => 'select f_3_w50')); $shipping_select->setAttributes(array('class' => 'sel_chosen')); $shipping_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your shipping')); $policies_text = new Element\Textarea('wholesale_policies'); $policies_text->setLabel('Wholesale policies'); $policies_text->setLabelAttributes(array('class' => 'type_text')); $policies_text->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...')); $this->add($id_hidden); $this->add($orders_radio); $this->add($shipping_select); $this->add($policies_text); }
public function __construct($name = null, $options = array()) { parent::__construct(isset($name) ? $name : 'about'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $specialty_text = new Element\Text('specialty'); $specialty_text->setLabel('Specialty'); $specialty_text->setLabelAttributes(array('class' => 'type_text')); $specialty_text->setAttributes(array('class' => 'type_text_input')); $proficiency_select = new Element\Select('proficiency_level'); $proficiency_select->setLabel('Proficiency level'); $proficiency_select->setLabelAttributes(array('class' => 'select f_3_w50')); $proficiency_select->setAttributes(array('class' => 'sel_chosen')); $proficiency_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your proficiency')); $about_textarea = new Element\Textarea('about'); $about_textarea->setLabel('About'); $about_textarea->setLabelAttributes(array('class' => 'type_text')); $about_textarea->setAttributes(array('class' => 'type_text_input', 'placeholder' => 'Type something...', 'required' => 'require')); $this->add($id_hidden); $this->add($specialty_text); $this->add($proficiency_select); $this->add($about_textarea); }
public function __construct(ObjectManager $om, $name = "") { parent::__construct($name); $this->setObjectManager($om); $this->setAttribute(array('method' => 'POST')); /* Criando um input do tipo text */ $this->add(array('type' => 'Text', 'name' => 'nome', 'attributes' => array('class' => 'form-control'))); /* Criando um input do tipo text */ $this->add(array('type' => 'Number', 'name' => 'preco', 'attributes' => array('class' => 'form-control'))); /* Criando um input do tipo text */ $textarea = new Element\Textarea('descricao'); $textarea->setAttributes(['class' => 'form-control']); $this->add($textarea); /*$this->add(array( 'type' => 'Zend\Form\Element\Csrf', 'name' => 'csrf', 'options' => array( 'csrf_options' => array( 'timeout' => 100 ) ) ));*/ $this->add(array('type' => 'DoctrineModule\\Form\\Element\\ObjectSelect', 'name' => 'categoria', 'attributes' => ['class' => 'form-control'], 'options' => array('object_manager' => $this->getObjectManager(), 'target_class' => 'Produto\\Entity\\Categoria', 'property' => 'nome', 'empty_option' => '--- escolha ---'))); }
/** * Form initialization. * * @return void */ public function __construct() { parent::__construct(); // Job Name $name = new Element\Text('name'); $name->setLabel('Job Name'); $name->setAttributes(array('autocomplete' => 'off', 'class' => 'form-control')); $this->add($name); // Command $command = new Element\Textarea('command'); $command->setLabel('Command'); $command->setAttributes(array('autocomplete' => 'off', 'class' => 'form-control command')); $this->add($command); // Add fieldset wrapping all time options $this->add($this->getTimeFieldset()); // Add fieldset wrapping all repeat options $this->add($this->getRepeatFieldset()); }
public function __construct($serviceLocator, $options = null) { parent::__construct('AccountIndex'); $this->setServiceLocator($serviceLocator); $this->setAttribute('method', 'post'); $filter = $this->getInputFilter(); $group = new DisplayGroup('Subject'); $group->setLabel('Trở thành mentor '); $this->add($group); // name $fullname = new Text('fullname'); $fullname->setLabel('Họ và tên:'); $fullname->setAttributes(['maxlength' => 255, 'placeholder' => 'Tên']); $this->add($fullname); $group->addElement($fullname); $filter->add(array('name' => 'fullname', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập tên')))))); $email = new Text('email'); $email->setLabel('Email của Anh/Chị :'); $email->setAttributes(['maxlength' => 255, 'placeholder' => 'Email']); $this->add($email); $group->addElement($email); $filter->add(array('name' => 'email', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập email'))), array('name' => 'EmailAddress', 'break_chain_on_failure' => true, 'options' => array('messages' => array('emailAddressInvalidFormat' => 'Địa chỉ email không hợp lệ')))))); $skype = new Text('skype'); $skype->setLabel('Skype:'); $skype->setAttributes(['maxlength' => 255, 'placeholder' => 'Skype']); $this->add($skype); $group->addElement($skype); $filter->add(array('name' => 'skype', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập skype')))))); $mobile = new Text('mobile'); $mobile->setLabel('Số điện thoại:'); $mobile->setAttributes(['maxlength' => 12, 'placeholder' => 'Số điện thoại']); $this->add($mobile); $group->addElement($mobile); $filter->add(array('name' => 'mobile', 'required' => true, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập số điện thoại')))))); $social = new Text('social'); $social->setLabel('Link tới tài khoản mạng xã hội của bạn:'); $social->setAttributes(['maxlength' => 255, 'placeholder' => 'Mạng xã hội']); $this->add($social); $group->addElement($social); $filter->add(array('name' => 'social', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập skype')))))); $isTeaching = new Radio('isTeaching'); $isTeaching->setLabel('Bạn đã từng giảng dạy chưa?'); $isTeaching->setValueOptions(['1' => 'Đã từng', '2' => 'Chưa bao giờ']); $this->add($isTeaching); $group->addElement($isTeaching); $filter->add(array('name' => 'isTeaching', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa chọn')))))); $description = new Textarea('description'); $description->setLabel('Mô tả công việc giảng dạy của bạn:'); $description->setAttributes(['class' => ' inputBox', 'style' => 'min-height: 300px;', 'placeholder' => 'Mô tả']); $this->add($description); $group->addElement($description); $filter->add(array('name' => 'description', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập mô tả công việc giảng day của bạn')))))); $cityId = new Select('cityId'); $cityId->setLabel('Thành phố:'); $this->loadCities($cityId); $filter->add(array('name' => 'cityId', 'required' => false, 'filters' => array())); $this->add($cityId); $districtId = new Select('districtId'); $districtId->setLabel('Quận/huyện: '); $this->loadDistricts($districtId, $cityId, $options); $this->add($districtId); $filter->add(array('name' => 'districtId', 'required' => false, 'filters' => array())); $address = new Text('address'); $address->setLabel('Địa chỉ: '); $filter->add(array('name' => 'address', 'required' => false, 'filters' => array(array('name' => 'StringTrim')), 'validators' => array(array('name' => 'NotEmpty', 'break_chain_on_failure' => true, 'options' => array('messages' => array('isEmpty' => 'Bạn chưa nhập địa chỉ của bạn')))))); $this->add($address); // $birthday = new Text('birthday'); // $birthday->setLabel('Tên danh mục:'); // $birthday->setAttributes([ // 'maxlength' => 255, // 'placeholder' => 'Ngày sinh', // 'class' => 'datepicker inputBox' // ]); // $this->add($birthday); // $group->addElement($birthday); // $filter->add(array( // 'name' => 'birthday', // 'required' => false, // 'filters' => array( // array( // 'name' => 'StringTrim' // ) // ), // 'validators' => array( // array( // 'name' => 'NotEmpty', // 'break_chain_on_failure' => true, // 'options' => array( // 'messages' => array( // 'isEmpty' => 'Bạn chưa nhập ngày sinh' // ) // ) // ), // ) // )); $this->add(array('name' => 'submit', 'options' => array('clearBefore' => true), 'attributes' => array('type' => 'submit', 'value' => 'Lưu', 'id' => 'btnSave', 'class' => 'btn btn-primary'))); }
public function render($formPV, $id) { $form = new Form(); $form->setAttribute('id', $id); $inputFilter = new \Zend\InputFilter\InputFilter(); $factory = new InputFactory(); foreach ($formPV as $element) { if (isset($element->line_text)) { $attributes = $element->line_text[0]; $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; //$required = ($attributes->data->required == 'true') ? true : false ; $required = false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : ''; $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : ''; $element = new Element\Text($name); $element->setName($label); $element->setLabel($label); $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id)); $form->add($element); $options = array(); $options['encoding'] = 'UTF-8'; if ($lengthMin && $lengthMin > 0) { $options['min'] = $lengthMin; } if ($lengthMax && $lengthMax > $lengthMin) { $options['max'] = $lengthMax; $element->setAttribute('maxlength', $lengthMax); $options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax)); } $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options))))); } if (isset($element->line_email)) { $attributes = $element->line_email[0]; $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; //$required = ($attributes->data->required == 'true') ? true : false ; $required = false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : ''; $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : ''; $element = new Element\Email($name); $element->setLabel($label); $element->setName($label); $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id)); $form->add($element); $options = array(); $options['encoding'] = 'UTF-8'; if ($lengthMin && $lengthMin > 0) { $options['min'] = $lengthMin; } if ($lengthMax && $lengthMax > $lengthMin) { $options['max'] = $lengthMax; $element->setAttribute('maxlength', $lengthMax); $options['messages'] = array(\Zend\Validator\StringLength::TOO_LONG => sprintf($this->getServiceManager()->get('translator')->translate('This field contains more than %s characters', 'playgroundgame'), $lengthMax)); } $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options))))); } if (isset($element->line_checkbox)) { $attributes = $element->line_checkbox[0]; $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; // $required = ($attributes->data->required == 'yes') ? true : false; $required = false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : ''; $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : ''; $innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array(); $element = new Element\MultiCheckbox($name); $element->setLabel($label); $element->setName($label); $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id)); $values = array(); foreach ($innerData as $value) { $values[] = $value->label; } $element->setValueOptions($values); $form->add($element); $options = array(); $options['encoding'] = 'UTF-8'; $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required))); } if (isset($element->line_paragraph)) { $attributes = $element->line_paragraph[0]; $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $placeholder = isset($attributes->data->placeholder) ? $attributes->data->placeholder : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; $required = $attributes->data->required == 'true' ? true : false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : ''; $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : ''; $element = new Element\Textarea($name); $element->setName($label); $element->setLabel($label); $element->setAttributes(array('placeholder' => $placeholder, 'required' => $required, 'class' => $class, 'id' => $id)); $form->add($element); $options = array(); $options['encoding'] = 'UTF-8'; if ($lengthMin && $lengthMin > 0) { $options['min'] = $lengthMin; } if ($lengthMax && $lengthMax > $lengthMin) { $options['max'] = $lengthMax; $element->setAttribute('maxlength', $lengthMax); } $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'filters' => array(array('name' => 'StripTags'), array('name' => 'StringTrim')), 'validators' => array(array('name' => 'StringLength', 'options' => $options))))); } if (isset($element->line_upload)) { $attributes = $element->line_upload[0]; //print_r($attributes); $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; $required = $attributes->data->required == 'true' ? true : false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $filesizeMin = isset($attributes->data->filesize) ? $attributes->data->filesize->min : ''; $filesizeMax = isset($attributes->data->filesize) ? $attributes->data->filesize->max : ''; $element = new Element\File($name); $element->setLabel($label); $element->setName($label); $element->setAttributes(array('required' => $required, 'class' => $class, 'id' => $id)); $form->add($element); $inputFilter->add($factory->createInput(array('name' => $name, 'required' => $required, 'validators' => array(array('name' => '\\Zend\\Validator\\File\\Size', 'options' => array('max' => 10 * 1024 * 1024)), array('name' => '\\Zend\\Validator\\File\\Extension', 'options' => array('png,PNG,jpg,JPG,jpeg,JPEG,gif,GIF', 'messages' => array(\Zend\Validator\File\Extension::FALSE_EXTENSION => 'Veuillez télécharger une image'))))))); } if (isset($element->line_radio)) { $attributes = $element->line_radio[0]; $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; // $required = ($attributes->data->required == 'yes') ? true : false; $required = false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : ''; $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : ''; $innerData = isset($attributes->data->innerData) ? $attributes->data->innerData : array(); $element = new Element\Radio($name); $element->setLabel($label); $element->setName($label); $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id)); $values = array(); foreach ($innerData as $value) { $values[] = $value->label; } $element->setValueOptions($values); $form->add($element); } if (isset($element->line_dropdown)) { $attributes = $element->line_dropdown[0]; $name = isset($attributes->name) ? $attributes->name : ''; $type = isset($attributes->type) ? $attributes->type : ''; $position = isset($attributes->order) ? $attributes->order : ''; $label = isset($attributes->data->label) ? $attributes->data->label : ''; // $required = ($attributes->data->required == 'yes') ? true : false; $required = false; $class = isset($attributes->data->class) ? $attributes->data->class : ''; $id = isset($attributes->data->id) ? $attributes->data->id : ''; $lengthMin = isset($attributes->data->length) ? $attributes->data->length->min : ''; $lengthMax = isset($attributes->data->length) ? $attributes->data->length->max : ''; $dropdownValues = isset($attributes->data->dropdownValues) ? $attributes->data->dropdownValues : array(); $element = new Element\Select($name); $element->setLabel($label); $element->setName($label); $element->setAttributes(array('name' => $name, 'required' => $required, 'allowEmpty' => !$required, 'class' => $class, 'id' => $id)); $values = array(); foreach ($dropdownValues as $value) { $values[] = $value->dropdown_label; } $element->setValueOptions($values); $form->add($element); } } $form->setInputFilter($inputFilter); return $form; }
public function __construct(EntityManager $em, OrmRelatorio $orm = null) { parent::__construct("formRelatorio"); /* * txtID */ $txtId = new Element\Hidden("id"); /* * txtAno */ $option = array(); $ano = 0; if (date("m") >= 9) { $ano = 1; } $ano = $ano + date("Y"); $option[$ano] = $ano; $option[$ano - 1] = $ano - 1; $cmbAno = new Element\Select('ano'); $cmbAno->setValueOptions($option); $cmbAno->setEmptyOption("Escolha o ano"); $cmbAno->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * txtMes */ setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese'); date_default_timezone_set('America/Sao_Paulo'); $option = array(); for ($index = 1; $index < 13; $index++) { $option[$index] = strftime("%B", strtotime(date("Y") . "/" . $index . "/01")); } $cmbMes = new Element\Select('mes'); $cmbMes->setValueOptions($option); $cmbMes->setEmptyOption("Escolha o ano"); $cmbMes->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * cmbPublicador */ $dao = $em->getRepository('Stj\\Entity\\OrmPublicador'); $lista = $dao->findAll(); $option = array(); foreach ($lista as $key => $value) { $congregacao = new OrmCongregacao(); $congregacao = $value; $option[$congregacao->getId()] = $congregacao->getNome(); } $cmbPublicador = new Element\Select('publicador'); $cmbPublicador->setValueOptions($option); $cmbPublicador->setEmptyOption("Escolha o publicador"); $cmbPublicador->setAttributes(array('class' => 'chosen-select', 'style' => 'width:140px;', 'required' => 'true')); /* * txtLivros */ $txtPublicacoes = new Element\Number("publicacoes"); $txtPublicacoes->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "3", 'required' => 'true')); /* * $txtVideos */ $txtVideos = new Element\Number("videos"); $txtVideos->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "3", 'required' => 'true')); /* * $txtPublicacoes */ $txtHoras = new Element\Text("horas"); $txtHoras->setAttributes(array('class' => 'form-control', 'placeholder' => 'HH:MM', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+\\:[0-9]{2}$/', 'data-parsley-maxlength' => "6", 'required' => 'true')); /* * txtRevisitas */ $txtRevisitas = new Element\Number("revisitas"); $txtRevisitas->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "2", 'required' => 'true')); /* * txtEstudos */ $txtEstudos = new Element\Number("estudos"); $txtEstudos->setAttributes(array('class' => 'form-control', 'placeholder' => 'Quantidade', 'data-parsley-trigger' => 'change', 'pattern' => '/^[0-9]+$/', 'data-parsley-maxlength' => "2", 'required' => 'true')); /* * txtObs */ $txtObs = new Element\Textarea("obs"); $txtObs->setAttributes(array('class' => 'form-control', 'placeholder' => 'Digites suas observações aqui')); /* * Itoken */ $iToken = new Element\Csrf("iToken"); /* * btnSalvar */ $btnSalvar = new Element\Button('salvar'); $btnSalvar->setAttributes(array('class' => 'btn btn-darkgray btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * btnVoltar */ $btnVoltar = new Element\Button('voltar'); $btnVoltar->setAttributes(array('class' => 'btn btn-blue btn-ef btn-ef-4 btn-ef-4c mb-10', 'type' => 'button')); /* * Preencher Componentes */ if ($orm != null) { $txtId->setValue($orm->getId()); $cmbAno->setValue($orm->getAno()); $cmbMes->setValue($orm->getMes()); $cmbPublicador->setValue($orm->getPublicador()->getId()); $txtPublicacoes->setValue($orm->getPublicacoes()); $txtVideos->setValue($orm->getVideos()); $txtHoras->setValue($orm->getHoras()); $txtRevisitas->setValue($orm->getRevisitas()); $txtEstudos->setValue($orm->getEstudos()); } // Adiciona componetes no form $this->add($txtId); // $this->add(); $this->add($cmbAno); $this->add($cmbMes); $this->add($cmbPublicador); $this->add($txtPublicacoes); $this->add($txtVideos); $this->add($txtHoras); $this->add($txtRevisitas); $this->add($txtEstudos); $this->add($txtObs); $this->add($iToken); $this->add($btnSalvar); $this->add($btnVoltar); $this->setAttributes(array('id' => 'form', 'data-parsley-validate' => NULL)); }
public function __construct($name = null) { parent::__construct('services'); $id_hidden = new Element\Hidden('id'); $id_hidden->setName('id'); $tutorial_select = new Element\Select('tutorial_status'); $tutorial_select->setLabel('Tutorial status'); $tutorial_select->setLabelAttributes(array('class' => 'select f_3_w50')); $tutorial_select->setAttributes(array('class' => 'sel_chosen')); $tutorial_select->setOptions(array('disable_inarray_validator' => true, 'empty_option' => 'Please choose your status')); $members_select = new Element\Textarea('members_special'); $members_select->setLabel('Members Special'); $members_select->setLabelAttributes(array('class' => 'type_text')); $members_select->setAttributes(array('class' => 'type_text_input')); $this->add($id_hidden); $this->add($tutorial_select); $this->add($members_select); $this->add(array('type' => 'Profile\\Form\\AdressesFieldset')); }