Ejemplo n.º 1
1
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     $this->_addRequiredAsterisks = false;
     parent::__construct($options);
     $baseDir = $this->getView()->baseUrl();
     $this->getView()->headLink()->appendStylesheet("{$this->getView()->baseUrl()}/themes/default/css/login.css", 'all');
     $this->setAttrib('class', 'login');
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->getClientText('login_form_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'loginTextInput');
     $this->addElement($email);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel($this->getView()->getClientText('login_form_password_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'loginTextInput')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
     $this->addElement($password);
     // checkbox for client persistance
     $status = new Zend_Form_Element_Checkbox('stayOn');
     $status->setLabel($this->getView()->getClientText('login_form_stayOn_label'));
     $status->setValue(1);
     $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
     $this->addElement($status);
     // Submit button
     $submit = new Zend_Form_Element_Submit('submit_login');
     $submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix"));
     $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
     $this->addElement($submit);
     $this->setAttrib('class', 'login-form');
 }
Ejemplo n.º 2
0
 public function __construct($options = null)
 {
     parent::__construct($options);
     // salutation
     $salutation = new Zend_Form_Element_Select('salutation');
     $salutation->setLabel('Salutation :')->setAttrib('class', 'largeSelect');
     $categoriesData = $this->getView()->getAllSalutation();
     foreach ($categoriesData as $categoryData) {
         $salutation->addMultiOption($categoryData['C_ID'], $categoryData['CI_Title']);
     }
     $this->addElement($salutation);
     // fName
     $fname = new Zend_Form_Element_Text('firstName');
     $fname->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'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($fname);
     // lName
     $lname = new Zend_Form_Element_Text('lastName');
     $lname->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'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($lname);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $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)->setAttrib('class', 'stdTextInput');
     $this->addElement($email);
 }
Ejemplo n.º 3
0
 public function __construct($options = null)
 {
     $baseDir = $options['baseDir'];
     $pageID = $options['pageID'];
     parent::__construct($options);
     /****************************************/
     // PARAMETERS
     /****************************************/
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     // display news date (Parameter #1)
     $recipient = new Zend_Form_Element_Text('Param1');
     $recipient->setLabel('Acheminer à l\'adresse suivante: ')->setOrder(3)->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate);
     $this->addElement($recipient);
     $this->removeDisplayGroup('parameters');
     $this->addDisplayGroup(array('Param999', 'Param1'), 'parameters');
     $parameters = $this->getDisplayGroup('parameters');
 }
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     parent::__construct($options);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('email');
     $this->setAttrib('class', 'zendFormNewsletter');
     $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)->setAttrib('class', 'stdTextInput');
     $this->addElement($email);
     //unsubscription reason
     $reason = new Zend_Form_Element_Select('reason');
     $this->setAttrib('class', 'zendFormNewsletter');
     $reason->setLabel($this->getView()->getCibleText('form_label_unsubscribe_reason'))->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'reasonSelect', 'id' => ''))))->setAttrib('class', 'stdSelect');
     $selectoptions = array();
     $oRef = new ReferencesObject();
     $options = $oRef->getRefByType('unsubscrArg');
     foreach ($options as $option) {
         $value = $option['R_TypeRef'] . '-' . $option['R_ID'];
         $selectoptions[$option['R_ID']] = $option['RI_Value'];
     }
     $reason->addMultiOptions($selectoptions);
     $reason->addMultiOption(0, 'Autre');
     $this->addElement($reason);
     //unsubscription reason
     $reasonOther = new Zend_Form_Element_Textarea('reasonOther');
     $this->setAttrib('class', 'zendFormNewsletter');
     $reasonOther->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->setDecorators(array('ViewHelper', array('label', array('placement' => 'prepend')), array('Errors', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'reasonOther hidden', 'id' => ''))))->setAttrib('class', 'reasonTextarea');
     $this->addElement($reasonOther);
     $unsubscribeButton = new Zend_Form_Element_Submit('unsubscribe');
     $unsubscribeButton->setLabel($this->getView()->getCibleText('newsletter_title_desabonnement_text'))->setAttrib('id', 'unsubmitSave')->setAttrib('class', 'unsubscribeButton1')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
     $this->addElement($unsubscribeButton);
     $this->addDisplayGroup(array('unsubscribe'), 'actions');
     $actions = $this->getDisplayGroup('actions');
     $this->setDisplayGroupDecorators(array('formElements', 'fieldset', array(array('outerHtmlTag' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd-unsubscribe-button'))));
     $requiredFields = new Zend_Form_Element_Hidden('RequiredFields');
     $requiredFields->setLabel('<span class="field_required">*</span>' . $this->getView()->getCibleText('form_field_required_label') . '<br /><br />');
     $requiredFields->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_required_fields'))));
     $this->addElement($requiredFields);
     $this->setDecorators(array('FormElements', 'Form'));
 }
Ejemplo n.º 5
0
 protected function _emailValidate($isUnique = '')
 {
     $validators = array();
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     array_push($validators, $regexValidate);
     if (!empty($isUnique)) {
         $emailNotFoundInDBValidator = new Zend_Validate_Db_NoRecordExists($this->_object->getDataTableName(), $isUnique);
         $emailNotFoundInDBValidator->setMessage($this->getView()->getClientText('validation_message_email_already_exists'), 'recordFound');
         array_push($validators, $emailNotFoundInDBValidator);
     }
     return $validators;
 }
Ejemplo n.º 6
0
 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'))));
     }
 }
Ejemplo n.º 7
0
 private function _emailRender($property)
 {
     $disp = $property . 'Display';
     $req = $property . 'Required';
     $seq = $property . 'Sequence';
     if ($this->{$disp}) {
         $regexValidate = new Cible_Validate_Email();
         $regexValidate->setMessage($this->view->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
         $field = new Zend_Form_Element_Text($this->{$property});
         $field->setRequired($this->{$req})->setLabel($this->view->getCibleText('form_label' . $property))->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->setAttrib('class', 'stdTextInput')->addValidator($regexValidate);
         if ($this->{$seq}) {
             $field->setOrder($this->{$seq});
         }
         if ($this->{$req}) {
             $field->setAttrib('class', 'stdTextInput ' . $req);
             $this->_addRequiredValidator($field);
         }
         $this->_form->addElement($field);
     }
 }
Ejemplo n.º 8
0
 public function __construct($options = null, $groupsData = array())
 {
     // variable
     parent::__construct($options);
     $baseDir = $options['baseDir'];
     if (array_key_exists('profile', $options)) {
         $profile = $options['profile'];
     } else {
         $profile = false;
     }
     // lastname
     $lname = new Zend_Form_Element_Text('EU_LName');
     $lname->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'))))->setAttrib('class', 'stdTextInput')->setAttrib('escape', false);
     $this->addElement($lname);
     // firstname
     $fname = new Zend_Form_Element_Text('EU_FName');
     $fname->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'))))->setAttrib('class', 'stdTextInput');
     $this->addElement($fname);
     // email
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('EU_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)->setAttrib('class', 'stdTextInput');
     $this->addElement($email);
     // username
     $username = new Zend_Form_Element_Text('EU_Username');
     $username->setLabel($this->getView()->getCibleText('form_label_username'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off');
     $this->addElement($username);
     // new password
     $password = new Zend_Form_Element_Password('EU_Password');
     $password->setLabel($this->getView()->getCibleText('form_label_newPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off');
     $this->addElement($password);
     // password confirmation
     $passwordConfirmation = new Zend_Form_Element_Password('PasswordConfirmation');
     $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput');
     if (!empty($_POST['EU_Password'])) {
         $passwordConfirmation->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('error_message_password_isEmpty'))));
         $Identical = new Zend_Validate_Identical($_POST['EU_Password']);
         $Identical->setMessages(array('notSame' => $this->getView()->getCibleText('error_message_password_notSame')));
         $passwordConfirmation->addValidator($Identical);
     }
     $this->addElement($passwordConfirmation);
     if ($profile != true) {
         // html text
         $textAdministratorGroup = new Cible_Form_Element_Html('htmlAdministratorGroup', array('value' => $this->getView()->getCibleText('label_administrator_actives')));
         $this->addElement($textAdministratorGroup);
         $checkBox = new Zend_Form_Element_MultiCheckbox('groups');
         $checkBox->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'checkbox_list'))));
         //$checkBox->setDescription('<em>Example:</em> mydomain.com')
         //->addDecorator('Description', array('escape' => false));
         //show administrator group (first level)
         $groupAdmin = Cible_FunctionsAdministrators::getAdministratorGroupData(1)->toArray();
         $checkBox->addMultiOption("1", $groupAdmin['EGI_Name'] . " (" . $groupAdmin['EGI_Description'] . ")");
         $i = 0;
         foreach ($groupsData as $group) {
             if ($group['EG_Status'] == 'active') {
                 $checkBox->addMultiOption($group['EG_ID'], $group['EGI_Name'] . " (" . $group['EGI_Description'] . ")");
             }
             $i++;
         }
         $this->addElement($checkBox);
     }
 }
