public function init() { parent::init(); $this->setDecorators(array('PrepareElements', array('ViewScript', array('viewScript' => 'form/edit-history-item.phtml')))); /* $instance = new Zend_Form_Element_Select("instance_id"); $instance->setLabel(_("Choose Show Instance")); $instance->setMultiOptions(array("0" => "-----------")); $instance->setValue(0); $instance->setDecorators(array('ViewHelper')); $this->addElement($instance); */ $starts = new Zend_Form_Element_Text(self::ID_PREFIX . 'starts'); $starts->setValidators(array(new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT))); $starts->setAttrib('class', self::TEXT_INPUT_CLASS . " datepicker"); $starts->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT); $starts->addFilter('StringTrim'); $starts->setLabel(_('Start Time')); $starts->setDecorators(array('ViewHelper')); $starts->setRequired(true); $this->addElement($starts); $ends = new Zend_Form_Element_Text(self::ID_PREFIX . 'ends'); $ends->setValidators(array(new Zend_Validate_Date(self::VALIDATE_DATETIME_FORMAT))); $ends->setAttrib('class', self::TEXT_INPUT_CLASS . " datepicker"); $ends->setAttrib('data-format', self::TIMEPICKER_DATETIME_FORMAT); $ends->addFilter('StringTrim'); $ends->setLabel(_('End Time')); $ends->setDecorators(array('ViewHelper')); //$ends->setRequired(true); $this->addElement($ends); }
protected function _periodo_submissao_fim() { $e = new Zend_Form_Element_Text('periodo_submissao_fim'); $e->setLabel(_('Submission ends in') . ":")->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'form-control date'); $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', ''))); return $e; }
public function init() { // profissional_beleza_id $profissional_beleza_id = new Zend_Form_Element_Radio("profissional_beleza_id"); $profissional_beleza_id->setLabel("Selecione o profissional desejado: "); $profissional_beleza_id->setRegisterInArrayValidator(false); $profissional_beleza_id->setRequired(); $profissional_beleza_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // agenda_data $agenda_data = new Zend_Form_Element_Text("agenda_data"); $agenda_data->setLabel("Selecione a data: "); $agenda_data->setAttribs(array('class' => 'form-control', 'autocomplete' => 'off')); $agenda_data->setRequired(); $agenda_data->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // agenda_hora $agenda_hora = new Zend_Form_Element_Select("agenda_hora"); $agenda_hora->setLabel('Selecione a hora: '); $agenda_hora->setAttribs(array('class' => 'form-control')); $agenda_hora->setMultiOptions(array('' => 'Horários')); $agenda_hora->setRequired(); $agenda_hora->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_hora->setRegisterInArrayValidator(false); // agenda_observacao $agenda_observacao = new Zend_Form_Element_Textarea("agenda_observacao"); $agenda_observacao->setLabel("Observações: "); $agenda_observacao->setAttribs(array('class' => 'form-control', 'rows' => 7, 'placeholder' => 'Informe alguma observação, por exemplo, alguma preferência de produto, etc.')); // salao_id $salao_id = new Zend_Form_Element_Hidden('salao_id'); // especialidade_id $especialidade_id = new Zend_Form_Element_Hidden("especialidade_id"); // usuario_id $usuario_id = new Zend_Form_Element_Hidden("usuario_id"); $this->addElements(array($profissional_beleza_id, $agenda_data, $agenda_hora, $agenda_observacao, $salao_id, $especialidade_id, $usuario_id)); parent::init(); }
public function init() { $this->setName('transfer_source'); $this->setAttrib('class', 'form-inline'); $host1 = new Zend_Form_Element_Text('host1'); $host1->setAttrib('class', 'form-control')->setLabel('host1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname'); $edit = new Zend_Form_Element_Hidden('edit'); //$edit->setLabel('Edition Mode'); //$edit->clearDecorators(); $host1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $user1 = new Zend_Form_Element_Text('user1'); $user1->setLabel('user1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress'); $user1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $password1 = new Zend_Form_Element_Text('password1'); $password1->setLabel('pass1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $password1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $action = new Zend_Form_Element_Select('action'); $action->setOptions(array('1' => 'source', '2' => 'target')); $action->setAttrib('class', 'form-control'); $action->options = array('1' => 'source', '2' => 'target'); $action->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-2')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit'); $submit->setAttrib('class', 'btn btn-default'); $submit->setAttrib('value', 'transfer_source'); $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'colspan' => 2, 'align' => 'center')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElements(array($edit, $host1, $user1, $password1, $action, $submit)); $this->setDecorators(array('FormElements', 'Form')); }
protected function _nome_evento() { $e = new Zend_Form_Element_Text('nome_evento'); $e->setLabel(_('Title:'))->setRequired(true)->addValidator('StringLength', false, array(1, 100))->setAttrib("data-required", "true")->setAttrib("data-rangelength", "[1,100]")->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'form-control'); $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', ''))); return $e; }
/** * * Edit Album form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditAlbum.phtml')))); // get group from database $request = Zend_Controller_Front::getInstance()->getRequest(); $album_id = $request->getParam('id'); $Albums = new Application_Model_Albums(); $album = $Albums->getAlbum($album_id); $username_minchars = Zend_Registry::get('config')->get('username_minchars'); $username_maxchars = Zend_Registry::get('config')->get('username_maxchars'); // fields $id = new Zend_Form_Element_Hidden('id'); $id->setValue($album); $album_name = new Zend_Form_Element_Text('album_name'); $album_name->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Album Name'))->setRequired(true)->setValue($album['name'])->setAttrib('class', 'form-control'); $description = new Zend_Form_Element_Textarea('description'); $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($album['description'])->setLabel($this->translator->translate('About this album'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($id, $album_name, $description, $submit)); $this->postInit(); }
/** * @author code generate * @return mixed */ public function __construct($option = array()) { $classId = new Zend_Form_Element_Hidden('UserId'); $classId->setDecorators(array('ViewHelper')); $this->addElement($classId); $email = new Zend_Form_Element_Text('Email'); $email->setLabel('Email *'); $email->addFilter('StringTrim'); $email->setRequired(true); $email->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $email->addValidator(new Zend_Validate_Db_NoRecordExists("Users", "Email")); $email->addValidator('EmailAddress', true); $email->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => "Email không phù hợp"))); $this->addElement($email); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Đăng ký'); $save->setAttrib('class', 'btn btn-primary'); $save->setDecorators(array('ViewHelper')); $this->addElement($save); $reset = new Zend_Form_Element_Reset('Reset'); $reset->setLabel('Làm lại'); $reset->setAttrib('class', 'btn btn-primary'); $reset->setDecorators(array('ViewHelper')); $this->addElement($reset); }
function getForm() { $form = new Cible_Form(array('disabledDefaultActions' => true)); $base_dir = $this->getFrontController()->getBaseUrl(); $redirect = str_replace($base_dir, '', $this->_request->getParam('redirect')); $form->setAction("{$base_dir}/auth/login")->setMethod('post'); $form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); $form->setAttrib('class', 'auth-form'); $username = new Zend_Form_Element_Text('username'); $username->setLabel(Cible_Translation::getCibleText('form_label_username')); $username->setRequired(true); $username->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required')))); $username->setAttrib('class', 'loginTextInput'); $username->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'username')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'openOnly' => true)))); $form->addElement($username); $password = new Zend_Form_Element_Password('password'); $password->setLabel(Cible_Translation::getCibleText('form_label_password')); $password->setRequired(true); $password->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required')))); $password->setAttrib('class', 'loginTextInput'); $password->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'password')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'closeOnly' => true)))); $form->addElement($password); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel(Cible_Translation::getCibleText('button_authenticate'))->setAttrib('class', 'loginButton')->setAttrib('onmouseover', 'this.className=\'loginButtonOver\';')->setAttrib('onmouseout', 'this.className=\'loginButton\';')->removeDecorator('label')->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2', 'align' => 'right', 'class' => 'submit')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $form->addElement($submit); $redirect_hidden = new Zend_Form_Element_Hidden('redirect'); $redirect_hidden->setValue($redirect)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $form->addElement($redirect_hidden); return $form; }
public function init() { $this->setName('param'); $this->setAttrib('class', 'form-inline'); $host1 = new Zend_Form_Element_Text('host1'); $host1->setAttrib('class', 'form-control')->setLabel('host1')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname'); $host1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row form-inline', 'openOnly' => true)))); $user1 = new Zend_Form_Element_Text('user1'); $user1->setLabel('user1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress'); $user1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')))); $password1 = new Zend_Form_Element_Text('password1'); $password1->setLabel('pass1')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $password1->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'closeOnly' => 'true')))); $host2 = new Zend_Form_Element_Text('host2'); $host2->setAttrib('class', 'form-control')->setLabel('host2')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Hostname'); $host2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'row', 'openOnly' => true)))); $user2 = new Zend_Form_Element_Text('user2'); $user2->setLabel('user2')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('EmailAddress'); $user2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')))); $password2 = new Zend_Form_Element_Text('password2'); $password2->setLabel('pass2')->setAttrib('class', 'form-control')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty'); $password2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'closeOnly' => 'true')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit'); $submit->setAttrib('class', 'btn btn-default'); $submit->setAttrib('value', 'transfer_source'); $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'col-md-4 col-md-offset-4 text-center')))); $this->addElements(array($host1, $user1, $password1, $host2, $user2, $password2, $submit)); $this->setDecorators(array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-inline')), 'Form')); }
/** * * Change network background * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsBackground.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $background_image = new Zend_Form_Element_File('background'); $background_image->setDecorators(array('File', 'Errors'))->setLabel($this->translator->translate('Choose Picture (jpg, png or gif)'))->addValidator('Extension', false, 'jpg,jpeg,png,gif'); $background_color = new Zend_Form_Element_Text('background_color'); $background_color->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue(isset($all_meta['background_color']) ? $all_meta['background_color'] : 'ff0000')->setErrorMessages(array($this->translator->translate('Please pick a color')))->setLabel($this->translator->translate('Background Color'))->setRequired(true)->setAttrib('class', 'form-control colorpicker-input'); $background_repeat = new Zend_Form_Element_Checkbox('background_repeat'); $background_repeat->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_repeat']) && $all_meta['background_repeat'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Repeat background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_scroll = new Zend_Form_Element_Checkbox('background_scroll'); $background_scroll->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_scroll']) && $all_meta['background_scroll'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Scroll background'))->setCheckedValue("1")->setUncheckedValue("0"); $background_stretch = new Zend_Form_Element_Checkbox('background_stretch'); $background_stretch->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_stretch']) && $all_meta['background_stretch'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Stretch background'))->setCheckedValue("1")->setUncheckedValue("0"); $disable_image = new Zend_Form_Element_Checkbox('background_noimage'); $disable_image->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['background_noimage']) && $all_meta['background_noimage'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Disable custom image'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($background_image, $background_repeat, $background_scroll, $background_stretch, $disable_image, $background_color, $submit)); $this->postInit(); }
public function init() { $this->setName('transfer_target'); $this->setAttrib('class', 'form-inline'); $id = new Zend_Form_Element_Hidden('id'); $id->addFilter('Int'); $host2 = new Zend_Form_Element_Text('host2'); $host2->setAttrib('class', 'form-control')->setLabel('host2'); $host2->setDecorators(array('ViewHelper', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $user2 = new Zend_Form_Element_Text('user2'); $user2->setLabel('user2'); $user2->setAttrib('class', 'form-control'); $user2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $password2 = new Zend_Form_Element_Text('password2'); $password2->setLabel('pass2'); $password2->setAttrib('class', 'form-control'); $password2->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group col-md-3')))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Submit'); $submit->setAttrib('class', 'btn btn-default'); $submit->setValue('transfer_target'); $submit->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'div', 'colspan' => 2, 'align' => 'center')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $this->addElements(array($host2, $user2, $password2, $submit)); $this->setDecorators(array('FormElements', 'Form')); }
protected function _assinatura_email() { $e = new Zend_Form_Element_Text('assinatura_email'); $e->setLabel('E-mail da assinatura:')->addValidator('StringLength', false, array(1, 70))->addValidator('EmailAddress', TRUE)->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'ex. seuemail@host.com.br'); $e->setDecorators(array('ViewHelper', 'Description', 'Errors', array('HtmlTag', ''), array('Label', ''))); return $e; }
/** * * Themes & styles * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/SettingsStyles.phtml')))); // load settings $AppOptions = new Application_Model_AppOptions(); $all_meta = $AppOptions->getAllOptions(); // fields $themes_array = array('/bootstrap/css/bootstrap.min.css' => 'Bootstrap'); $css_theme = new Zend_Form_Element_Select('css_theme'); $css_theme->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($themes_array)->setErrorMessages(array($this->translator->translate('Please select')))->setLabel($this->translator->translate('Choose css theme'))->setRequired(true)->setValue(isset($all_meta['css_theme']) ? $all_meta['css_theme'] : 'bootstrap')->setAttrib('class', 'form-control'); $wide_layout = new Zend_Form_Element_Checkbox('wide_layout'); $wide_layout->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['wide_layout']) && $all_meta['wide_layout'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Extra-wide layout on large screens'))->setCheckedValue("1")->setUncheckedValue("0"); $cover_ysize = new Zend_Form_Element_Text('cover_ysize'); $cover_ysize->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Cover image height'))->setValidators(array('digits'))->setRequired(true)->setValue(isset($all_meta['cover_ysize']) ? $all_meta['cover_ysize'] : '220')->setAttrib('class', 'form-control'); $user_background = new Zend_Form_Element_Checkbox('user_background'); $user_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['user_background']) && $all_meta['user_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Users can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $subscriber_background = new Zend_Form_Element_Checkbox('subscriber_background'); $subscriber_background->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($all_meta['subscriber_background']) && $all_meta['subscriber_background'] == 1 ? 1 : 0)->setLabel($this->translator->translate('Subscribers can have custom background image'))->setCheckedValue("1")->setUncheckedValue("0"); $custom_css = new Zend_Form_Element_Textarea('css_custom'); $custom_css->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '15')->setValue(isset($all_meta['css_custom']) ? $all_meta['css_custom'] : '')->setLabel($this->translator->translate('Custom css'))->setAttrib('class', 'form-control'); $submit = new Zend_Form_Element_Submit('submitbtn'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($css_theme, $wide_layout, $cover_ysize, $user_background, $subscriber_background, $custom_css, $submit)); $this->postInit(); }
public function init() { $this->setMethod('post'); $this->setAction('/login'); $this->setOptions(array('class' => 'niceform', 'id' => 'form1')); $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form')); //$this->getDecorator('HtmlTag')->setOptions(array('tag' => 'fieldset')); /*$this->setDecorators(array( 'Errors', 'FormElements', array('HtmlTag', array('tag' => 'fieldset')), 'Form' ));*/ $username = new Zend_Form_Element_Text('username'); $username->setLabel('username'); $username->setRequired(true); $username->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))); $pass = new Zend_Form_Element_Password('password'); $pass->setlabel('password'); $pass->setRequired(true); $pass->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))); /* $pass->setDecorators(array( 'ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')), )); */ $submit = new Zend_Form_Element_Submit('login'); $submit->setLabel('login'); $submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))); $this->addElements(array($username, $pass, $submit)); }
public function init() { // contato_nome $contato_nome = new Zend_Form_Element_Text("contato_nome"); $contato_nome->setLabel("Nome"); $contato_nome->setRequired(); $contato_nome->setAttribs(array('class' => 'form-control')); $contato_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // contato_email $contato_email = new Zend_Form_Element_Text("contato_email"); $contato_email->setLabel("E-mail"); $contato_email->setRequired(); $contato_email->setAttribs(array('class' => 'form-control')); $contato_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // contato_assunto $contato_assunto = new Zend_Form_Element_Select("contato_assunto"); $contato_assunto->setLabel("Assunto"); $contato_assunto->setRequired(); $contato_assunto->setAttribs(array('class' => 'form-control')); $contato_assunto->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $contato_assunto->setMultiOptions(array("" => "Selecione o assunto...", "Informação" => "Informação", "Elogio" => "Eologio", "Crítica" => "Crítica", "Sugestão" => "Sugestão", "Outros" => "Outros")); // contato_mensagem $contato_mensagem = new Zend_Form_Element_Textarea("contato_mensagem"); $contato_mensagem->setLabel("mensagem"); $contato_mensagem->setRequired(); $contato_mensagem->setAttribs(array('class' => 'form-control', 'rows' => 5)); $contato_mensagem->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $this->addElements(array($contato_nome, $contato_email, $contato_assunto, $contato_mensagem)); parent::init(); }
public function init() { // attribs $this->setAttribs(array('id' => 'form-site-contato')); $this->setMethod('post'); $this->setAction('contato/'); // contato_nome $contato_nome = new Zend_Form_Element_Text('contato_nome'); $contato_nome->setLabel("Nome:"); $contato_nome->setRequired(); $contato_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $contato_nome->setAttrib('class', 'form-control'); $contato_nome->setAttrib('placeholder', 'Informe seu nome'); $contato_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // contato_email $contato_email = new Zend_Form_Element_Text('contato_email'); $contato_email->setLabel("E-mail:"); $contato_email->setRequired(); $contato_email->addErrorMessages(array(Zend_Validate_EmailAddress::INVALID => "Email inválido!")); $contato_email->addValidator('EmailAddress'); $contato_email->setAttrib('class', 'form-control'); $contato_email->setAttrib('placeholder', 'Informe seu email'); $contato_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // contato_mensagem $contato_mensagem = new Zend_Form_Element_Textarea('contato_mensagem'); $contato_mensagem->setLabel("Mensagem:"); $contato_mensagem->setRequired(); $contato_mensagem->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $contato_mensagem->setAttrib('class', 'form-control'); $contato_mensagem->setAttrib('placeholder', 'Digite aqui sua mensagem'); $contato_mensagem->setAttrib('rows', 5); $contato_mensagem->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $this->addElements(array($contato_nome, $contato_email, $contato_mensagem)); parent::init(); }
public function init() { $this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/add-show-rebroadcast.phtml')))); $relativeDates = array(); $relativeDates[""] = ""; for ($i = 0; $i <= 30; $i++) { $relativeDates["{$i} days"] = "+{$i} " . _("days"); } for ($i = 1; $i <= 10; $i++) { $select = new Zend_Form_Element_Select("add_show_rebroadcast_date_{$i}"); $select->setAttrib('class', 'input_select'); $select->setMultiOptions($relativeDates); $select->setRequired(false); $select->setDecorators(array('ViewHelper')); $this->addElement($select); $text = new Zend_Form_Element_Text("add_show_rebroadcast_time_{$i}"); $text->setAttrib('class', 'input_text'); $text->addFilter('StringTrim'); $text->addValidator('date', false, array('HH:mm')); $text->addValidator('regex', false, array('/^[0-2]?[0-9]:[0-5][0-9]$/', 'messages' => _('Invalid character entered'))); $text->setRequired(false); $text->setDecorators(array('ViewHelper')); $this->addElement($text); } }
/** * * Edit Group form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname)); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/EditGroup.phtml')))); // get group from database $request = Zend_Controller_Front::getInstance()->getRequest(); $group = $request->getParam('name'); $Profiles = new Application_Model_Profiles(); $ProfilesMeta = new Application_Model_ProfilesMeta(); $profile = $Profiles->getProfile($group, false, true); $owners_profile = $Profiles->getProfileByField('id', $profile->owner); $username_minchars = Zend_Registry::get('config')->get('username_minchars'); $username_maxchars = Zend_Registry::get('config')->get('username_maxchars'); // fields $id = new Zend_Form_Element_Hidden('id'); $id->setValue($profile->id); $name = new Zend_Form_Element_Text('name'); $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Group Name'))->setValue($profile->name)->setIgnore(true)->setAttrib('readonly', true)->setAttrib('class', 'form-control'); $screenname = new Zend_Form_Element_Text('screen_name'); $screenname->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringTrim')->setValue($profile->screen_name)->addValidator('alnum', false, array('allowWhiteSpace' => true))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid name between %d and %d characters'), $username_minchars, $username_maxchars)))->setLabel($this->translator->translate('Screen Name'))->setRequired(true)->setAttrib('class', 'form-control'); $description = new Zend_Form_Element_Textarea('description'); $description->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('COLS', '')->setAttrib('ROWS', '4')->addFilter('StripTags')->setValue($ProfilesMeta->getMetaValue('description', $profile->id))->setLabel($this->translator->translate('About this group'))->setAttrib('class', 'form-control'); $profile_privacy = new Zend_Form_Element_Select('profile_privacy'); $profile_privacy->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(Zend_Registry::get('group_privacy_array'))->setErrorMessages(array($this->translator->translate('Select group visibility')))->setLabel($this->translator->translate('Select group visibility'))->setRequired(true)->setValue($profile->profile_privacy)->setAttrib('class', 'form-control'); $is_hidden = new Zend_Form_Element_Checkbox('is_hidden'); $is_hidden->setDecorators(array('ViewHelper', 'Errors'))->setValue(isset($profile->is_hidden) && $profile->is_hidden == 1 ? 1 : 0)->setLabel($this->translator->translate('Remove?'))->setCheckedValue("1")->setUncheckedValue("0"); $submit = new Zend_Form_Element_Submit('formsubmit'); $submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Save'))->setAttrib('class', 'submit btn btn-default'); $this->addElements(array($id, $name, $screenname, $profile_privacy, $description, $is_hidden, $submit)); $this->postInit(); }
public function init() { // salao_funcionamento_segunda_abertura $salao_funcionamento_segunda_abertura = new Zend_Form_Element_Text("salao_funcionamento_segunda_abertura"); $salao_funcionamento_segunda_abertura->setLabel("Abertura: "); $salao_funcionamento_segunda_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_segunda_abertura->setAttribs(array('class' => 'form-control')); $salao_funcionamento_segunda_abertura->addFilter(new Zend_Filter_Null()); // salao_funcionamento_segunda_fechamento $salao_funcionamento_segunda_fechamento = new Zend_Form_Element_Text("salao_funcionamento_segunda_fechamento"); $salao_funcionamento_segunda_fechamento->setLabel("Fechamento: "); $salao_funcionamento_segunda_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_segunda_fechamento->setAttribs(array('class' => 'form-control')); $salao_funcionamento_segunda_fechamento->addFilter(new Zend_Filter_Null()); // salao_funcionamento_abertura $salao_funcionamento_abertura = new Zend_Form_Element_Text("salao_funcionamento_abertura"); $salao_funcionamento_abertura->setLabel("Abertura: "); $salao_funcionamento_abertura->setRequired(); $salao_funcionamento_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_abertura->setAttribs(array('class' => 'form-control')); // salao_funcionamento_fechamento $salao_funcionamento_fechamento = new Zend_Form_Element_Text("salao_funcionamento_fechamento"); $salao_funcionamento_fechamento->setLabel("Fechamento: "); $salao_funcionamento_fechamento->setRequired(); $salao_funcionamento_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_fechamento->setAttribs(array('class' => 'form-control')); // salao_funcionamento_sabado_abertura $salao_funcionamento_sabado_abertura = new Zend_Form_Element_Text("salao_funcionamento_sabado_abertura"); $salao_funcionamento_sabado_abertura->setLabel("Fechamento: "); //$salao_funcionamento_sabado_abertura->setRequired(); $salao_funcionamento_sabado_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_sabado_abertura->setAttribs(array('class' => 'form-control')); $salao_funcionamento_sabado_abertura->addFilter(new Zend_Filter_Null()); // salao_funcionamento_sabado_fechamento $salao_funcionamento_sabado_fechamento = new Zend_Form_Element_Text("salao_funcionamento_sabado_fechamento"); $salao_funcionamento_sabado_fechamento->setLabel("Fechamento: "); //$salao_funcionamento_sabado_fechamento->setRequired(); $salao_funcionamento_sabado_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_sabado_fechamento->setAttribs(array('class' => 'form-control')); $salao_funcionamento_sabado_fechamento->addFilter(new Zend_Filter_Null()); // salao_funcionamento_domingo_abertura $salao_funcionamento_domingo_abertura = new Zend_Form_Element_Text("salao_funcionamento_domingo_abertura"); $salao_funcionamento_domingo_abertura->setLabel("Fechamento: "); //$salao_funcionamento_domingo_abertura->setRequired(); $salao_funcionamento_domingo_abertura->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_domingo_abertura->setAttribs(array('class' => 'form-control')); $salao_funcionamento_domingo_abertura->addFilter(new Zend_Filter_Null()); // salao_funcionamento_domingo_fechamento $salao_funcionamento_domingo_fechamento = new Zend_Form_Element_Text("salao_funcionamento_domingo_fechamento"); $salao_funcionamento_domingo_fechamento->setLabel("Fechamento: "); //$salao_funcionamento_domingo_fechamento->setRequired(); $salao_funcionamento_domingo_fechamento->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_funcionamento_domingo_fechamento->setAttribs(array('class' => 'form-control')); $salao_funcionamento_domingo_fechamento->addFilter(new Zend_Filter_Null()); $this->addElement('hidden', 'salao_id', array('value' => Zend_Auth::getInstance()->getIdentity()->salao_id)); $this->addElements(array($salao_funcionamento_segunda_abertura, $salao_funcionamento_segunda_fechamento, $salao_funcionamento_abertura, $salao_funcionamento_fechamento, $salao_funcionamento_sabado_abertura, $salao_funcionamento_sabado_fechamento, $salao_funcionamento_domingo_abertura, $salao_funcionamento_domingo_fechamento)); parent::init(); }
public function init() { // projeto_id $projeto_id = new Zend_Form_Element_Select("projeto_id"); $projeto_id->setLabel("Projeto: "); $projeto_id->setAttribs(array('class' => 'form-control')); $projeto_id->setMultiOptions($this->getProjetos()); // cliente_id $cliente_id = new Zend_Form_Element_Select("cliente_id"); $cliente_id->setLabel("Cliente: "); $cliente_id->setAttribs(array('class' => 'form-control')); $cliente_id->setRequired(false); $cliente_id->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $cliente_id->setMultiOptions($this->getClientes()); // faturamento_tipo $faturamento_tipo = new Zend_Form_Element_Select("faturamento_tipo"); $faturamento_tipo->setLabel("Tipo: "); $faturamento_tipo->setAttribs(array('class' => 'form-control')); $faturamento_tipo->setRequired(false); $faturamento_tipo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $faturamento_tipo->setMultiOptions(array(1 => 'Boleto', 2 => 'Transferência')); // faturamento_valor $faturamento_valor = new Zend_Form_Element_Text("faturamento_valor"); $faturamento_valor->setLabel("Valor: "); $faturamento_valor->setAttribs(array('class' => 'form-control')); //$faturamento_valor->setRequired(); $faturamento_valor->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // faturamento_descricao $faturamento_descricao = new Zend_Form_Element_Text("faturamento_descricao"); $faturamento_descricao->setLabel("Descrição: "); $faturamento_descricao->setAttribs(array('class' => 'form-control')); $faturamento_descricao->setRequired(); $faturamento_descricao->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // faturamento_nosso_numero $faturamento_nosso_numero = new Zend_Form_Element_Text("faturamento_nosso_numero"); $faturamento_nosso_numero->setLabel("Nosso Nº: "); $faturamento_nosso_numero->setAttribs(array('class' => 'form-control')); //$faturamento_nosso_numero->setRequired(); $faturamento_nosso_numero->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // faturamento_vencimento $faturamento_vencimento = new Zend_Form_Element_Text("faturamento_vencimento"); $faturamento_vencimento->setLabel("Vencimento: "); $faturamento_vencimento->setAttribs(array('class' => 'form-control')); $faturamento_vencimento->setRequired(); $faturamento_vencimento->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // faturamento_nota_fiscal $faturamento_nota_fiscal = new Zend_Form_Element_File("faturamento_nota_fiscal"); $faturamento_nota_fiscal->setLabel("Nota Fiscal:"); $faturamento_nota_fiscal->addDecorators(App_Forms_Decorators::$ElementDecoratorFile); $faturamento_nota_fiscal->setAttribs(array('class' => 'filestyle', 'data-buttonText' => 'Selecione a Nota Fiscal', 'data-iconName' => 'fa fa-file')); //$faturamento_nota_fiscal->setRequired(); $faturamento_nota_fiscal->setDestination(Zend_Registry::get('config')->notafiscal->filepath); $faturamento_nota_fiscal->addValidators(array(array('Extension', false, 'pdf'))); $this->addElements(array($projeto_id, $cliente_id, $faturamento_tipo, $faturamento_vencimento, $faturamento_valor, $faturamento_nosso_numero, $faturamento_descricao, $faturamento_nota_fiscal)); parent::init(); }
public function indexAction() { // action body $idEncuesta = $this->getParam("idEncuesta"); $encuesta = $this->encuestaDAO->obtenerEncuesta($idEncuesta); $secciones = $this->seccionDAO->obtenerSecciones($idEncuesta); $formulario = new Zend_Form($encuesta->getHash()); //debemos agregar a este formulario campos para identificar quien es el que esta llenando esta encuesta $eSubCabecera = new Zend_Form_SubForm(); $eSubCabecera->setLegend("Datos Personales: "); $eEncuesta = new Zend_Form_Element_Hidden("idEncuesta"); $eEncuesta->setValue($idEncuesta); $eReferencia = new Zend_Form_Element_Text("referencia"); $eReferencia->setLabel("Boleta o Clave : "); $eReferencia->setAttrib("class", "form-control"); $eReferencia->setDecorators($this->decoratorsPregunta); $eSubCabecera->addElements(array($eEncuesta, $eReferencia)); $eSubCabecera->setDecorators($this->decoratorsSeccion); $formulario->addSubForm($eSubCabecera, "referencia"); //============================================= Iteramos a traves de las secciones del grupo foreach ($secciones as $seccion) { //============================================= Cada seccion es una subforma $subFormSeccion = new Zend_Form_SubForm($seccion->getHash()); $subFormSeccion->setLegend("Sección: " . $seccion->getNombre()); //============================================= Obtenemos los elemntos de la seccion $elementos = $this->seccionDAO->obtenerElementos($seccion->getIdSeccion()); foreach ($elementos as $elemento) { //============================================= Verificamos que tipo de elemento es if ($elemento instanceof Encuesta_Model_Pregunta) { //============================================= Aqui ya la agregamos a la seccion $this->agregarPregunta($subFormSeccion, $elemento); } elseif ($elemento instanceof Encuesta_Model_Grupo) { //============================================= un grupo es otra subform $subFormGrupo = new Zend_Form_SubForm($elemento->getHash()); $subFormGrupo->setLegend("Grupo: " . $elemento->getNombre()); $preguntasGrupo = $this->grupoDAO->obtenerPreguntas($elemento->getIdGrupo()); foreach ($preguntasGrupo as $pregunta) { //============================================= Aqui ya la agregamos al grupo $this->agregarPregunta($subFormGrupo, $pregunta); } $subFormGrupo->setDecorators($this->decoratorsGrupo); $subFormSeccion->addSubForm($subFormGrupo, $elemento->getIdGrupo()); } } $subFormSeccion->setDecorators($this->decoratorsSeccion); $formulario->addSubForm($subFormSeccion, $seccion->getIdSeccion()); } $eSubmit = new Zend_Form_Element_Submit("submit"); $eSubmit->setLabel("Enviar Encuesta"); $eSubmit->setAttrib("class", "btn btn-success"); $formulario->addElement($eSubmit); $formulario->setDecorators($this->formDecorators); $this->view->encuesta = $encuesta; $this->view->formulario = $formulario; }
public function init() { // proposta_id /* $proposta_id = new Zend_Form_Element_Select("proposta_id"); $proposta_id->setLabel("Proposta: "); $proposta_id->setAttribs(array( 'class' => 'form-control' )); $proposta_id->setMultiOptions($this->getPropostas()); */ // cliente $cliente = new Zend_Form_Element_Select("cliente"); $cliente->setLabel("Cliente: "); $cliente->setAttribs(array('class' => 'form-control')); $cliente->setRequired(false); $cliente->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); $cliente->setMultiOptions($this->getClientes()); // cliente_id $cliente_id = new Zend_Form_Element_Hidden("cliente_id"); // projeto_nome $projeto_nome = new Zend_Form_Element_Text("projeto_nome"); $projeto_nome->setLabel("Nome: "); $projeto_nome->setAttribs(array('class' => 'form-control')); $projeto_nome->setRequired(); $projeto_nome->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); // projeto_horas /* $projeto_horas = new Zend_Form_Element_Text("projeto_horas"); $projeto_horas->setLabel("Horas: "); $projeto_horas->setAttribs(array( 'class' => 'form-control', 'readonly' => true )); $projeto_horas->setRequired(); $projeto_horas->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); */ // projeto_valor /* $projeto_valor = new Zend_Form_Element_Text("projeto_valor"); $projeto_valor->setLabel("Valor: "); $projeto_valor->setAttribs(array( 'class' => 'form-control', 'readonly' => true )); $projeto_valor->setRequired(); $projeto_valor->setDecorators(App_Forms_Decorators::$checkboxElementDecorators); */ /** * Add Elements */ $this->addElements(array($cliente, $cliente_id, $projeto_nome)); parent::init(); }
public function init() { // email $email = new Zend_Form_Element_Text("email"); $email->setLabel('E-mail: '); $email->setRequired(); $email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o email cadastrado')); $this->addElements(array($email)); parent::init(); }
public function init() { /* $email = $this->addElement('text', 'email', array( 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( 'EmailAddress', ), 'required' => true, 'label' => $this->translate->_("Email"), 'decorators' => $this->elementDecorators, 'description'=>"mustbe lower..." )); */ $email = new Zend_Form_Element_Text("email"); $email->setLabel('Email'); $email->setDecorators($this->elementDecorators); $email->addValidator("EmailAddress"); $email->addValidator("ExistUser", false, array("email")); $email->addPrefixPath('VC_Validate', 'VC/Validate/', 'validate'); $this->addElements(array($email)); /*$username = $this->addElement('text', 'username', array( 'filters' => array('StringTrim', 'StringToLower'), 'validators' => array( 'Alpha', array('StringLength', false, array(3, 20)), ), 'required' => true, 'label' => $this->translate->_("Username"), 'decorators' => $this->elementDecorators, )); */ $token = $this->addElement('hidden', 'token', array('disableLoadDefaultDecorators' => true)); $password = $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(6, 20))), 'required' => true, 'label' => $this->translate->_("Password"), 'decorators' => $this->elementDecorators)); /* $re_password = $this->addElement('password', 'password_confirm', array( 'filters' => array('StringTrim'), 'validators' => array( array('SL_ValidatorMatch', false, array("password")), ), 'required' => true, 'label' => $this->translate->_("Confirm password"), 'decorators' => $this->elementDecorators, )); */ $re_password = new Zend_Form_Element_Password("password_confirm"); $re_password->setLabel('Confirm Password'); $re_password->setDecorators($this->elementDecorators); $re_password->addValidator("PasswordConfirmation", false, array("password")); $re_password->addPrefixPath('VC_Validate', 'VC/Validate/', 'validate'); $this->addElements(array($re_password)); $username = $this->addElement('text', 'fullname', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(3, 70))), 'required' => true, 'label' => $this->translate->_("Full name"), 'decorators' => $this->elementDecorators)); // Add a captcha $this->addElement('captcha', 'captcha', array('label' => $this->translate->_("Please enter the 5 letters displayed below:"), 'required' => true, 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 5, 'timeout' => 300))); $login = $this->addElement('submit', 'login', array('required' => false, 'ignore' => true, 'label' => $this->translate->_("Register"), 'decorators' => $this->buttonDecorators)); }
/** * @author code generate * @return mixed */ public function __construct($option = array()) { $contactId = new Zend_Form_Element_Hidden('ContactId'); $contactId->setDecorators(array('ViewHelper')); $this->addElement($contactId); $contactName = new Zend_Form_Element_Text('ContactName'); $contactName->setLabel('Họ tên *'); $contactName->addFilter('StringTrim'); $contactName->setRequired(true); $contactName->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactName->addValidator('stringLength', false, array(1, 50, "messages" => " dài tối đa 50 ký tự")); $this->addElement($contactName); $userId = new Zend_Form_Element_Text('UserId'); $userId->setLabel('UserId'); $userId->addFilter('StringTrim'); $userId->setAttrib('disabled', true); $userId->setDecorators(array('ViewHelper')); $this->addElement($userId); $contactPhone = new Zend_Form_Element_Text('ContactPhone'); $contactPhone->setLabel('Điện thoại *'); $contactPhone->addFilter('StringTrim'); $contactPhone->setRequired(true); $contactPhone->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactPhone->addValidator('stringLength', false, array(1, 15, "messages" => " dài tối đa 50 ký tự")); $this->addElement($contactPhone); $contactTitle = new Zend_Form_Element_Text('ContactTitle'); $contactTitle->setLabel('Tiêu đề *'); $contactTitle->addFilter('StringTrim'); $contactTitle->setRequired(true); $contactTitle->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactTitle->addValidator('stringLength', false, array(1, 250, "messages" => " dài tối đa 250 ký tự")); $this->addElement($contactTitle); $contactContent = new Zend_Form_Element_Textarea('ContactContent'); $contactContent->setLabel('Nội dung *'); $contactContent->setRequired(true); $contactContent->setOptions(array('cols' => '10', 'rows' => '4')); $contactContent->setDecorators(array('ViewHelper', array(array('control' => 'HtmlTag'), array('tag' => 'div', 'class' => 'element-control')), array('Label', array('class' => 'col-lg-2 control-label')), array(array('controls' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group')))); $contactPhone->addValidator('stringLength', false, array(1, 2000, "messages" => " dài tối đa 2000 ký tự")); $this->addElement($contactContent); $save = new Zend_Form_Element_Submit('Save'); $save->setLabel('Gửi'); $save->setAttrib('class', 'btn btn-primary'); $save->setDecorators(array('ViewHelper')); $this->addElement($save); $reset = new Zend_Form_Element_Reset('Reset'); $reset->setLabel('Làm lại'); $reset->setAttrib('class', 'btn btn-primary'); $reset->setDecorators(array('ViewHelper')); $this->addElement($reset); }
/** * * Lost password form * */ public function init() { $cname = explode('_', get_class()); $this->preInit(end($cname), true, false); // use template file $this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/LostPassword.phtml')))); // fields $name = new Zend_Form_Element_Text('name'); $name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Username or email'))->setErrorMessages(array($this->translator->translate('Please enter your name or email')))->setRequired(true)->setAttrib('class', 'form-control'); $login = new Zend_Form_Element_Submit('lostpasswordsubmit'); $login->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Send me the link'))->setAttrib('class', 'submit btn btn-info'); $this->addElements(array($name, $login)); $this->postInit(); }
public function init() { // initialize form $this->setAction('/catalog/video/search')->setMethod('get'); // create text input for keywords $query = new Zend_Form_Element_Text('q'); $query->setLabel('Keywords:')->setOptions(array('size' => '20'))->addFilter('HtmlEntities')->addFilter('StringTrim'); $query->setDecorators(array(array('ViewHelper'), array('Errors'), array('Label', array('tag' => '<span>')))); // create submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel('Search')->setOptions(array('class' => 'submit')); $submit->setDecorators(array(array('ViewHelper'))); // attach elements to form $this->addElement($query)->addElement($submit); }
public function init() { // administrador_email $administrador_email = new Zend_Form_Element_Text('administrador_email'); $administrador_email->setRequired(); $administrador_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $administrador_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); // administrador_senha $administrador_senha = new Zend_Form_Element_Password('administrador_senha'); $administrador_senha->setRequired(); $administrador_senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $administrador_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua senha')); $this->addElements(array($administrador_email, $administrador_senha)); parent::init(); }
public function init() { // especialidade_id $especialidade_id = new Zend_Form_Element_Select("especialidade_id"); $especialidade_id->setLabel('Especialidade: '); $especialidade_id->setRequired(); $especialidade_id->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $especialidade_id->setMultiOptions($this->getEspecialidades()); $especialidade_id->setAttribs(array('class' => 'form-control')); // profissional_beleza_id $profissional_beleza_id = new Zend_Form_Element_Select("profissional_beleza_id"); $profissional_beleza_id->setLabel('Profissional: '); $profissional_beleza_id->setRequired(); $profissional_beleza_id->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $profissional_beleza_id->setMultiOptions($this->getProfissionaisBeleza()); $profissional_beleza_id->setAttribs(array('class' => 'form-control')); // agenda_data $agenda_data = new Zend_Form_Element_Text("agenda_data"); $agenda_data->setLabel('Data: '); $agenda_data->setRequired(); $agenda_data->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_data->setAttribs(array('class' => 'form-control', 'autocomplete' => 'off')); // agenda_horario $agenda_horario = new Zend_Form_Element_Text("agenda_horario"); $agenda_horario->setLabel('Horário: '); $agenda_horario->setRequired(); $agenda_horario->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_horario->setAttribs(array('class' => 'form-control')); // agenda_manual_nome $agenda_manual_nome = new Zend_Form_Element_Text("agenda_manual_nome"); $agenda_manual_nome->setLabel('Cliente: '); $agenda_manual_nome->setRequired(); $agenda_manual_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_manual_nome->setAttribs(array('class' => 'form-control')); // agenda_manual_email $agenda_manual_email = new Zend_Form_Element_Text("agenda_manual_email"); $agenda_manual_email->setLabel('E-mail: '); //$agenda_manual_email->setRequired(); $agenda_manual_email->setAttribs(array('class' => 'form-control')); // agenda_manual_telefone $agenda_manual_telefone = new Zend_Form_Element_Text("agenda_manual_telefone"); $agenda_manual_telefone->setLabel('Telefone: '); $agenda_manual_telefone->setRequired(); $agenda_manual_telefone->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $agenda_manual_telefone->setAttribs(array('class' => 'form-control')); $this->addElements(array($especialidade_id, $profissional_beleza_id, $agenda_data, $agenda_horario, $agenda_manual_nome, $agenda_manual_email, $agenda_manual_telefone)); parent::init(); }
/** * Генерирует форму для заполнения доп данных * @return Zend_Form $form Форма для завершения регистрации */ public function getForm($params) { $form = new Zend_Form(); // Устанавливаем декораторы $form->setAction($form->getView()->url($params, 'auth_openid_complete'))->setAttrib('id', 'zend_form'); //Email $email = new Zend_Form_Element_Text('email'); $email->setRequired(true)->addValidator('EmailAddress', false, array('domain' => false))->addValidator(new ZendExtra_Validate_Email())->setOptions(array('domain' => false))->setLabel('Email:')->setDescription($form->getView()->translate('Enter email for recieving password'))->setAttrib('onBlur', 'validate(this);'); $form->addElement($email); // Кнопка "Отправить" $submit = new Zend_Form_Element_Text('submit'); $html = '<dt></dt><dd><a class="btn-base btn-normal" href="javascript:;" onClick=\'$("#zend_form").submit();\'><span></span>' . $form->getView()->translate('submit') . '</a></dd>'; $submit->setDecorators(array('decorator' => array('br' => new ZendExtra_Form_Decorator_HtmlCode(array('tag' => $html, 'placement' => Zend_Form_Decorator_Abstract::PREPEND)))))->setOrder(100); $form->addElement($submit); return $form; }