public function init() { $country_code = new Zend_Form_Element_Text('country_code'); $country_code->setLabel('Country code'); $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html'); $country_code->setRequired(true); $this->addElement($country_code); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $is_active = new Zend_Form_Element_Checkbox('is_active'); $is_active->setLabel('Active'); $is_active->setRequired(true); $this->addElement($is_active); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/languages/'"); $this->addElement($cancel); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($submit); }
public function init() { $tr = Zend_Registry::get('tr'); $locale = Zend_Registry::get('Zend_Locale'); $available_languages = array ( 'en' => 'English', 'fr' => 'Francais', 'it' => 'Italiano', 'ru' => 'Русский', ); $this->setAction('/language'); $this->setAttrib('id', 'language-form'); $languages = new Zend_Form_Element_Select('languages'); $languages->setLabel($tr->_('LANGUAGE')); $languages->addMultiOptions($available_languages); $languages->setValue(isset($locale->value) ? $locale->value : 'en'); $this->addElement($languages); $system_wide = new Zend_Form_Element_Checkbox('system_wide'); $system_wide->setLabel($tr->_('UPDATE_SYSTEM_WIDE') . '?'); $system_wide->setRequired(false); $this->addElement($system_wide); $this->addElement(new Zend_Form_Element_Submit($tr->_('SAVE'))); parent::init(); }
public function init() { // Set form options $this->setName('userShippingAddress')->setMethod('post'); // Address One $addressOne = new Zend_Form_Element_Text('addressOne'); $addressOne->setRequired(true); // Address One $addressTwo = new Zend_Form_Element_Text('addressTwo'); $addressTwo->setRequired(false); // City $city = new Zend_Form_Element_Text('city'); $city->setRequired(true); // State $state = new Zend_Form_Element_Text('state'); $state->setRequired(true); // Country $country = new Zend_Form_Element_Text('country'); $country->setRequired(true); // ZIP $zip = new Zend_Form_Element_Text('zip'); $zip->setRequired(true); // Is Default Shipping? $defaultShipping = new Zend_Form_Element_Checkbox('defaultShipping'); $defaultShipping->setRequired(false); // Add all the elements to the form $this->addElement($addressOne)->addElement($addressTwo)->addElement($city)->addElement($state)->addElement($country)->addElement($zip)->addElement($defaultShipping); }
public function renderFormElement() { $elm = new Zend_Form_Element_Checkbox($this->getName(), array('label' => $this->getLabel() . ':')); $elm->setDescription($this->getDescription()); $elm->setValue($this->getValue()); $elm->setRequired($this->getRequired()); return $elm; }
public function init() { parent::init(); $element = new Zend_Form_Element_Checkbox('useExisting'); $element->setRequired(true); $element->setValue(1); $element->setLabel('Use existing image:'); $this->useExisting = $element; $this->addElement('hidden', 'existingFilename', array('required' => true, 'ignore' => false, 'decorators' => array('ViewHelper'))); }
public function init() { // usuario_nome $usuario_nome = new Zend_Form_Element_Text('usuario_nome'); $usuario_nome->setLabel('Nome Completo: '); $usuario_nome->setRequired(); $usuario_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $usuario_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu nome')); $usuario_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_email $usuario_email = new Zend_Form_Element_Text('usuario_email'); $usuario_email->setLabel('E-mail: '); $usuario_email->addValidator(new App_Validate_UsuarioEmail()); $usuario_email->setRequired(); $usuario_email->addValidator('EmailAddress'); $usuario_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail')); $usuario_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_cep $usuario_cep = new Zend_Form_Element_Text('usuario_cep'); $usuario_cep->setLabel('CEP: '); $usuario_cep->setRequired(); $usuario_cep->addValidator(new App_Validate_Cep()); $usuario_cep->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu CEP')); $usuario_cep->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_senha $usuario_senha = new Zend_Form_Element_Password("usuario_senha"); $usuario_senha->setLabel("Senha: "); $usuario_senha->setRequired(); $usuario_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua senha')); $usuario_senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // usuario_politica_termo $usuario_politica_termo = new Zend_Form_Element_Checkbox('usuario_politica_termo'); $usuario_politica_termo->setLabel(" \n Li e concordo com a \n <a href='' data-toggle='modal' data-target='#modal-politica'>Política de Privacidade</a> e \n <a href='' data-toggle='modal' data-target='#modal-termo'>Termo de Uso</a>.\n "); $usuario_politica_termo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators_termo); //$usuario_politica_termo->addDecorator(); //$usuario_politica_termo->setValue(0); //$usuario_politica_termo->setCheckedValue('') ; $usuario_politica_termo->setUnCheckedValue(''); $usuario_politica_termo->setRequired(); $usuario_politica_termo->addErrorMessage('Você precisa concordar com nossa Pólitica de Privacidade e Termo de Uso'); // captcha $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => 'Informe os careacteres da imagem: ', 'class' => 'form-control', 'captcha' => array('captcha' => 'Image', 'wordLen' => 3, 'timeout' => 300, 'font' => APPLICATION_PATH . '/../public/views/fonts/Exo-SemiBold.ttf', 'imgDir' => APPLICATION_PATH . '/../public/views/captcha/', 'imgUrl' => '/../public/views/captcha/'))); $captcha->removeDecorator('ViewHelper'); $this->addElements(array($usuario_nome, $usuario_email, $usuario_cep, $usuario_senha, $usuario_politica_termo)); parent::init(); $this->getElement('submit')->setLabel('Cadastrar'); }
public function init() { /* Form Elements & Other Definitions Here ... */ //<input type="text" name="name"> $product_name = new Zend_Form_Element_Text('name'); $product_name->setRequired(true); $product_name->addFilter(new Zend_Filter_StripTags()); $product_name->setLabel('Product Name : '); //<input type="text" name="price"> $product_price = new Zend_Form_Element_Text('price'); $product_price->setRequired(); $product_price->setLabel('Product Price : '); $catName = new Zend_Form_Element_Select('catid'); $catName->setLabel('Category :'); // $user_model = new Application_Model_Category(); // $allcats = $user_model->listCategory(); // // // echo' <select id="selectcats" name="cats"> '; // // for ($i = 0; $i < count($allcats); $i++) { // $name = $allcats[$i]['name']; // $id = $allcats[$i]['id']; // // echo" <option value='<?php echo $id ; //<!--//// echo $name; //// echo '</option>'; //// } //// echo' </select>'; --> //picture $product_picture = new Zend_Form_Element_File('picture'); $product_picture->setLabel('Image'); // $product_picture->addValidator('Extension', true, 'jpg,png,gif'); //$product_picture-> $product_state = new Zend_Form_Element_Checkbox('state'); $product_state->setRequired(); $product_state->setLabel('Product exists'); $product_state->setCheckedValue(1); $product_state->setUncheckedValue(0); //$product_state->setChecked(true); $submit = new Zend_Form_Element_Submit("Submit"); $this->setMethod('post'); $this->setAttrib('enctype', 'multipart/form-data'); //$this->setAction(''); $this->addElements(array($product_name, $product_picture, $product_price, $catName, $product_state, $submit)); }
public function init() { $tr = Zend_Registry::get('tr'); $api_url = new Zend_Form_Element_Text('api_url'); $api_url->setLabel($tr->_('API_DOMAIN') . ' ' . $tr->_('FOR_TESTER')); $api_url->setRequired(true); $api_url->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE'))); $this->addElement($api_url); $cd = new Zend_Form_Element_Checkbox('cdata'); $cd->setLabel($tr->_('USE_CDATA')); $cd->setRequired(false); $this->addElement($cd); $cs = new Zend_Form_Element_Checkbox('allow_cross_domain'); $cs->setLabel($tr->_('ALLOW_CROSSDOMAIN')); $cs->setRequired(false); $this->addElement($cs); $this->addElement(new Zend_Form_Element_Submit($tr->_('UPDATE_CONFIGURATION'), array('label' => $tr->_('UPDATE_CONFIGURATION')))); parent::init(); }
public function init() { $model_t_countries = new Locale_Model_Languages(); $name = new Zend_Form_Element_Text('name'); $name->setLabel('Name'); $name->setRequired(true); $this->addElement($name); $country_code = new Zend_Form_Element_Text('country_code'); $country_code->setLabel('Country code'); $country_code->setDescription('List of codes you can see here: http://framework.zend.com/manual/1.12/en/zend.locale.appendix.html'); $country_code->setRequired(true); $this->addElement($country_code); $calling_code = new Zend_Form_Element_Text('calling_code'); $calling_code->setLabel('Calling code'); $calling_code->setRequired(true); $calling_code->addValidator('Digits', true); $this->addElement($calling_code); $t_country_id = new Zend_Form_Element_Select('language_id'); $t_country_id->addValidator(new Zend_Validate_Digits(), true); $t_country_id->setLabel('Language'); $t_country_id->setAttrib("data-placeholder", "Choose language..."); $t_country_id->setMultiOptions(array('0' => 'none') + $model_t_countries->getIdAndNameArray()); $this->addElement($t_country_id); $is_active = new Zend_Form_Element_Checkbox('is_active'); $is_active->setLabel('Active'); $is_active->setRequired(true); $this->addElement($is_active); $cancel = new Zend_Form_Element_Button('cancel'); $cancel->setLabel('Cancel'); $cancel->setAttrib('class', 'btn btn-gold')->setAttrib('style', 'color:black'); $cancel->setAttrib("onClick", "window.location = window.location.origin+'/locale/countries/'"); $this->addElement($cancel); $submit = new Zend_Form_Element_Submit('save'); $submit->setAttrib('class', 'btn btn-primary'); $submit->setLabel('Confirm'); $this->setAction('')->setMethod('post')->addElement($submit); }
public function init() { /** * salao_cnpj */ $salao_cnpj = new Zend_Form_Element_Text("salao_cnpj"); $salao_cnpj->setLabel("CNPJ: "); $salao_cnpj->setRequired(); $salao_cnpj->addValidator(new App_Validate_Cnpj()); $salao_cnpj->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o CNPJ')); $salao_cnpj->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_salao */ $salao_salao = new Zend_Form_Element_Text('salao_nome'); $salao_salao->setLabel('Nome do Salão: '); $salao_salao->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do salão')); $salao_salao->setRequired(); $salao_salao->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_salao->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_nome */ $salao_nome = new Zend_Form_Element_Text('salao_proprietario'); $salao_nome->setLabel('Nome Proprietário: '); $salao_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do proprietário')); $salao_nome->setRequired(); $salao_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_email */ $salao_email = new Zend_Form_Element_Text('salao_email'); $salao_email->setLabel('E-mail: '); $salao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o e-mail de contato')); $salao_email->setRequired(); $salao_email->addValidator(new App_Validate_Salao()); $salao_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * senha */ $senha = new Zend_Form_Element_Password('senha'); $senha->setLabel("Senha: "); $senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe a senha')); $senha->setRequired(); $senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * salao_contato */ $salao_contato = new Zend_Form_Element_Text('salao_contato'); $salao_contato->setLabel('Telefone: '); $salao_contato->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe um telefone de contato')); $salao_contato->setRequired(); $salao_contato->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_contato->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * profisional_cep */ $salao_cep = new Zend_Form_Element_Text('salao_cep'); $salao_cep->setLabel('CEP: '); $salao_cep->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o cep do salão')); $salao_cep->setRequired(); $salao_cep->addValidator(new App_Validate_Cep()); $salao_cep->setDecorators(App_Forms_Decorators::$simpleElementDecorators); /** * profisional_logradouro */ $salao_logradouro = new Zend_Form_Element_Text('salao_logradouro'); $salao_logradouro->setLabel("Logradouro: "); $salao_logradouro->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o logradouro', 'readonly' => true)); $salao_logradouro->setRequired(); $salao_logradouro->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $salao_logradouro->setDecorators(App_Forms_Decorators::$simpleElementDecorators); //$salao_logradouro->setOrder(7); /** * sala_numero */ $salao_numero = new Zend_Form_Element_Text('salao_numero'); $salao_numero->setLabel('Número: '); $salao_numero->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o numero')); $salao_numero->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_numero->setRequired(); $salao_numero->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); /** * sala_complemento */ $salao_complemento = new Zend_Form_Element_Text('salao_complemento'); $salao_complemento->setLabel('Complemento: '); $salao_complemento->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o complemento')); //$salao_complemento->setRequired(); /** * profisional_bairro */ $salao_bairro = new Zend_Form_Element_Text('salao_bairro'); $salao_bairro->setLabel("Bairro: "); $salao_bairro->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o bairro', 'readonly' => true)); $salao_bairro->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_bairro->setRequired(); $salao_bairro->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); /** * profisional_cidade */ $salao_cidade = new Zend_Form_Element_Text('salao_cidade'); $salao_cidade->setLabel('Cidade: '); $salao_cidade->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe a cidade', 'readonly' => true)); $salao_cidade->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $salao_cidade->setRequired(); $salao_cidade->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); /** * estado_id */ $formEstado = new App_Forms_Estado("estado_id"); $estado_id = $formEstado->elementEstado(); $estado_id->setLabel('Estado: '); $estado_id->setDecorators(App_Forms_Decorators::$simpleElementDecorators); $estado_id->setRequired(); $estado_id->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!")); $estado_id->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o estado', 'readonly' => true)); /** * salao_cupom */ $salao_cupom = new Zend_Form_Element_Text('salao_cupom'); $salao_cupom->setLabel('Cupom Promocional: '); $salao_cupom->setAttribs(array('class' => 'form-control', 'placeholder' => 'Tem cupom promocional?')); $salao_cupom->setDecorators(App_Forms_Decorators::$simpleElementDecorators); // salao_politica_termo $salao_politica_termo = new Zend_Form_Element_Checkbox('salao_politica_termo'); $salao_politica_termo->setLabel(" \n Li e concordo com a \n <a href='' data-toggle='modal' data-target='#modal-politica'>Política de Privacidade</a> e \n <a href='' data-toggle='modal' data-target='#modal-termo'>Termo de Uso</a>.\n "); $salao_politica_termo->setDecorators(App_Forms_Decorators::$checkboxElementDecorators_termo); //$salao_politica_termo->addDecorator(); //$salao_politica_termo->setValue(0); //$salao_politica_termo->setCheckedValue('') ; $salao_politica_termo->setUnCheckedValue(''); $salao_politica_termo->setRequired(); $salao_politica_termo->addErrorMessage('Você precisa concordar com nossa Pólitica de Privacidade e Termo de Uso'); /** * Add elements */ $this->addElements(array($salao_salao, $salao_nome, $salao_contato, $salao_email, $senha, $salao_cep, $salao_logradouro, $salao_numero, $salao_complemento, $salao_bairro, $salao_cidade, $estado_id, $salao_cupom, $salao_politica_termo)); parent::init(); $this->getElement('submit')->setLabel('Cadastrar'); }
public function init() { $this->addDecorators(array("ViewHelper"), array("Errors")); $firstname = new Zend_Form_Element_Text("first_name"); $firstname->setLabel("Firstname"); $firstname->setRequired(true); $firstname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50)))); $lastname = new Zend_Form_Element_Text("last_name"); $lastname->setLabel("Lastname"); $lastname->setRequired(true); $lastname->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true), array("validator" => "alpha", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(6, 50)))); $website = new Zend_Form_Element_Text("website"); $website->setRequired(true); $website->setLabel("Website"); $website->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "alnum", "options" => array("allowWhiteSpace" => false)), array("validator" => "stringLength", "options" => array(13, 255))); /* $username = new Zend_Form_Element_Text("username"); $username->setRequired(true); $username->setLabel("Username"); $username->addValidators(array( array("validator"=>"NotEmpty", "breakChainOnFailure"=>true)), array("validator"=>"alpha", "options"=>array("allowWhiteSpace"=>false)), array("validator"=>"stringLength", "options"=>array(6, 30)) ); $password = new Zend_Form_Element_Password("password"); $password->setRequired(true); $password->setLabel("Password"); $password->addValidators(array( array("validator"=>"NotEmpty", "breakChainOnFailure"=>true)), array("validator"=>"alnum", "options"=>array("allowWhiteSpace"=>false)), array("validator"=>"stringLength", "options"=>array(6, 30)) ); $confirm_password = new Zend_Form_Element_Password("confirm_password"); $confirm_password->setLabel("Confirm Password"); $confirm_password->setRequired(true); $confirm_password->addValidators(array( array("validator"=>"NotEmpty", "breakChainOnFailure"=>true)), array("validator"=>"alnum", "options"=>array("allowWhiteSpace"=>false)), array("validator"=>"stringLength", "options"=>array(6, 30)) ); */ $email = new Zend_Form_Element_Text("email"); $email->setLabel("Email Address"); $email->setRequired(true); $email->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(6, 50))); $mobile = new Zend_Form_Element_Text("mobile"); $mobile->setLabel("Contact <span class=\"help\">(Skype, Mobile)</span>"); $mobile->setRequired(true); $mobile->addValidators(array(array("validator" => "NotEmpty", "breakChainOnFailure" => true)), array("validator" => "stringLength", "options" => array(10, 20))); $mobile->getDecorator("Label")->setOption("escape", false); $fullname_webmaster = new Zend_Form_Element_Text("fullname_webmaster"); $fullname_webmaster->setLabel("Name <span class='help'>(Company's Web Designer)</span>"); $fullname_webmaster->addValidators(array(array("validator" => "stringLength", "options" => array(0, 100)))); $fullname_webmaster->getDecorator("Label")->setOption("escape", false); $email_webmaster = new Zend_Form_Element_Text("email_webmaster"); $email_webmaster->setLabel("Email Address"); $email_webmaster->addValidators(array(array("validator" => "emailAddress"), array("validator" => "stringLength", "options" => array(0, 50)))); $phone_webmaster = new Zend_Form_Element_Text("phone_webmaster"); $phone_webmaster->setLabel("Phone Number"); $phone_webmaster->addValidators(array(array("validator" => "stringLength", "options" => array(0, 20)))); $company = new Zend_Form_Element_Text("company"); $company->setLabel("Company"); $company->addValidators(array(array("validator" => "stringLength", "options" => array(0, 20)))); $items = array(); $items[""] = "Please Select"; $numberOfHitModel = new App_NumberOfHit(); $hits = $numberOfHitModel->fetchAll()->toArray(); foreach ($hits as $hit) { $items[$hit["id"]] = $hit["name"]; } $number_hits = new Zend_Form_Element_Select("number_of_hit_id"); $number_hits->setRequired(true); $number_hits->setLabel("How many web hits do you currently receive each month?"); $number_hits->addMultiOptions($items); $businessType = new Zend_Form_Element_Text("business_type"); $businessType->setRequired(true); $businessType->setLabel("Business Type"); $timezoneGroupModel = new App_TimezoneGroup(); $timezoneGroups = $timezoneGroupModel->getAllTimezonesGrouped(); $items = array(); $items[""] = "Please Select"; foreach ($timezoneGroups as $timezoneGroup) { $timezones = $timezoneGroup["timezones"]; foreach ($timezones as $timezone) { $items[$timezoneGroup["name"]][$timezone["timezone_id"]] = $timezone["name"]; } } $timezone = new Zend_Form_Element_Select("timezone_id"); $timezone->setRequired(true); $timezone->setLabel("What time zone is your business located?"); $timezone->addMultiOptions($items); $accept = new Zend_Form_Element_Checkbox("accept"); $accept->setLabel("I Accept, the Terms and Service"); $accept->setRequired(true); $accept->setDecorators(array('ViewHelper')); $this->addElements(array($firstname, $lastname, $password, $confirm_password, $username, $email, $mobile, $businessType, $timezone, $website, $number_hits, $company, $fullname_webmaster, $email_webmaster, $phone_webmaster, $accept)); }
public function __construct($options = null) { $this->_disabledDefaultActions = true; parent::__construct($options); $baseDir = $this->getView()->baseUrl(); if (!empty($options['mode']) && $options['mode'] == 'edit') { $this->_mode = 'edit'; } else { $this->_mode = 'add'; } $langId = Zend_Registry::get('languageID'); $this->setAttrib('id', 'accountManagement'); $this->setAttrib('class', 'step3'); // $addressParams = array( // "fieldsValue" => array(), // "display" => array(), // "required" => array(), // ); //Hidden fields for the state and cities id $selectedState = new Zend_Form_Element_Hidden('selectedState'); $selectedState->removeDecorator('label'); $selectedCity = new Zend_Form_Element_Hidden('selectedCity'); $selectedCity->removeDecorator('label'); $this->addElement($selectedState); $this->addElement($selectedCity); // Salutation $salutation = new Zend_Form_Element_Select('salutation'); $salutation->setLabel($this->getView()->getCibleText('form_label_salutation'))->setAttrib('class', 'smallTextInput')->setOrder(1); $greetings = $this->getView()->getAllSalutation(); foreach ($greetings as $greeting) { $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']); } // language hidden field $language = new Zend_Form_Element_Hidden('language', array('value' => $langId)); $language->removeDecorator('label'); // langauge hidden field // FirstName $firstname = new Zend_Form_Element_Text('firstName'); $firstname->setLabel($this->getView()->getCibleText('form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setOrder(2); // LastName $lastname = new Zend_Form_Element_Text('lastName'); $lastname->setLabel($this->getView()->getCibleText('form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setOrder(3); // email $regexValidate = new Cible_Validate_Email(); $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch'); $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists('GenericProfiles', 'GP_Email'); $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound'); $email = new Zend_Form_Element_Text('email'); $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => 'stdTextInput'))->setOrder(4); if ($this->_mode == 'add') { $email->addValidator($emailNotFoundInDBValidator); } // email // password $password = new Zend_Form_Element_Password('password'); if ($this->_mode == 'add') { $password->setLabel($this->getView()->getCibleText('form_label_password')); } else { $password->setLabel($this->getView()->getCibleText('form_label_newPwd')); } $password->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setRequired(true)->setOrder(5)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); // password // password confirmation $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation'); if ($this->_mode == 'add') { $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd')); } else { $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd')); } $passwordConfirmation->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->setOrder(6)->setAttrib('class', 'stdTextInput'); if (!empty($_POST['identification']['password'])) { $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty')))); $Identical = new Zend_Validate_Identical($_POST['identification']['password']); $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame'))); $passwordConfirmation->addValidator($Identical); } // password confirmation // Company name $company = new Zend_Form_Element_Text('company'); $company->setLabel($this->getView()->getCibleText('form_label_company'))->setRequired(false)->setOrder(7)->setAttribs(array('class' => 'stdTextInput')); // function in company $functionCompany = new Zend_Form_Element_Text('functionCompany'); $functionCompany->setLabel($this->getView()->getCibleText('form_label_account_function_company'))->setRequired(false)->setOrder(8)->setAttribs(array('class' => 'stdTextInput')); // Are you a retailer $retailer = new Zend_Form_Element_Select('isRetailer'); $retailer->setLabel($this->getView()->getClientText('form_label_retailer'))->setAttrib('class', 'smallTextInput'); $retailer->addMultiOption(0, $this->getView()->getCibleText('button_no')); $retailer->addMultiOption(1, $this->getView()->getCibleText('button_yes')); // Text Subscribe $textSubscribe = $this->getView()->getCibleText('form_label_subscribe'); $textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->page_privacy_policy->pageID), $textSubscribe); // Newsletter subscription $newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription'); $newsletterSubscription->setLabel($textSubscribe); if ($this->_mode == 'add') { $newsletterSubscription->setChecked(1); } $newsletterSubscription->setAttrib('class', 'long-text'); $newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); if ($this->_mode == 'add') { $termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement'); $termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement'))); $termsAgreement->setAttrib('class', 'long-text'); $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $termsAgreement->setRequired(true); $termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms'))); } else { $termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1)); } // Submit button $submit = new Zend_Form_Element_Submit('submit'); $submit->setLabel($this->getView()->getCibleText('form_label_next_step_btn'))->setAttrib('class', 'nextStepButton'); // Reference number for the job $txtConnaissance = new Cible_Form_Element_Html('knowYou', array('value' => $this->getView()->getCibleText('form_account_mieux_vous_connaitre_legend'))); $txtConnaissance->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'description left')))); $refJobId = new Zend_Form_Element_Text('refJobId'); $refJobId->setLabel('refJobId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput')); // Reference number for the role $refRoleId = new Zend_Form_Element_Text('refRoleId'); $refRoleId->setLabel('refRoleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput')); // Reference number for the job title $refJobTitleId = new Zend_Form_Element_Text('refJobTitleId'); $refJobTitleId->setLabel('refJobTitleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput')); $refJobTitleId = new Zend_Form_Element_Text('refJobTitleId'); $refJobTitleId->setLabel('refJobTitleId')->setRequired(false)->setAttribs(array('class' => 'stdTextInput')); // Provincial tax exemption $noProvTax = new Zend_Form_Element_Checkbox('noProvTax'); $noProvTax->setLabel($this->getView()->getCibleText('form_label_account_provincial_tax')); $noProvTax->setAttrib('class', 'long-text')->setOrder(13); $noProvTax->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); // Provincial tax exemption $noFedTax = new Zend_Form_Element_Checkbox('noFedTax'); $noFedTax->setLabel($this->getView()->getCibleText('form_label_account_federal_tax')); $noFedTax->setAttrib('class', 'long-text')->setOrder(14); $noFedTax->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); /* Identification sub form */ $identificationSub = new Zend_Form_SubForm(); $identificationSub->setName('identification')->removeDecorator('DtDdWrapper'); $identificationSub->setLegend($this->getView()->getCibleText('form_account_subform_identification_legend')); $identificationSub->setAttrib('class', 'identificationClass subFormClass'); $identificationSub->addElement($language); $identificationSub->addElement($salutation); $identificationSub->addElement($lastname); $identificationSub->addElement($firstname); $identificationSub->addElement($email); $identificationSub->addElement($password); $identificationSub->addElement($passwordConfirmation); $identificationSub->addElement($company); $this->addSubForm($identificationSub, 'identification'); // $identificationSub->addElement($functionCompany); $addrContactMedia = new Cible_View_Helper_FormAddress($identificationSub); if ($options['resume']) { $addrContactMedia->setProperty('addScript', false); } $addrContactMedia->enableFields(array('firstTel', 'secondTel', 'fax', 'webSite')); $addrContactMedia->formAddress(); $identificationSub->addElement($noProvTax); $identificationSub->addElement($noFedTax); /* Identification sub form */ /* billing address */ // Billing address $addressFacturationSub = new Zend_Form_SubForm(); $addressFacturationSub->setName('addressFact')->removeDecorator('DtDdWrapper'); $addressFacturationSub->setLegend($this->getView()->getCibleText('form_account_subform_addBilling_legend')); $addressFacturationSub->setAttrib('class', 'addresseBillingClass subFormClass'); $billingAddr = new Cible_View_Helper_FormAddress($addressFacturationSub); $billingAddr->setProperty('addScriptState', false); if ($options['resume']) { $billingAddr->setProperty('addScript', false); } $billingAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel')); $billingAddr->formAddress(); $addrBill = new Zend_Form_Element_Hidden('addrBill'); $addrBill->removeDecorator('label'); $addressFacturationSub->addElement($addrBill); $addressFacturationSub->getElement('AI_SecondAddress')->removeDecorator('label'); $this->addSubForm($addressFacturationSub, 'addressFact'); /* delivery address */ $addrShip = new Zend_Form_Element_Hidden('addrShip'); $addrShip->removeDecorator('label'); $addressShippingSub = new Zend_Form_SubForm(); $addressShippingSub->setName('addressShipping')->removeDecorator('DtDdWrapper'); $addressShippingSub->setLegend($this->getView()->getCibleText('form_account_subform_addShipping_legend')); $addressShippingSub->setAttrib('class', 'addresseShippingClass subFormClass'); $shipAddr = new Cible_View_Helper_FormAddress($addressShippingSub); if ($options['resume']) { $shipAddr->setProperty('addScript', false); } $shipAddr->duplicateAddress($addressShippingSub); $shipAddr->setProperty('addScriptState', false); $shipAddr->enableFields(array('firstAddress', 'secondAddress', 'state', 'cityTxt', 'zipCode', 'country', 'firstTel', 'secondTel')); $shipAddr->formAddress(); $addressShippingSub->addElement($addrShip); $this->addSubForm($addressShippingSub, 'addressShipping'); if ($this->_mode == 'edit') { $this->addElement($termsAgreement); } $this->addElement($submit); $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'stepBottomNext')))); if ($this->_mode == 'add') { $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox', 'id' => 'dd-terms-agreement')))); } }
public function init() { $this->setName(strtolower(get_class())); $this->setMethod("post"); $oFormName = new Zend_Form_Element_Hidden("form_name"); $oFormName->setValue(get_class()); $oFormName->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oFormName); $oUserRoleId = new Zend_Form_Element_Select("role_id"); $oUserRoleId->setLabel("Grupa użytkownika:"); $oUserRoleId->setRequired(TRUE); $oUserRoleId->addMultiOptions($this->_aAllUserRole); $this->addElement($oUserRoleId); $oUserFbId = new Zend_Form_Element_Text("user_fb_id"); $oUserFbId->setLabel("ID profilu z facebooka:")->setFilters($this->_aFilters); $oUserFbId->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true))); $oUserFbId->setRequired(FALSE); $oUserFbId->setAttrib("class", "valid"); $this->addElement($oUserFbId); $oFirstName = new Zend_Form_Element_Text("first_name"); $oFirstName->setLabel("Imię:")->setFilters($this->_aFilters); $oFirstName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true))); $oFirstName->setRequired(TRUE); $oFirstName->setAttrib("class", "valid"); $this->addElement($oFirstName); $oLastName = new Zend_Form_Element_Text("last_name"); $oLastName->setLabel("Nazwisko:")->setFilters($this->_aFilters); $oLastName->addValidator(new Zend_Validate_Alpha(array("allowWhiteSpace" => true))); $oLastName->setRequired(TRUE); $oLastName->setAttrib("class", "valid"); $this->addElement($oLastName); $oEmailAddress = new Zend_Form_Element_Text("email_address"); $oEmailAddress->setLabel("Adres e-mail:")->setFilters($this->_aFilters); $oEmailAddress->addValidator(new Zend_Validate_EmailAddress()); $oEmailAddress->addValidator(new AppCms2_Validate_CheckUser()); $oEmailAddress->setRequired(TRUE); $oEmailAddress->setAttrib("class", "valid"); $this->addElement($oEmailAddress); $oEmailAddressConfirm = new Zend_Form_Element_Text("email_address_confirm"); $oEmailAddressConfirm->setLabel("Powtórz adres e-mail:")->setFilters($this->_aFilters); $oEmailAddressConfirm->addValidator(new AppCms2_Validate_EmailConfirmation()); $oEmailAddressConfirm->addValidator(new Zend_Validate_EmailAddress()); $oEmailAddressConfirm->addValidator(new AppCms2_Validate_CheckUser()); $oEmailAddressConfirm->setRequired(TRUE); $oEmailAddressConfirm->setAttrib("class", "valid"); $this->addElement($oEmailAddressConfirm); $oPassword = new Zend_Form_Element_Password("password"); $oPassword->setLabel("Hasło:")->setFilters($this->_aFilters); $oPassword->setRequired(TRUE); $oPassword->setAttrib("class", "valid"); $this->addElement($oPassword); $oPhoneNumber = new Zend_Form_Element_Text("phone_number"); $oPhoneNumber->setLabel("Numer telefonu:")->setFilters($this->_aFilters); $oPhoneNumber->addValidator(new AppCms2_Validate_CellPhone()); $oPhoneNumber->setRequired(FALSE); $oPhoneNumber->setAttrib("class", "valid"); $this->addElement($oPhoneNumber); $oUserCategoryId = new Zend_Form_Element_Select("user_category_id"); $oUserCategoryId->setLabel("Kategoria użytkownika:")->setFilters($this->_aFilters); $oUserCategoryId->addMultiOptions($this->_aCategory); $oUserCategoryId->setRequired(TRUE); $oUserCategoryId->setAttrib("class", "valid"); $this->addElement($oUserCategoryId); $oIsActive = new Zend_Form_Element_Checkbox("is_active"); $oIsActive->setLabel("Konto aktywne:")->setFilters($this->_aFilters); $oIsActive->setRequired(FALSE); $oIsActive->setAttrib("class", "valid"); $this->addElement($oIsActive); $oOwner = new Zend_Form_Element_Checkbox("owner_account"); $oOwner->setLabel("Głowne konto:")->setFilters($this->_aFilters); $oOwner->setRequired(FALSE); $oOwner->setAttrib("class", "valid"); $this->addElement($oOwner); $oUserEditId = new Zend_Form_Element_Hidden("user_edit_id"); $oUserEditId->setValue(0); $oUserEditId->setIgnore(FALSE)->removeDecorator("Label"); $this->addElement($oUserEditId); $this->addElement("hash", "csrf_token", array("ignore" => false, "timeout" => 7200)); $this->getElement("csrf_token")->removeDecorator("Label"); $oSubmit = $this->createElement("submit", "submit"); $oSubmit->setLabel("Zapisz"); $this->addElement($oSubmit); $oViewScript = new Zend_Form_Decorator_ViewScript(); $oViewScript->setViewModule("admin"); $oViewScript->setViewScript("_forms/register.phtml"); $this->clearDecorators(); $this->setDecorators(array(array($oViewScript))); $oElements = $this->getElements(); foreach ($oElements as $oElement) { $oElement->setFilters($this->_aFilters); $oElement->removeDecorator("Errors"); } }
protected function _getElementForServerSetting(Application_Model_ServerSetting2Server $serverSetting) { $name = $serverSetting->getSetting()->getName(); switch ($name) { case 'MaxUser': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int(), true)->addValidator(new Zend_Validate_GreaterThan(0)); break; case 'Password': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Alnum(false)); break; case 'PortBase': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int(), true)->addValidator(new Zend_Validate_GreaterThan(1024)); break; case 'ShowLastSongs': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int(), true)->addValidator(new Zend_Validate_GreaterThan(0))->addValidator(new Zend_Validate_LessThan(21)); break; case 'SrcIP': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Callback(array($this, 'validateIpOrAny'))); break; case 'AdminPassword': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Alnum(false)); break; case 'AutoDumpUsers': $element = new Zend_Form_Element_Checkbox($name); $element->setRequired(true)->setAllowEmpty(false); break; case 'AutoDumpSourceTime': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int())->addValidator(new Zend_Validate_GreaterThan(0)); break; case 'IntroFile': $element = new \SAP\Form\Element\Text($name); break; case 'BackupFile': $element = new \SAP\Form\Element\Text($name); break; case 'TitleFormat': $element = new \SAP\Form\Element\Text($name); break; case 'URLFormat': $element = new \SAP\Form\Element\Text($name); break; case 'PublicServer': $element = new Zend_Form_Element_Select($name); $element->setRequired(true)->setAllowEmpty(false)->setMultiOptions(array('default', 'always', 'never')); break; case 'AllowRelay': $element = new Zend_Form_Element_Checkbox($name); $element->setRequired(true)->setAllowEmpty(false); break; case 'AllowPublicRelay': $element = new Zend_Form_Element_Checkbox($name); $element->setRequired(true)->setAllowEmpty(false); break; case 'MetaInterval': $element = new \SAP\Form\Element\Text($name); $element->setRequired(true)->setAllowEmpty(false)->addValidator(new Zend_Validate_Int()); break; } $element->setLabel($name)->setValue($serverSetting->getValue()); return $element; }
public function __construct($options = null) { $this->_disabledDefaultActions = true; parent::__construct($options); $baseDir = $this->getView()->baseUrl(); if (!empty($options['mode']) && $options['mode'] == 'edit') { $this->_mode = 'edit'; } else { $this->_mode = 'add'; } $langId = Zend_Registry::get('languageID'); $this->setAttrib('id', 'accountManagement'); // $addressParams = array( // "fieldsValue" => array(), // "display" => array(), // "required" => array(), // ); // Salutation $salutation = new Zend_Form_Element_Select('salutation'); $salutation->setLabel($this->getView()->getCibleText('form_label_salutation'))->setAttrib('class', 'smallSelect')->setAttrib('tabindex', '1')->setOrder(1); $greetings = $this->getView()->getAllSalutation(); foreach ($greetings as $greeting) { $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']); } // Language $languages = new Zend_Form_Element_Select('language'); $languages->setLabel($this->getView()->getCibleText('form_label_language'))->setAttrib('class', 'stdSelect')->setAttrib('tabindex', '9')->setOrder(9); foreach (Cible_FunctionsGeneral::getAllLanguage() as $lang) { $languages->addMultiOption($lang['L_ID'], $lang['L_Title']); } // FirstName $firstname = new Zend_Form_Element_Text('firstName'); $firstname->setLabel($this->getView()->getCibleText('form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '2')->setOrder(2); // LastName $lastname = new Zend_Form_Element_Text('lastName'); $lastname->setLabel($this->getView()->getCibleText('form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '3')->setOrder(3); // email $regexValidate = new Cible_Validate_Email(); $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch'); $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists('GenericProfiles', 'GP_Email'); $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound'); $email = new Zend_Form_Element_Text('email'); $email->setLabel($this->getView()->getCibleText('form_label_email'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => 'stdTextInput'))->setAttrib('tabindex', '5')->setOrder(5); if ($this->_mode == 'add') { $email->addValidator($emailNotFoundInDBValidator); } // email // password $password = new Zend_Form_Element_Password('password'); if ($this->_mode == 'add') { $password->setLabel($this->getView()->getCibleText('form_label_password')); } else { $password->setLabel($this->getView()->getCibleText('form_label_newPwd')); } $password->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('tabindex', '6')->setRequired(true)->setOrder(6)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field')))); // password // password confirmation $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation'); if ($this->_mode == 'add') { $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd')); } else { $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmPwd')); } // $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd')); $passwordConfirmation->addFilter('StripTags')->addFilter('StringTrim')->setRequired(true)->setOrder(7)->setAttrib('class', 'stdTextInput')->setAttrib('tabindex', '7')->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical')))); if (!empty($_POST['identification']['password'])) { $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty')))); $Identical = new Zend_Validate_Identical($_POST['identification']['password']); $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame'))); $passwordConfirmation->addValidator($Identical); } // password confirmation // Company name $company = new Zend_Form_Element_Text('company'); $company->setLabel($this->getView()->getCibleText('form_label_company'))->setRequired(false)->setAttrib('tabindex', '4')->setOrder(4)->setAttribs(array('class' => 'stdTextInput')); // Account number $account = new Zend_Form_Element_Text('accountNum'); $account->setLabel($this->getView()->getCibleText('form_label_account'))->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setOrder(8)->setAttribs(array('class' => 'stdTextInput'))->setAttrib('tabindex', '8')->setDecorators(array('ViewHelper', 'Errors', array(array('row' => 'HtmlTag'), array('tag' => 'dd')), array('label', array('class' => 'test', 'tag' => 'dt', 'tagClass' => 'alignVertical')))); // Text Subscribe $textSubscribe = $this->getView()->getCibleText('form_label_subscribe'); $textSubscribe = str_replace('%URL_PRIVACY_POLICY%', Cible_FunctionsPages::getPageLinkByID($this->_config->privacyPolicy->pageId), $textSubscribe); // Newsletter subscription $newsletterSubscription = new Zend_Form_Element_Checkbox('newsletterSubscription'); $newsletterSubscription->setLabel($textSubscribe); if ($this->_mode == 'add') { $newsletterSubscription->setChecked(1); } $newsletterSubscription->setAttrib('class', 'long-text'); $newsletterSubscription->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'subscribeNewsletter', 'class' => 'label_after_checkbox')))); if ($this->_mode == 'add') { $termsAgreement = new Zend_Form_Element_Checkbox('termsAgreement'); $termsAgreement->setLabel(str_replace('%URL_TERMS_CONDITIONS%', Cible_FunctionsPages::getPageLinkByID($this->_config->termsAndConditions->pageId), $this->getView()->getClientText('form_label_terms_agreement'))); $termsAgreement->setAttrib('class', 'long-text'); $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox')))); $termsAgreement->setRequired(true); $termsAgreement->addValidator('notEmpty', true, array('messages' => array('isEmpty' => 'You must agree to the terms'))); } else { $termsAgreement = new Zend_Form_Element_Hidden('termsAgreement', array('value' => 1)); } // Submit button $submit = new Zend_Form_Element_Submit('submit'); $submitLabel = $this->getView()->getCibleText('form_account_button_submit'); if ($this->_mode == 'edit') { $submitLabel = $this->getView()->getCibleText('button_submit'); } $submit->setLabel($submitLabel)->setAttrib('class', 'stdButton subscribeButton1-' . Zend_Registry::get("languageSuffix")); // Captcha // Refresh button $refresh_captcha = new Zend_Form_Element_Button('refresh_captcha'); $refresh_captcha->setLabel($this->getView()->getCibleText('button_refresh_captcha'))->setAttrib('onclick', "refreshCaptcha('captcha-id')")->setAttrib('class', 'stdButton')->removeDecorator('Label')->removeDecorator('DtDdWrapper'); $refresh_captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd-refresh-captcha-button')))); $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('form_label_securityCaptcha'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 5, 'fontSize' => 28, 'height' => 67, 'width' => 169, 'timeout' => 300, 'dotNoiseLevel' => 0, 'lineNoiseLevel' => 0, 'font' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/fonts/ARIAL.TTF", 'imgDir' => Zend_Registry::get('application_path') . "/../{$this->_config->document_root}/captcha/tmp", 'imgUrl' => "{$baseDir}/captcha/tmp"))); $captcha->setAttrib('class', 'stdTextInputCatcha'); $captcha->setRequired(true); $captcha->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))))->addDecorator('Label', array('class' => 'clear')); $french = array('badCaptcha' => 'Veuillez saisir la chaîne ci-dessus correctement.'); $english = array('badCaptcha' => 'Captcha value is wrong'); $translate = new Zend_Translate('array', $french, 'fr'); $this->setTranslator($translate); $this->getView()->jQuery()->enable(); $script = <<<EOS function refreshCaptcha(id){ \$.getJSON('{$this->getView()->baseUrl()}/newsletter/index/captcha-reload', function(data){ \$("dd#dd_captcha img").attr({src : data['url']}); \$("#"+id).attr({value: data['id']}); }); } EOS; $this->getView()->headScript()->appendScript($script); // Captcha /* Identification sub form */ $identificationSub = new Cible_Form_SubForm(); $identificationSub->setName('identification')->removeDecorator('DtDdWrapper'); $identificationSub->setLegend($this->getView()->getCibleText('form_account_subform_identification_legend')); $identificationSub->setAttrib('class', 'identificationClass subFormClass'); $identificationSub->addElement($languages); $identificationSub->addElement($salutation); $identificationSub->addElement($lastname); $identificationSub->addElement($firstname); $identificationSub->addElement($email); $identificationSub->addElement($password); $identificationSub->addElement($passwordConfirmation); $identificationSub->addElement($company); $identificationSub->addElement($account); $identificationSub->addDisplayGroup(array('salutation', 'firstName', 'company', 'password', 'accountNum'), 'leftColumn'); $identificationSub->addDisplayGroup(array('lastName', 'email', 'passwordConfirmation', 'language'), 'rightColumn')->removeDecorator('DtDdWrapper'); $leftColGroup = $identificationSub->getDisplayGroup('leftColumn'); $rightColGroup = $identificationSub->getDisplayGroup('rightColumn'); $leftColGroup->removeDecorator('DtDdWrapper'); $rightColGroup->removeDecorator('DtDdWrapper'); $this->addSubForm($identificationSub, 'identification'); // Billing address $addressFacturationSub = new Cible_Form_SubForm(); $addressFacturationSub->setName('addressFact')->removeDecorator('DtDdWrapper'); $addressFacturationSub->setLegend($this->getView()->getCibleText('form_account_subform_addBilling_legend')); $addressFacturationSub->setAttrib('class', 'addresseBillingClass subFormClass'); $billingAddr = new Cible_View_Helper_FormAddress($addressFacturationSub); $billingAddr->enableFields(array('firstAddress', 'secondAddress', 'cityTxt', 'zipCode', 'country', 'state', 'firstTel', 'secondTel', 'fax')); $billingAddr->formAddress(); $addrBill = new Zend_Form_Element_Hidden('addrBill'); $addrBill->removeDecorator('label'); $addressFacturationSub->addElement($addrBill); $this->addSubForm($addressFacturationSub, 'addressFact'); /* delivery address */ $addrShip = new Zend_Form_Element_Hidden('addrShip'); $addrShip->removeDecorator('label'); $addressShippingSub = new Cible_Form_SubForm(); $addressShippingSub->setName('addressShipping')->removeDecorator('DtDdWrapper'); $addressShippingSub->setLegend($this->getView()->getCibleText('form_account_subform_addShipping_legend')); $addressShippingSub->setAttrib('class', 'addresseShippingClass subFormClass'); $shipAddr = new Cible_View_Helper_FormAddress($addressShippingSub); $shipAddr->duplicateAddress($addressShippingSub); $shipAddr->setProperty('addScriptState', false); $shipAddr->enableFields(array('firstAddress', 'secondAddress', 'cityTxt', 'zipCode', 'country', 'state', 'firstTel', 'secondTel', 'fax')); $shipAddr->formAddress(); $addressShippingSub->addElement($addrShip); $this->addSubForm($addressShippingSub, 'addressShipping'); if ($this->_mode == 'add') { $this->getView()->jQuery()->enable(); $script = <<<EOS function refreshCaptcha(id){ \$.getJSON('{$this->getView()->baseUrl()}/order/index/captcha-reload', function(data){ \$("dd#dd_captcha img").attr({src : data['url']}); \$("#"+id).attr({value: data['id']}); }); } EOS; // $this->getView()->headScript()->appendScript($script); // $this->addElement($refresh_captcha); // $this->addElement($captcha); $this->addElement($newsletterSubscription); $this->addElement($termsAgreement); } $this->addElement($submit); $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'account-submit')))); if ($this->_mode == 'add') { $termsAgreement->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_after_checkbox', 'id' => 'dd-terms-agreement')))); } $captchaError = array('badCaptcha' => $this->getView()->getCibleText('validation_message_captcha_error')); $translate = new Zend_Translate('array', $captchaError, $this->getView()->registryGet('languageSuffix')); $this->setTranslator($translate); }