Ejemplo n.º 9
0
    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);
    }
Ejemplo n.º 10
0
    public function __construct($options = null)
    {
        $this->_disabledDefaultActions = true;
        $baseDir = $this->getView()->baseUrl();
        parent::__construct($options);
        $this->getView()->jQuery()->addJavascriptFile("{$this->getView()->baseUrl()}/js/jquery/jquery.maskedinput-1.2.2.min.js");
        $script = <<<EOS

            \$('.phone_format').mask('(999) 999-9999? x99999');
            \$('.postalCode_format').mask('a9a 9a9');
            \$('.birthDate_format').mask('9999-99-99');
EOS;
        $this->getView()->jQuery()->addOnLoad($script);
        $this->setAttrib('class', 'zendFormNewsletter');
        // Salutation
        $salutation = new Zend_Form_Element_Select('salutation');
        $salutation->setLabel('Salutation')->setAttrib('class', 'smallTextInput');
        $greetings = $this->getView()->getAllSalutation();
        foreach ($greetings as $greeting) {
            $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']);
        }
        /* $salutation->setDecorators(array(
               'ViewHelper',
               array('label', array('placement' => 'prepend')),
               array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_form dd_sexe'))
           ));
           $salutation->setAttrib('class', 'newsletter_form_element select_salutations');*/
        $this->addElement($salutation);
        //FirstName
        $firstname = new Zend_Form_Element_Text('firstName');
        $firstname->setLabel($this->getView()->getCibleText('newsletter_fo_form_label_fName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
        /*$firstname->setDecorators(array(
              'ViewHelper',
              array('label', array('placement' => 'prepend')),
              array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_form dd_prenom'))
          ));
          $firstname->setAttrib('class', 'newsletter_form_element text_prenom');*/
        $this->addElement($firstname);
        // LastName
        $lastname = new Zend_Form_Element_Text('lastName');
        $lastname->setLabel($this->getView()->getCibleText('newsletter_fo_form_label_lName'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->setAttrib('class', 'stdTextInput');
        /*$lastname->setDecorators(array(
              'ViewHelper',
              array('label', array('placement' => 'prepend')),
              array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_form dd_nom'))
          )); */
        //$lastname->setAttrib('class', 'newsletter_form_element text_nom');
        $this->addElement($lastname);
        // email
        $regexValidate = new Cible_Validate_Email();
        $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
        $email = new Zend_Form_Element_Text('email');
        $email->setLabel($this->getView()->getCibleText('newsletter_fo_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)->setAttrib('class', 'stdTextInput');
        /*$email->setDecorators(array(
              'ViewHelper',
              array('label', array('placement' => 'prepend')),
              array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_form dd_email'))
          ));*/
        // $email->setAttrib('class', 'newsletter_form_element text_email');
        $this->addElement($email);
        // Captcha
        $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => $this->getView()->getCibleText('newsletter_fo_form_label_securityCaptcha_newsletter'), 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Word', 'wordLen' => 5, 'fontSize' => 18, 'height' => 50, 'width' => 100, '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->addDecorators(array(array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'id' => 'dd_captcha'))))->addDecorator('Label', array('class' => 'label_long_required'));
        $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);
        // Refresh button
        $refresh_captcha = new Zend_Form_Element_Button('refresh_captcha_newsletter');
        $refresh_captcha->setLabel($this->getView()->getCibleText('button_refresh_captcha'))->setAttrib('onclick', "refreshCaptcha('captcha-id')")->setAttrib('class', 'stdButton')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
        $refresh_captcha->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd_captcha'))));
        //var_dump($this);
        // $captcha->addDecorator( new Zend_Form_Decorator_Label(array('tag' => 'dt', 'class' => 'label-designsadsdsada')));
        //$label = $captcha->getDecorator('label');
        //$label->setOption('class', 'label_lond_message');
        //$label->setOption('placement', 'prepend');
        //displayGroup
        //$captcha->removeDecorator('DtDdWrapper');
        $this->addElement($captcha);
        $this->addElement($refresh_captcha);
        // action button
        $subscribeButton = new Zend_Form_Element_Submit('subscribe');
        $subscribeButton->setLabel($this->getView()->getCibleText('button_submit'))->setAttrib('id', 'submitSave')->setAttrib('class', 'stdButton')->removeDecorator('Label')->removeDecorator('DtDdWrapper');
        $this->addElement($subscribeButton);
        $this->addDisplayGroup(array('subscribe'), 'actions');
        $requiredFields = new Zend_Form_Element_Hidden('RequiredFields');
        $requiredFields->setLabel('<span class="field_required">*</span>' . $this->getView()->getCibleText('form_field_required_label') . '<br /><br />');
        $requiredFields->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'label_required_fields'))));
        $this->addElement($requiredFields);
        $actions = $this->getDisplayGroup('actions');
        $this->setDisplayGroupDecorators(array('formElements', 'fieldset', array(array('outerHtmlTag' => 'HtmlTag'), array('tag' => 'dd', 'class' => 'dd-submit-button'))));
        $invi = new Zend_Form_Element_Text('language');
        $invi->setAttrib('class', 'stdTextInputInvisible')->setValue(Zend_Registry::get("languageID"));
        $this->addElement($invi);
        /*  $elements = $this->getElements();
            foreach($elements as $element) {
                $element->removeDecorator('DtDdWrapper')
                ->removeDecorator('HtmlTag');
                //->removeDecorator('Label');
            }*/
        // reset form decorators to remove the 'dl' wrapper
        $this->setDecorators(array('FormElements', 'Form'));
    }
