public function __construct(EntityManager $entityManager) { parent::__construct(); $this->entityManager = $entityManager; $this->setAttributes(array("method" => "post", "enctype" => "multipart/form-data", "class" => "form")); $this->setInputFilter(new HomeBannersFilters()); // Campo de titulo $titulo = new Text('titulo'); $titulo->setLabel("* Título")->setAttributes(array("maxLength" => "400", "class" => "form-control", "required" => "required")); // Campo tipo de midia $tipo = new Radio('tipo_banner'); $tipo->setLabel('Tipo de mídia'); $tipo->setValueOptions(array('IMAGEM' => 'Imagem', 'VIDEO' => 'Vídeo'))->setOptions(array('label_attributes' => array('class' => 'radio-inline')))->setAttribute("value", "IMAGEM"); // Campo de midia $file = new File("midia"); $file->setLabel('*Imagem (Tamanho exato de ' . \Base\Constant\Upload::BANNER_WIDTH . 'x' . \Base\Constant\Upload::BANNER_HEIGTH . ' px | ' . \Base\Constant\Upload::BANNER_MAX_SIZE . ')')->setAttribute('name', 'midia')->setAttribute('id', 'image'); // Campo de midia2 $file2 = new File("midia2"); $file2->setLabel('*Video (' . \Base\Constant\Upload::BANNER_MAX_SIZE . ')')->setAttribute('id', 'video'); // Botão de Submit $botao = new Submit("submit"); $botao->setAttributes(array("value" => "Salvar")); // Adiciona campos $this->add($titulo)->add($tipo)->add($file)->add($file2)->add($botao); }
public function __construct() { // we want to ignore the name passed parent::__construct('timezone'); $this->setAttribute('method', 'post'); $name_timezone = new Element\Text('name_timezone'); $name_timezone->setLabel('Timezone')->setAttributes(array('class' => 'form-control input-sm')); $this->add($name_timezone); $num_timezone = new Element\Text('num_timezone'); $num_timezone->setLabel('Timezone Number')->setAttributes(array('class' => 'form-control input-sm')); $this->add($num_timezone); $bool_daylight_saving = new Element\Radio('bool_daylight_saving'); $bool_daylight_saving->setLabel('Daylight Saving')->setLabelAttributes(array('class' => 'checkbox-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_daylight_saving); $dt_summer_time_begin = new Element\Text('dt_summer_time_begin'); $dt_summer_time_begin->setLabel('Summer Time Begin')->setAttributes(array('type' => 'datetime', 'id' => 'dt_summer_time_begin', 'class' => 'form-control input-sm'))->setOptions(array('datepickerOptions' => array('autoSize: true'))); $this->add($dt_summer_time_begin); $dt_winter_time_begin = new Element\Text('dt_winter_time_begin'); $dt_winter_time_begin->setLabel('Winter Time Begin')->setAttributes(array('type' => 'datetime', 'id' => 'dt_winter_time_begin', 'class' => 'form-control input-sm'))->setOptions(array('datepickerOptions' => array('autoSize: true'))); $this->add($dt_winter_time_begin); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function addElements() { $id = new Element\Text('id'); $id->setLabel('ID')->setAttribute('class', 'form-control')->setAttribute('type', 'hidden'); $this->add($id); $name = new Element\Text('name'); $name->setLabel('catalog name')->setAttribute('class', 'form-control')->setAttribute('required', 'true')->setAttribute('onchange', 'get_alias();')->setAttribute('id', 'name'); $this->add($name); $alias = new Element\Text('alias'); $alias->setLabel('catalog alias')->setAttribute('required', 'true')->setAttribute('class', 'form-control')->setAttribute('id', 'alias'); $this->add($alias); $description = new Element\Textarea('description'); $description->setLabel('Description')->setAttribute('class', 'materialize-textarea form-control')->setAttribute('id', 'description'); $this->add($description); $hot = new Element\Radio('hot'); $hot->setLabel('Choice hot')->setValueOptions(array('0' => 'No Hot', '1' => 'Hot'))->setAttribute('id', 'hot')->setAttribute('class', 'radio_style'); $this->add($hot); $new = new Element\Radio('new'); $new->setLabel('Choice new')->setValueOptions(array('0' => 'No New', '1' => 'New'))->setAttribute('id', 'new')->setAttribute('class', 'radio_style'); $this->add($new); $status = new Element\Radio('status'); $status->setLabel('status'); //->setAttribute('required', 'true') $status->setValueOptions(array('0' => 'Pause', '1' => 'Active'))->setAttribute('id', 'status')->setAttribute('class', 'radio_style'); $this->add($status); $show_index = new Element\Radio('show_index'); $show_index->setLabel('show_index'); //->setAttribute('required', 'true') $show_index->setValueOptions(array('0' => 'No', '1' => 'Yes'))->setAttribute('id', 'show_index')->setAttribute('class', 'radio_style'); $this->add($show_index); $img = new Element\File('img'); $img->setLabel('file img (* not support .png , .gif)')->setAttribute('class', 'form-control')->setAttribute('type', 'file')->setAttribute('accept', '.jpg, .jpeg, .JPG, .JPEG')->setAttribute('id', 'img'); $this->add($img); }
public function __construct() { // we want to ignore the name passed parent::__construct('Attachment'); $this->add(new Element\Hidden('target_type_object')); $this->add(new Element\Hidden('target_id_row')); $this->setAttribute('method', 'post'); $nid_lov_attachmenttype = new Element\Select('nid_lov_attachmenttype'); $nid_lov_attachmenttype->setLabel('Attachment Type')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('' => 'Select a attachment type')); $this->add($nid_lov_attachmenttype); $url_or_filepath = new Element\Text('url_or_filepath'); $url_or_filepath->setLabel('Url or file path')->setAttributes(array('class' => 'form-control input-sm')); $this->add($url_or_filepath); $filename = new Element\Text('filename'); $filename->setLabel('File Name')->setAttributes(array('class' => 'form-control input-sm')); $this->add($filename); $filesize = new Element\Text('filesize'); $filesize->setLabel('File Size')->setAttributes(array('class' => 'form-control input-sm')); $this->add($filesize); $mimetype = new Element\Text('mimetype'); $mimetype->setLabel('Mime Type')->setAttributes(array('class' => 'form-control input-sm')); $this->add($mimetype); $bool_active = new Element\Radio('bool_active'); $bool_active->setLabel('Is Active?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_active); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function __construct() { // we want to ignore the name passed parent::__construct('lov'); $this->setAttribute('method', 'post'); $this->add(new Element\Hidden('type_lov')); $new_type_lov = new Element\Text('new_type_lov'); $new_type_lov->setLabel('List Type')->setAttributes(array('class' => 'form-control input-sm')); $this->add($new_type_lov); $nid_language = new Element\Select('nid_language'); $nid_language->setLabel('Language')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a language')); $this->add($nid_language); $bool_translateable = new Element\Radio('bool_translateable'); $bool_translateable->setLabel('Translateable')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_translateable); $bool_controlbypoxn = new Element\Radio('bool_controlbypoxn'); $bool_controlbypoxn->setLabel('Control by Poxn')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_controlbypoxn); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function getElementWithOptionSpec() { $element = new RadioElement('foo'); $options = array('This is the first label' => 'value1', 'This is the second label' => array('value' => 'value2', 'label' => 'This is the second label (overridden)', 'disabled' => false, 'label_attributes' => array('class' => 'label-class'), 'attributes' => array('class' => 'input-class')), 'This is the third label' => 'value3'); $element->setAttribute('options', $options); return $element; }
public function buildForm() { $this->setAttribute('method', 'POST'); $category = new Select('category'); $category->setLabel('Category')->setValueOptions(array_combine($this->getCategories(), $this->getCategories())); $title = new Text('title'); $title->setLabel('Title')->setAttributes(array('size' => 50, 'maxLength' => 128, 'required' => 'required', 'placeholder' => 'Title', 'title' => 'Title')); $photo = new Text('photo_filename'); $photo->setLabel('Photo')->setAttribute('maxlength', 1024)->setAttribute('placeholder', 'Enter a valid image file URL'); $name = new Text('contact_name'); $name->setLabel('Contact Name')->setAttribute('title', 'Contact Name')->setAttribute('size', 50)->setAttribute('maxlength', 255); $email = new Email('contact_email'); $email->setLabel('Contact Email')->setAttribute('title', 'Contact Email')->setAttribute('size', 50)->setAttribute('maxlength', 255); $phone = new Text('contact_phone'); $phone->setLabel('Contact Phone Number')->setAttribute('title', 'Contact Phone Number')->setAttribute('size', 20)->setAttribute('maxlength', 32); $city = new Select('cityCode'); $city->setLabel('Nearest City')->setValueOptions(array_combine(self::$cityCodes, self::$cityCodes))->setAttribute('id', 'cityCode'); $price = new Text('price'); $price->setLabel('Price')->setAttribute('title', 'Price as nnn.nn')->setAttribute('size', 16)->setAttribute('maxlength', 16); $expires = new Radio('expires'); $expires->setLabel('Expires')->setAttribute('title', 'The expiration date from today')->setAttribute('class', 'expiresButton')->setValueOptions($this->getExpireDays()); $deleteCode = new Text('delete_code'); $deleteCode->setLabel('Delete Code')->setAttribute('title', 'Delete code for this item')->setAttribute('size', 16)->setAttribute('maxlength', 16); $description = new Textarea('description'); $description->setLabel('Description')->setAttribute('title', 'Description')->setAttribute('rows', 5)->setAttribute('cols', 80); $captchaAdapter = new ImageCaptcha(); $captchaAdapter->setWordlen(4)->setOptions($this->captchaOptions); $captcha = new Captcha('captcha'); $captcha->setCaptcha($captchaAdapter)->setLabel('Help us to prevent SPAM!')->setAttribute('class', 'captchaStyle')->setAttribute('title', 'Help us to prevent SPAM'); $submit = new Submit('submit'); $submit->setAttribute('value', 'Post'); $this->add($category)->add($title)->add($photo)->add($name)->add($email)->add($phone)->add($city)->add($price)->add($expires)->add($deleteCode)->add($description)->add($captcha)->add($submit); }
public function __construct() { // we want to ignore the name passed parent::__construct('orgtype'); $this->setAttribute('method', 'post'); $type_organization = new Element\Text('type_organization'); $type_organization->setLabel('Organization Type')->setAttributes(array('class' => 'form-control input-sm')); $this->add($type_organization); $genre = new Element\Text('genre'); $genre->setLabel('Genre')->setAttributes(array('class' => 'form-control input-sm')); $this->add($genre); $bool_unioned = new Element\Radio('bool_unioned'); $bool_unioned->setLabel('Unioned ?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_unioned); $registered_location = new Element\Text('registered_location'); $registered_location->setLabel('Registered Location')->setAttributes(array('class' => 'form-control input-sm')); $this->add($registered_location); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function testDisableInputSpecification() { $element = new RadioElement(); $element->setValueOptions(array('Option 1' => 'option1', 'Option 2' => 'option2', 'Option 3' => 'option3')); $element->setDisableInArrayValidator(true); $inputSpec = $element->getInputSpecification(); $this->assertArrayNotHasKey('validators', $inputSpec); }
/** * Load radiobuttonlist editor * * @return Element\Radio */ public function load() { $parameters = $this->getConfig(); $element = new Element\Radio($this->getName()); if (!empty($parameters)) { $element->setValueOptions($parameters); } $element->setLabel($this->getProperty()->getName())->setAttribute('id', $this->getName())->setAttribute('required', $this->getProperty()->isRequired())->setValue($this->getValue()); return $element; }
public function __construct() { // we want to ignore the name passed parent::__construct('document'); $this->add(new Element\Hidden('id_party')); $this->setAttribute('method', 'post'); $nid_lov_doctype = new Element\Select('nid_lov_doctype'); $nid_lov_doctype->setLabel('Document Type')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a document type')); $this->add($nid_lov_doctype); $nid_language = new Element\Select('nid_language'); $nid_language->setLabel('Language')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a language')); $this->add($nid_language); $num_sequence = new Element\Text('num_sequence'); $num_sequence->setLabel('Sequence')->setAttributes(array('class' => 'form-control input-sm')); $this->add($num_sequence); $name_document = new Element\Text('name_document'); $name_document->setLabel('Name of document')->setAttributes(array('class' => 'form-control input-sm')); $this->add($name_document); $bool_enterprise = new Element\Radio('bool_enterprise'); $bool_enterprise->setLabel('Is Enterprise?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_enterprise); $bool_attachment = new Element\Radio('bool_attachment'); $bool_attachment->setLabel('Has attachment?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_attachment); $bool_readonly = new Element\Radio('bool_readonly'); $bool_readonly->setLabel('Is ready only?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_readonly); $header = new Element\Textarea('header'); $header->setLabel('Header')->setAttributes(array('class' => 'form-control input-sm')); $this->add($header); $body = new Element\Textarea('body'); $body->setLabel('Body')->setAttributes(array('class' => 'form-control input-sm')); $this->add($body); $footer = new Element\Textarea('footer'); $footer->setLabel('Footer')->setAttributes(array('class' => 'form-control input-sm')); $this->add($footer); $dt_begin = new Element\Text('dt_begin'); $dt_begin->setLabel('Validate Date Begin')->setAttributes(array('type' => 'datetime', 'id' => 'dt_begin', 'class' => 'form-control input-sm'))->setOptions(array('datepickerOptions' => array('autoSize: true'))); $this->add($dt_begin); $dt_end = new Element\Text('dt_end'); $dt_end->setLabel('Validate Date Ends')->setAttributes(array('type' => 'datetime', 'id' => 'dt_end', 'class' => 'form-control input-sm'))->setOptions(array('datepickerOptions' => array('autoSize: true'))); $this->add($dt_end); $num_view = new Element\Text('num_view'); $num_view->setLabel('Number of times being viewed')->setAttributes(array('class' => 'form-control input-sm')); $this->add($num_view); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function __construct($name = NULL) { parent::__construct($name); $this->setAttribute('method', 'post'); $this->setAttribute('class', 'form-signin'); $this->add(array('name' => 'usuario', 'options' => array('label' => ''), 'attributes' => array('type' => 'text', 'class' => 'search-query'))); $valor = new Element\Radio('valor'); $valor->setLabel("Valoración:"); $valor->setValueOptions(array('1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', '7' => '7', '8' => '8', '9' => '9', '10' => '10')); $this->add($valor); }
/** * @dataProvider radioOptionsDataProvider */ public function testInArrayValidationOfOptions($valueTests, $options) { $element = new RadioElement('my-radio'); $element->setAttributes(array('options' => $options)); $inputSpec = $element->getInputSpecification(); $this->assertArrayHasKey('validators', $inputSpec); $inArrayValidator = $inputSpec['validators'][0]; $this->assertInstanceOf('Zend\\Validator\\InArray', $inArrayValidator); foreach ($valueTests as $valueToTest) { $this->assertTrue($inArrayValidator->isValid($valueToTest)); } }
public function __construct() { // we want to ignore the name passed parent::__construct('user'); $this->add(new Element\Hidden('id_party')); $this->setAttribute('method', 'post'); $name_login = new Element\Text('name_login'); $name_login->setLabel('Login Name')->setAttributes(array('class' => 'largewhite')); $this->add($name_login); $password = new Element\Text('password'); $password->setLabel('Password <br/>(Leave blank if do not change the password)')->setAttributes(array('class' => 'largewhite')); $this->add($password); $password_hint = new Element\Text('password_hint'); $password_hint->setLabel('Password Hint 1')->setAttributes(array('class' => 'largewhite')); $this->add($password_hint); $password_hint_answer = new Element\Text('password_hint_answer'); $password_hint_answer->setLabel('Password Hint 1 Answer')->setAttributes(array('class' => 'largewhite')); $this->add($password_hint_answer); $password_hint2 = new Element\Text('password_hint2'); $password_hint2->setLabel('Password Hint 2')->setAttributes(array('class' => 'largewhite')); $this->add($password_hint2); $password_hint2_answer = new Element\Text('password_hint2_answer'); $password_hint2_answer->setLabel('Password Hint 2 Answer')->setAttributes(array('class' => 'largewhite')); $this->add($password_hint2_answer); $nid_lov_login_state = new Element\Select('nid_lov_login_state'); $nid_lov_login_state->setLabel('Login State')->setAttributes(array('class' => 'white'))->setValueOptions(array('0' => 'Select a login state')); $this->add($nid_lov_login_state); $nid_lov_login_delivery_type = new Element\Select('nid_lov_login_delivery_type'); $nid_lov_login_delivery_type->setLabel('Delivery Type')->setAttributes(array('class' => 'white'))->setValueOptions(array('0' => 'Select a delivery type')); $this->add($nid_lov_login_delivery_type); $bool_active = new Element\Radio('bool_active'); $bool_active->setLabel('Is Active?')->setLabelAttributes(array('style' => 'float:left;width:50px;margin-right:10px'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_active); $phase2_auth = new Element\Text('phase2_auth'); $phase2_auth->setLabel('Phase 2 auth code')->setAttributes(array('class' => 'largewhite')); $this->add($phase2_auth); $dt_phase2_auth_timeout = new Element\Text('dt_phase2_auth_timeout'); $dt_phase2_auth_timeout->setLabel('Phase 2 auth code expired time')->setAttributes(array('type' => 'datetime', 'id' => 'dt_begin', 'class' => 'medwhite'))->setOptions(array('datepickerOptions' => array('autoSize: true'))); $this->add($dt_phase2_auth_timeout); $num_retries = new Element\Text('num_retries'); $num_retries->setLabel('Number of retries')->setAttributes(array('class' => 'smallwhite')); $this->add($num_retries); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'smallwhite')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn-success', 'style' => 'margin-right:100px;', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn-success')); $this->add($submit); }
public function __construct($name = null, $options = null) { parent::__construct('resposta', $options); $this->setInputFilter(new RespostaFilter()); $this->setAttribute('method', 'Post'); $id = new Element\Hidden('id'); $this->add($id); $nome = new Element\Text("nome"); $nome->setAttributes(array('class' => 'form-control', 'placeholder' => 'Entre com a pergunta', 'disabled' => true)); $this->add($nome); $resposta = new Element\Radio('resposta'); $resposta->setValueOptions(array('1' => 'Sim', '0' => 'Não')); $this->add($resposta); $this->add(array('name' => 'submit', 'type' => 'Submit', 'attributes' => array('value' => 'Salvar', 'class' => 'btn btn-success col-xs-6 col-md-5 btnSpacer'))); }
public function init() { $this->setMethod('POST'); $element = new Element\Text('title'); $element->setLabel('Title:'); $element->setRequired(true); $this->addElement($element); $element = new Element\Select('name'); $element->setLabel('Directory:'); $element->setRequired(true); $element->addMultiOptions($this->model->getThemesDirectoriesFromFS()); $this->addElement($element); $element = new Element\Radio('active'); $element->setSeparator(' '); $element->setLabel('Active:'); $element->setValue(false); $element->setMultiOptions(array('1' => 'Yes', '0' => 'No')); $element->setRequired(true); $this->addElement($element); $element = new Element\Text('ordering'); $element->setLabel('Ordering:'); $element->setRequired(true); $this->addElement($element); $element = new Element\Submit('submit'); $element->setLabel('Save'); $element->setIgnore(true); $this->addElement($element); }
public function addElements() { $id = new Element\Text('id'); $id->setLabel('ID')->setAttribute('class', 'form-control')->setAttribute('type', 'hidden'); $this->add($id); $alias = new Element\Text('link'); $alias->setLabel('Slider link')->setAttribute('required', 'true')->setAttribute('class', 'form-control')->setAttribute('id', 'link'); $this->add($alias); $description = new Element\Textarea('text'); $description->setLabel('Text')->setAttribute('class', 'form-control materialize-textarea')->setAttribute('id', 'text'); $this->add($description); $status = new Element\Radio('status'); $status->setLabel('status')->setAttribute('required', 'true')->setValueOptions(array('0' => 'Pause', '1' => 'Active'))->setAttribute('id', 'status'); $this->add($status); $img = new Element\File('img'); $img->setLabel('file img (* not support .png , .gif) ')->setAttribute('class', 'form-control')->setAttribute('type', 'file')->setAttribute('accept', '.jpg, .jpeg, .JPG, .JPEG')->setAttribute('id', 'img'); $this->add($img); }
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'))); }
public function __construct() { parent::__construct('resource'); $this->setAttribute('method', 'post'); $name_resource = new Element\Text('name_resource'); $name_resource->setLabel('Resource')->setAttributes(array('class' => 'form-control input-sm')); $this->add($name_resource); $id_owner = new Element\Text('id_owner'); $id_owner->setLabel('Owner')->setAttributes(array('class' => 'form-control input-sm')); $this->add($id_owner); $description = new Element\Textarea('description'); $description->setLabel('Description')->setAttributes(array('class' => 'form-control input-sm')); $this->add($description); $nid_lov_resourcetype = new Element\Select('nid_lov_resourcetype'); $nid_lov_resourcetype->setLabel('Type')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a type')); $this->add($nid_lov_resourcetype); $nid_timezone = new Element\Select('nid_timezone'); $nid_timezone->setLabel('Time Zone')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a timezone')); $this->add($nid_timezone); $id_locale = new Element\Select('nid_locale'); $id_locale->setLabel('Locale')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a locale')); $this->add($id_locale); $nid_language = new Element\Select('nid_language'); $nid_language->setLabel('Language')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('0' => 'Select a language')); $this->add($nid_language); $num_disp_tab = new Element\Text('num_disp_tab'); $num_disp_tab->setLabel('Number Of Display Tab')->setAttributes(array('class' => 'form-control input-sm')); $this->add($num_disp_tab); $bool_active = new Element\Radio('bool_active'); $bool_active->setLabel('Is Active')->setAttributes(array('class' => 'radio-inline'))->setLabelAttributes(array('style' => 'float:left;width:50px;margin-right:10px'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_active); $bool_root = new Element\Radio('bool_root'); $bool_root->setLabel('Is Root')->setAttributes(array('class' => 'radio-inline'))->setLabelAttributes(array('style' => 'float:left;width:50px;margin-right:10px'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_root); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
protected function addRadio($name, $label, array $data) { $radio = new Element\Radio($name); $radio->setLabel($label); $radio->setLabelAttributes(array('class' => "col-sm-{$this->labelWidth}")); $radio->setValueOptions($data); $radio->setOption('column-size', "sm-{$this->controlWidth}"); $radio->setOption('inline', true); $radio->setOption('disable-twb', true); $this->add($radio); return $this; }
public function prepare() { if ($this->isPrepared) { return $this; } $email = new Email('email'); $email->setLabel('Email'); $password = new Password('password'); $password->setLabel('P2assword'); $member = new Radio('memberOf'); $member->setValueOptions(array('__model.id__' => '__model.name__')); $memberOfTemplate = new TemplateCollection('memberOfTemplate'); $memberOfTemplate->setTargetElement($member); $memberOf = new Fieldset('memberOfGroup'); $memberOf->setLabel('Member of')->add($memberOfTemplate); $submit = new Submit('register'); $submit->setValue('Register'); $this->add($memberOf)->add($submit); return parent::prepare(); }
public function __construct() { parent::__construct('Comment'); $this->add(new Element\Hidden('nid')); $this->add(new Element\Hidden('id_row')); $this->add(new Element\Hidden('target_type_object')); $this->add(new Element\Hidden('target_id_row')); $this->setAttribute('method', 'post'); $comment = new Element\Textarea('Comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $bool_status = new Element\Radio('bool_status'); $bool_status->setLabel('Status')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_status); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function __construct() { parent::__construct('Rating'); $this->add(new Element\Hidden('nid')); $this->add(new Element\Hidden('id_row')); $this->add(new Element\Hidden('target_type_object')); $this->add(new Element\Hidden('target_id_row')); $this->setAttribute('method', 'post'); $rating = new Element\Text('Rating'); $rating->setLabel('Rate')->setAttributes(array('class' => 'tinywhite')); $this->add($rating); $bool_status = new Element\Radio('bool_status'); $bool_status->setLabel('Status')->setLabelAttributes(array('style' => 'float:left;width:50px;margin-right:10px'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_status); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn-success', 'style' => 'margin-right:100px;', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn-success')); $this->add($submit); }
public function __construct($name = NULL) { parent::__construct($name); $this->setAttribute('method', 'post'); $this->add(array('name' => 'nombre', 'options' => array('label' => 'Empresa'), 'attributes' => array('type' => 'text', 'placeholder' => 'Tu Empresa', 'class' => 'input'))); $this->add(array('type' => 'Zend\\Form\\Element\\Email', 'name' => 'email', 'options' => array('label' => 'Email'), 'attributes' => array('placeholder' => '*****@*****.**'))); $this->add(array('type' => 'textarea', 'name' => 'servicios', 'options' => array('label' => 'Servicios'), 'attributes' => array('placeholder' => 'Que ofrece tu empresa', 'rows' => '10'))); $this->add(array('type' => 'submit', 'name' => 'send', 'attributes' => array('value' => 'Publicar', 'class' => 'btn btn-lg btn-primary btn-block'))); $this->add(array('type' => 'file', 'name' => 'file', 'attributes' => array('id' => 'file'))); //* Campo tipo password $this->add(array('name' => 'password', 'options' => array('label' => 'Empresa'), 'attributes' => array('type' => 'password', 'placeholder' => 'password', 'class' => 'input'))); $paquete = new Element\Radio('paquete'); $paquete->setLabel("Paquete:"); $paquete->setValueOptions(array('0' => 'Gratuito :: $0.00', '1' => utf8_encode('Básico :: $50.00 Mensual'), '2' => 'Estandard :: $300.00 Mensual', '3' => 'Premium :: $589.00 Mensual')); $this->add($paquete); $ciudad = new Element\Select('ciudad'); $ciudad->setLabel("Ciudad:"); $ciudad->setEmptyOption('Seleccione la ciudad...'); $ciudad->setValueOptions(array('Xalapa' => 'Xalapa', 'Veracruz' => 'Veracruz', 'Actopan' => 'Actopan', 'Coatzacoalcos' => 'Coatzacoalcos')); $this->add($ciudad); }
/** * Set options for an element. Accepted options are: * - label: label to associate with the element * - label_attributes: attributes to use when the label is rendered * - layouts: list of values and labels for the radio options * * @param array|\Traversable $options Options to set * * @return MainLayout */ public function setOptions($options) { parent::setOptions($options); $value_options = []; if (isset($this->options['layouts'])) { foreach ($this->options['layouts'] as $key => &$layout) { $value_options[$key] = $layout['display']; } } $this->setValueOptions($value_options); return $this; }
/** * @dataProvider useHiddenAttributeDataProvider */ public function testProvidesInputSpecificationThatIncludesValidatorsBasedOnAttributes($useHiddenElement) { $element = new RadioElement(); $options = array('1' => 'Option 1', '2' => 'Option 2', '3' => 'Option 3'); $element->setAttributes(array('options' => $options)); $element->setUseHiddenElement($useHiddenElement); $inputSpec = $element->getInputSpecification(); $this->assertArrayHasKey('validators', $inputSpec); $this->assertInternalType('array', $inputSpec['validators']); $expectedClasses = array('Zend\\Validator\\InArray'); foreach ($inputSpec['validators'] as $validator) { $class = get_class($validator); $this->assertTrue(in_array($class, $expectedClasses), $class); switch ($class) { case 'Zend\\Validator\\InArray': $values = array_values($options); if ($element->useHiddenElement()) { $values[] = $element->getUncheckedValue(); } $this->assertEquals($values, $validator->getHaystack()); break; default: break; } } }
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); }
/** * Categories will be retrieved from the service manager * @param array $captchaOptions */ public function buildForm() { /****************************************************************** * Isto é um exemplo de como realizar a configurações do formulario, * O importante é registrar o campos do formulário pedidos no exercícios **********************************************************************/ // form tag attributes $this->setAttribute('method', 'POST'); // define elements $category = new Element\Select('category'); $category->setLabel('Category')->setValueOptions(array_combine($this->getCategories(), $this->getCategories())); $title = new Element\Text('title'); $title->setLabel('Title')->setAttributes(array('size' => 60, 'maxLength' => 128, 'required' => 'required', 'placeholder' => 'Listing header')); $photo = new Element\Text('photo_filename'); $photo->setLabel('Photo')->setAttribute('maxlength', 1024)->setAttribute('placeholder', 'Enter URL of a JPG'); $price = new Element\Text('price'); $price->setLabel('Price')->setAttribute('title', 'Enter price as nnn.nn')->setAttribute('size', 16)->setAttribute('maxlength', 16)->setAttribute('placeholder', 'Enter some value'); $expires = new Element\Radio('expires'); $expires->setLabel('Expires')->setAttribute('title', 'The expiration date will be calculated from today')->setAttribute('class', 'expiresButton')->setValueOptions($this->getExpireDays()); $city = new Element\Text('cityCode'); $city->setLabel('Nearest City')->setAttribute('title', 'Select the city of the item')->setAttribute('id', 'cityCode')->setAttribute('placeholder', 'Start typing and choose the city'); $name = new Element\Text('contact_name'); $name->setLabel('Contact Name')->setAttribute('title', 'Enter the name of the person to contact for this item')->setAttribute('size', 40)->setAttribute('maxlength', 255); $phone = new Element\Text('contact_phone'); $phone->setLabel('Contact Phone Number')->setAttribute('title', 'Enter the phone number of the person to contact for this item')->setAttribute('size', 20)->setAttribute('maxlength', 32); $email = new Element\Email('contact_email'); $email->setLabel('Contact Email')->setAttribute('title', 'Enter the email address of the person to contact for this item')->setAttribute('size', 40)->setAttribute('maxlength', 255); $description = new Element\Textarea('description'); $description->setLabel('Description')->setAttribute('title', 'Enter a suitable description for this posting')->setAttribute('rows', 4)->setAttribute('cols', 80); $delCode = new Element\Text('delete_code'); $delCode->setLabel('Delete Code')->setAttribute('title', 'Enter the delete code for this item')->setAttribute('size', 16)->setAttribute('maxlength', 16); $captcha = new Element\Captcha('captcha'); $captchaAdapter = new ImageCaptcha(); $captchaAdapter->setWordlen(4)->setOptions($this->captchaOptions); $captcha->setCaptcha($captchaAdapter)->setLabel('Help us to prevent SPAM!')->setAttribute('class', 'captchaStyle')->setAttribute('title', 'Help to prevent SPAM'); $submit = new Element\Submit('submit'); $submit->setAttribute('value', 'Post'); $this->add($category)->add($title)->add($photo)->add($price)->add($expires)->add($city)->add($name)->add($phone)->add($email)->add($description)->add($delCode)->add($captcha)->add($submit); }
public function __construct() { // we want to ignore the name passed parent::__construct('partyaddress'); $this->add(new Element\Hidden('id_party')); $this->add(new Element\Hidden('id_address')); $this->add(new Element\Hidden('num_primary_order')); $this->setAttribute('method', 'post'); $address = new AddressFieldset('address'); $address->getOptions(array('use_as_base_fieldset' => true)); $this->add($address); $nid_lov_addresstype = new Element\Select('nid_lov_addresstype'); $nid_lov_addresstype->setLabel('Address Type')->setAttributes(array('class' => 'form-control input-sm'))->setValueOptions(array('' => 'Select an address type')); $this->add($nid_lov_addresstype); $bool_billing_address = new Element\Radio('bool_billing_address'); $bool_billing_address->setLabel('Is billing address?')->setLabelAttributes(array('class' => 'radio-line'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_billing_address); $bool_shipping_address = new Element\Radio('bool_shipping_address'); $bool_shipping_address->setLabel('Is shipping address?')->setLabelAttributes(array('class' => 'radio-inline'))->setValueOptions(array('1' => 'Yes', '0' => 'No')); $this->add($bool_shipping_address); $flag_status = new Element\Radio('flag_status'); $flag_status->setLabel('Flag')->setLabelAttributes(array('class' => 'radio-inilne'))->setValueOptions(array('1' => 'Active', '0' => 'Not Active')); $this->add($flag_status); $dt_begin = new Element\Date('dt_begin'); $dt_begin->setLabel('Begin Date')->setAttributes(array('class' => 'form-control input-sm', 'type' => 'date', 'id' => 'dt_begin'))->setOptions(array('datepickerOptions' => array('changeYear: true', 'changeMonth: true', 'yearRange: "c-150:c+150"'))); $this->add($dt_begin); $dt_end = new Element\Date('dt_end'); $dt_end->setLabel('End Date')->setAttributes(array('class' => 'form-control input-sm', 'type' => 'date', 'id' => 'dt_end'))->setOptions(array('datepickerOptions' => array('changeYear: true', 'changeMonth: true', 'yearRange: "c-150:c+150"'))); $this->add($dt_end); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'form-control input-sm')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn btn-primary btn-sm', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn btn-primary btn-sm')); $this->add($submit); }
public function __construct() { // we want to ignore the name passed parent::__construct('poxn'); $this->setAttribute('method', 'post'); $this->add(new Element\Hidden('id_organization')); $name_poxn = new Element\Text('name_poxn'); $name_poxn->setLabel('Position (Job Title)')->setAttributes(array('class' => 'largewhite')); $this->add($name_poxn); $nid_lov_poxntype = new \Tee\Form\Element\TreeRadio('nid_lov_poxntype'); $nid_lov_poxntype->setLabel('Position Type')->setAttributes(array('class' => 'medwhite')); $this->add($nid_lov_poxntype); $bool_top_poxn = new Element\Radio('bool_top_poxn'); $bool_top_poxn->setLabel('Is Top Position?')->setLabelAttributes(array('style' => 'float:left;width:80px;margin-right:10px'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_top_poxn); $bool_active = new Element\Radio('bool_active'); $bool_active->setLabel('Active')->setLabelAttributes(array('style' => 'float:left;width:80px;margin-right:10px'))->setValueOptions(array('1' => 'Yes', '0' => 'No'))->setAttributes(array('class' => 'medwhite')); $this->add($bool_active); $nid_timezone = new Element\Select('nid_timezone'); $nid_timezone->setLabel('Time Zone')->setAttributes(array('class' => 'white'))->setValueOptions(array('0' => 'Select a timezone')); $this->add($nid_timezone); $id_locale = new Element\Select('nid_locale'); $id_locale->setLabel('Locale')->setAttributes(array('class' => 'white'))->setValueOptions(array('0' => 'Select a locale')); $this->add($id_locale); $nid_language = new Element\Select('nid_language'); $nid_language->setLabel('Language')->setAttributes(array('class' => 'white'))->setValueOptions(array('0' => 'Select a language')); $this->add($nid_language); $comment = new Element\Textarea('comment'); $comment->setLabel('Comment')->setAttributes(array('class' => 'smallwhite')); $this->add($comment); $back = new Element\Button('back'); $back->setLabel('Back')->setAttributes(array('id' => 'backbutton', 'class' => 'btn-success', 'style' => 'margin-right:100px;', 'onclick' => '')); $this->add($back); $submit = new Element\Submit('submit'); $submit->setValue('Go')->setAttributes(array('id' => 'submitbutton', 'class' => 'btn-success')); $this->add($submit); }