Ejemplo n.º 11
0
 public function __construct($options = null)
 {
     //        $this->_disabledDefaultActions = true;
     //        $this->_object = $options['object'];
     unset($options['object']);
     parent::__construct($options);
     $langId = 1;
     if (!empty($options['mode']) && $options['mode'] == 'edit') {
         $this->_mode = 'edit';
     }
     if (!empty($options['langId'])) {
         $langId = $options['langId'];
     }
     //        $this->getView()->headScript()->appendFile("{$this->getView()->baseUrl()}/js/jquery/jquery.maskedinput-1.2.2.min.js");
     //        // 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('GP_Email');
     $email->setLabel($this->getView()->getCibleText('form_label_email'))->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator($regexValidate)->setAttribs(array('maxlength' => 50, 'class' => ' email stdTextInput'));
     if ($this->_mode == 'add') {
         $email->addValidator($emailNotFoundInDBValidator);
     }
     $this->addElement($email);
     if ($this->_mode == 'edit') {
         // Salutation
         $salutation = new Zend_Form_Element_Select('GP_Salutation');
         $salutation->setLabel('Salutation :')->setAttrib('class', 'largeSelect');
         $greetings = $this->getView()->getAllSalutation();
         foreach ($greetings as $greeting) {
             $salutation->addMultiOption($greeting['S_ID'], $greeting['ST_Value']);
         }
         $this->addElement($salutation);
         //FirstName
         $firstname = new Zend_Form_Element_Text('GP_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('maxlength' => 20, 'class' => 'required stdTextInput'));
         $this->addElement($firstname);
         // LastName
         $lastname = new Zend_Form_Element_Text('GP_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('maxlength' => 20, 'class' => 'required stdTextInput'));
         $this->addElement($lastname);
         $languages = new Zend_Form_Element_Select('GP_Language');
         $languages->setLabel($this->getView()->getCibleText('form_label_language'));
         foreach (Cible_FunctionsGeneral::getAllLanguage() as $lang) {
             $languages->addMultiOption($lang['L_ID'], $lang['L_Title']);
         }
         $this->addElement($languages);
     }
     // new password
     $password = new Zend_Form_Element_Password('GP_Password');
     $password->setLabel($this->getView()->getCibleText('form_label_newPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off');
     // password confirmation
     $passwordConfirmation = new Zend_Form_Element_Password('passwordConfirmation');
     $passwordConfirmation->setLabel($this->getView()->getCibleText('form_label_confirmNewPwd'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'stdTextInput')->setAttrib('autocomplete', 'off');
     if (Zend_Registry::get('pwdOn')) {
         $this->addElement($password);
         $this->addElement($passwordConfirmation);
     }
     $this->setAttrib('id', 'genericProfile');
 }