本文整理汇总了PHP中Zend_Form_Element_Password::addFilter方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Password::addFilter方法的具体用法?PHP Zend_Form_Element_Password::addFilter怎么用?PHP Zend_Form_Element_Password::addFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Password
的用法示例。
在下文中一共展示了Zend_Form_Element_Password::addFilter方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setMethod('post');
// $this->setAction('/index/login');
$this->setAttrib('id', 'msform');
$email = new Zend_Form_Element_Text('email');
$email->setAttrib('placeholder', 'E-mail');
$email->setAttrib('autocomplete', 'off');
$email->addFilter('StripTags');
$email->addFilter('HtmlEntities');
$email->addFilter('StringTrim');
$email->setRequired(true)->addErrorMessage('Username Required');
$email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
$email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$password = new Zend_Form_Element_Password('password');
$password->setAttrib('placeholder', 'Password');
$password->setAttrib('autocomplete', 'off');
$password->addFilter('StripTags');
$password->addFilter('HtmlEntities');
$password->addFilter('StringTrim');
$password->setRequired(true)->addErrorMessage('Password Required');
$password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$link = new Zend_Form_Element_Note('forgot_password', array('value' => '<a href="#" id="link">Forgot your password ?</a>'));
$submit = new Zend_Form_Element_Submit('SignIn');
$submit->setLabel('Sign In');
$submit->setAttrib('class', 'btn btn-info');
$register = new Zend_Form_Element_Button('register');
$register->setLabel('Register');
$register->setAttrib('class', 'btn btn-warning');
$this->addElements(array($email, $password, $submit, $register, $link));
$this->setElementDecorators(array('ViewHelper'));
$submit->setDecorators(array('ViewHelper'));
$register->setDecorators(array('ViewHelper'));
$this->setDecorators(array('FormElements', 'Form'));
}
示例2: _repetirNovaSenha
private function _repetirNovaSenha()
{
$e = new Zend_Form_Element_Password('repetir_nova_senha');
$e->setRequired(true);
$e->addFilter('StripTags');
$e->addFilter('StringTrim');
$e->setAttrib('data-parsley-required', 'true');
$e->setAttrib('data-parsley-equalto', '#nova_senha');
$e->addValidator('stringLength', false, array(6, 15));
$e->setAttrib('placeholder', _('Repeat New Password'));
$e->setAttrib('class', 'form-control input-lg');
return $e;
}
示例3: init
public function init()
{
/* Form Elements & Other Definitions Here ... */
$element = new Zend_Form_Element_Text('login');
$element->setLabel('Login')->setRequired();
$validator = new Zend_Validate_NotEmpty();
$validator->setMessage('Le login est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
$element->addValidator($validator);
$validator = new Zend_Validate_StringLength();
$validator->setMax(40);
$element->addValidator($validator);
$filter = new Zend_Filter_StringTrim();
$element->addFilter($filter);
$this->addElement($element);
$element = new Zend_Form_Element_Password('password');
$element->setLabel('Mot de passe')->setRequired();
$validator = new Zend_Validate_NotEmpty();
$validator->setMessage('Le mot de passe est obligatoire', Zend_Validate_NotEmpty::IS_EMPTY);
$element->addValidator($validator);
$validator = new Zend_Validate_StringLength();
$validator->setMax(40);
$element->addValidator($validator);
$filter = new Zend_Filter_StringTrim();
$element->addFilter($filter);
$this->addElement($element);
}
示例4: init
public function init()
{
$this->setName('pass-update');
$pwd_current = new Zend_Form_Element_Password('pwd_current', array('disableLoadDefaultDecorators' => true));
$pwd_current->setRequired(true)->setLabel('Current Password')->setAttrib("class", "form-control")->addValidator('StringLength', false, array(1, 20))->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('Label');
$pwd = new Zend_Form_Element_Password('pwd', array('disableLoadDefaultDecorators' => true));
$pwd->setRequired(true)->setLabel('New Password')->addFilter('StripTags')->setAttrib("class", "form-control")->addValidator('StringLength', false, array(1, 20))->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('HtmlTag')->removeDecorator('Label');
$pwd_confirm = new Zend_Form_Element_Password('pwd_confirm', array('disableLoadDefaultDecorators' => true));
//$pwd_confirm->setRequired(true)
$pwd_confirm->addFilter('StripTags')->setAttrib("class", "form-control")->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator('Identical', false, array('token' => 'pwd'))->removeDecorator('HtmlTag')->setLabel('Confirm Password')->removeDecorator('Label');
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('id', 'submitbutton');
$submit->setAttrib('class', 'btn btn-lg btn-primary float-right')->removeDecorator('HtmlTag')->removeDecorator('Label')->setLabel("Update Password");
$this->setElementDecorators(array('Errors', 'ViewHelper', array('Description', array('tag' => 'td' + ' ')), array('decorator' => array('td' => 'HtmlTag'), 'options' => array('tag' => 'td')), array('Label', array('tag' => 'td')), array('decorator' => array('tr' => 'HtmlTag'), 'options' => array('tag' => 'tr'))), array('pwd_current', 'pwd', 'pwd_confirm'));
$this->addElement('hash', 'csrf', array('ignore' => true));
$this->addElements(array($pwd_current, $pwd, $pwd_confirm, $submit));
}
示例5: init
public function init()
{
/*
$this->addElementPrefixPath('Application_Validate',
'../application/validate',
'validate');
* */
$hidden = new Zend_Form_Element_Hidden('user_id');
$hidden->setDecorators(array('ViewHelper'));
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('login');
$login->setLabel('Username:');
$login->setAttrib('class', 'input_text');
$login->setRequired(true);
$login->addFilter('StringTrim');
//$login->addValidator('UserNameValidate');
$this->addElement($login);
$password = new Zend_Form_Element_Password('password');
$password->setLabel('Password:');
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator('NotEmpty');
$this->addElement($password);
$firstName = new Zend_Form_Element_Text('first_name');
$firstName->setLabel('Firstname:');
$firstName->setAttrib('class', 'input_text');
$firstName->setRequired(true);
$firstName->addFilter('StringTrim');
$firstName->addValidator('NotEmpty');
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('last_name');
$lastName->setLabel('Lastname:');
$lastName->setAttrib('class', 'input_text');
$lastName->setRequired(true);
$lastName->addFilter('StringTrim');
$lastName->addValidator('NotEmpty');
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('email');
$email->setLabel('Email:');
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->addValidator('EmailAddress');
$this->addElement($email);
$skype = new Zend_Form_Element_Text('skype');
$skype->setLabel('Skype:');
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('jabber');
$jabber->setLabel('Jabber:');
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator('EmailAddress');
$this->addElement($jabber);
$select = new Zend_Form_Element_Select('type');
$select->setLabel('User Type:');
$select->setAttrib('class', 'input_select');
$select->setAttrib('style', 'width: 40%');
$select->setMultiOptions(array("G" => "Guest", "H" => "DJ", "P" => "Program Manager", "A" => "Admin"));
$select->setRequired(true);
$this->addElement($select);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setAttrib('class', 'ui-button ui-state-default right-floated');
$submit->setIgnore(true);
$submit->setLabel('Submit');
$this->addElement($submit);
}
示例6: __construct
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') {
//.........这里部分代码省略.........
示例7: init
public function init()
{
$this->setMethod('post');
$this->setAttrib('id', 'registerInfo');
$firstName = new Zend_Form_Element_Text('firstName');
$firstName->setAttrib('autocomplete', 'off');
$firstName->setAttrib('maxlength', '55');
$firstName->setLabel('First Name' . '*');
$firstName->addFilter('StripTags');
$firstName->addFilter('HtmlEntities');
$firstName->addFilter('StringTrim');
$firstName->setRequired(true)->addErrorMessage('Required Field');
$firstName->addValidator('Regex', true, array('/^[a-zA-Z0-9.-\\s]*$/'))->addErrorMessage('Invalid characters used');
$firstName->addValidator('StringLength', true, array(1, 95))->addErrorMessage('Invalid Length');
$lastName = new Zend_Form_Element_Text('lastName');
$lastName->setAttrib('autocomplete', 'off');
$lastName->setAttrib('maxlength', '55');
$lastName->setLabel('Last Name' . '*');
$lastName->addFilter('StripTags');
$lastName->addFilter('HtmlEntities');
$lastName->addFilter('StringTrim');
$lastName->setRequired(true)->addErrorMessage('Required Field');
$lastName->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\\s]*$/'))->addErrorMessage('Invalid characters used');
$telephone = new Zend_Form_Element_Text('telephone');
$telephone->setAttrib('autocomplete', 'off');
$telephone->setAttrib('maxlength', '15');
$telephone->setLabel('Telephone' . '*');
$telephone->addFilter('StripTags');
$telephone->addFilter('HtmlEntities');
$telephone->addFilter('StringTrim');
$telephone->setRequired(true)->addErrorMessage('Required Field');
$telephone->addValidator('Regex', true, array('/^[0-9.+\\s]*$/'))->addErrorMessage('Invalid characters used');
$email = new Zend_Form_Element_Text('emailRegister');
$email->setAttrib('autocomplete', 'off');
$email->setLabel('Email' . '*');
$email->addFilter('StripTags');
$email->addFilter('HtmlEntities');
$email->addFilter('StringTrim');
$email->setRequired(true)->addErrorMessage('Required');
$email->addValidator('EmailAddress')->addErrorMessage('Invalid Email used');
$email->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$password = new Zend_Form_Element_Password('passwordRegister');
$password->setAttrib('autocomplete', 'off');
$password->setLabel('Password*');
$password->addFilter('StripTags');
$password->addFilter('HtmlEntities');
$password->addFilter('StringTrim');
$password->setRequired(true)->addErrorMessage('Password Required');
$password->addValidator('StringLength', true, array(0, 255))->addErrorMessage('Required Field');
$driverCheck = new Zend_Form_Element_Checkbox('driverCheck');
$driverCheck->setDescription('Driver');
$driverCheck->setUncheckedValue(0);
$carModel = new Zend_Form_Element_Text('carModel');
$carModel->setAttrib('autocomplete', 'off');
$carModel->setAttrib('maxlength', '55');
$carModel->setLabel('Car Model' . '*');
$carModel->addFilter('StripTags');
$carModel->addFilter('HtmlEntities');
$carModel->addFilter('StringTrim');
$carModel->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\\s]*$/'))->addErrorMessage('Invalid characters used');
$carMake = new Zend_Form_Element_Text('carMake');
$carMake->setAttrib('autocomplete', 'off');
$carMake->setAttrib('maxlength', '55');
$carMake->setLabel('Car Make' . '*');
$carMake->addFilter('StripTags');
$carMake->addFilter('HtmlEntities');
$carMake->addFilter('StringTrim');
$carMake->addValidator('Regex', true, array('/^[a-zA-Z0-9.,:-\\s]*$/'))->addErrorMessage('Invalid characters used');
$driverLicense = new Zend_Form_Element_Text('driverLicense');
$driverLicense->setAttrib('autocomplete', 'off');
$driverLicense->setAttrib('readonly', 'readonly');
$driverLicense->setAttrib('maxlength', '10');
$driverLicense->setLabel('Driver License Since' . '*');
$driverLicense->addFilter('StripTags');
$driverLicense->addFilter('HtmlEntities');
$driverLicense->addFilter('StringTrim');
$driverLicense->addValidator('Regex', true, array('/^[0-9.\\s]*$/'))->addErrorMessage('Invalid characters used');
$this->addElements(array($firstName, $lastName, $telephone, $email, $password, $driverCheck, $carModel, $carMake, $driverLicense));
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
$this->setDecorators(array('FormElements', 'Form', array('HtmlTag', array('tag' => 'div', 'id' => 'registerFormContainer'))));
$driverCheck->setDecorators(array('ViewHelper', array('Description', array('placement' => Zend_Form_Decorator_Abstract::APPEND, 'tag' => 'em', 'class' => 'activeCheck')), array('HtmlTag', array('tag' => 'div', 'id' => 'driverCheckBox'))));
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Register');
$submit->setAttrib('class', 'btn btn-success pull-right');
$submit->setAttrib('id', 'submitUser');
$this->addElement($submit);
$submit->setDecorators(array('ViewHelper'));
}
示例8: init
public function init()
{
/*
$this->addElementPrefixPath('Application_Validate',
'../application/validate',
'validate');
* */
$currentUser = Application_Model_User::getCurrentUser();
$currentUserId = $currentUser->getId();
$userData = Application_Model_User::GetUserData($currentUserId);
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
$notDemoValidator = new Application_Validate_NotDemoValidate();
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'form/edit-user.phtml', "currentUser" => $currentUser->getLogin()))));
$this->setAttrib('id', 'current-user-form');
$hidden = new Zend_Form_Element_Hidden('cu_user_id');
$hidden->setDecorators(array('ViewHelper'));
$hidden->setValue($userData["id"]);
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('cu_login');
$login->setLabel(_('Username:'));
$login->setValue($userData["login"]);
$login->setAttrib('class', 'input_text');
$login->setAttrib('readonly', 'readonly');
$login->setRequired(true);
$login->addValidator($notEmptyValidator);
$login->addFilter('StringTrim');
$login->setDecorators(array('viewHelper'));
$this->addElement($login);
$password = new Zend_Form_Element_Password('cu_password');
$password->setLabel(_('Password:'));
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator($notEmptyValidator);
$password->setDecorators(array('viewHelper'));
$this->addElement($password);
$passwordVerify = new Zend_Form_Element_Password('cu_passwordVerify');
$passwordVerify->setLabel(_('Verify Password:'));
$passwordVerify->setAttrib('class', 'input_text');
$passwordVerify->setRequired(true);
$passwordVerify->addFilter('StringTrim');
$passwordVerify->addValidator($notEmptyValidator);
$passwordVerify->addValidator($notDemoValidator);
$passwordVerify->setDecorators(array('viewHelper'));
$this->addElement($passwordVerify);
$firstName = new Zend_Form_Element_Text('cu_first_name');
$firstName->setLabel(_('Firstname:'));
$firstName->setValue($userData["first_name"]);
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$firstName->setDecorators(array('viewHelper'));
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('cu_last_name');
$lastName->setLabel(_('Lastname:'));
$lastName->setValue($userData["last_name"]);
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$lastName->setDecorators(array('viewHelper'));
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('cu_email');
$email->setLabel(_('Email:'));
$email->setValue($userData["email"]);
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->setRequired(true);
$email->addValidator($notEmptyValidator);
$email->addValidator($emailValidator);
$email->setDecorators(array('viewHelper'));
$this->addElement($email);
$cellPhone = new Zend_Form_Element_Text('cu_cell_phone');
$cellPhone->setLabel(_('Mobile Phone:'));
$cellPhone->setValue($userData["cell_phone"]);
$cellPhone->setAttrib('class', 'input_text');
$cellPhone->addFilter('StringTrim');
$cellPhone->setDecorators(array('viewHelper'));
$this->addElement($cellPhone);
$skype = new Zend_Form_Element_Text('cu_skype');
$skype->setLabel(_('Skype:'));
$skype->setValue($userData["skype_contact"]);
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$skype->setDecorators(array('viewHelper'));
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('cu_jabber');
$jabber->setLabel(_('Jabber:'));
$jabber->setValue($userData["jabber_contact"]);
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator($emailValidator);
$jabber->setDecorators(array('viewHelper'));
$this->addElement($jabber);
$locale = new Zend_Form_Element_Select("cu_locale");
$locale->setLabel(_("Language:"));
$locale->setMultiOptions(Application_Model_Locale::getLocales());
$locale->setValue(Application_Model_Preference::GetUserLocale($currentUserId));
$locale->setDecorators(array('ViewHelper'));
$this->addElement($locale);
$timezone = new Zend_Form_Element_Select("cu_timezone");
$timezone->setLabel(_("Interface Timezone:"));
//.........这里部分代码省略.........
示例9: __construct
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
//.........这里部分代码省略.........
示例10: init
public function init()
{
/*
$this->addElementPrefixPath('Application_Validate',
'../application/validate',
'validate');
* */
$notEmptyValidator = Application_Form_Helper_ValidationTypes::overrideNotEmptyValidator();
$emailValidator = Application_Form_Helper_ValidationTypes::overrideEmailAddressValidator();
$notDemoValidator = new Application_Validate_NotDemoValidate();
$this->setAttrib('id', 'user_form');
$hidden = new Zend_Form_Element_Hidden('user_id');
$hidden->setDecorators(array('ViewHelper'));
$this->addElement($hidden);
$login = new Zend_Form_Element_Text('login');
$login->setLabel(_('Username:'));
$login->setAttrib('class', 'input_text');
$login->setRequired(true);
$login->addValidator($notEmptyValidator);
$login->addFilter('StringTrim');
//$login->addValidator('UserNameValidate');
$this->addElement($login);
$password = new Zend_Form_Element_Password('password');
$password->setLabel(_('Password:'));
$password->setAttrib('class', 'input_text');
$password->setRequired(true);
$password->addFilter('StringTrim');
$password->addValidator($notEmptyValidator);
$this->addElement($password);
$passwordVerify = new Zend_Form_Element_Password('passwordVerify');
$passwordVerify->setLabel(_('Verify Password:'));
$passwordVerify->setAttrib('class', 'input_text');
$passwordVerify->setRequired(true);
$passwordVerify->addFilter('StringTrim');
$passwordVerify->addValidator($notEmptyValidator);
$passwordVerify->addValidator($notDemoValidator);
$this->addElement($passwordVerify);
$firstName = new Zend_Form_Element_Text('first_name');
$firstName->setLabel(_('Firstname:'));
$firstName->setAttrib('class', 'input_text');
$firstName->addFilter('StringTrim');
$this->addElement($firstName);
$lastName = new Zend_Form_Element_Text('last_name');
$lastName->setLabel(_('Lastname:'));
$lastName->setAttrib('class', 'input_text');
$lastName->addFilter('StringTrim');
$this->addElement($lastName);
$email = new Zend_Form_Element_Text('email');
$email->setLabel(_('Email:'));
$email->setAttrib('class', 'input_text');
$email->addFilter('StringTrim');
$email->setRequired(true);
$email->addValidator($notEmptyValidator);
$email->addValidator($emailValidator);
$this->addElement($email);
$cellPhone = new Zend_Form_Element_Text('cell_phone');
$cellPhone->setLabel(_('Mobile Phone:'));
$cellPhone->setAttrib('class', 'input_text');
$cellPhone->addFilter('StringTrim');
$this->addElement($cellPhone);
$skype = new Zend_Form_Element_Text('skype');
$skype->setLabel(_('Skype:'));
$skype->setAttrib('class', 'input_text');
$skype->addFilter('StringTrim');
$this->addElement($skype);
$jabber = new Zend_Form_Element_Text('jabber');
$jabber->setLabel(_('Jabber:'));
$jabber->setAttrib('class', 'input_text');
$jabber->addFilter('StringTrim');
$jabber->addValidator($emailValidator);
$this->addElement($jabber);
$select = new Zend_Form_Element_Select('type');
$select->setLabel(_('User Type:'));
$select->setAttrib('class', 'input_select');
$select->setAttrib('style', 'width: 40%');
$select->setMultiOptions(array("G" => _("Guest"), "H" => _("DJ"), "P" => _("Program Manager"), "A" => _("Admin")));
$select->setRequired(true);
$this->addElement($select);
$saveBtn = new Zend_Form_Element_Button('save_user');
$saveBtn->setAttrib('class', 'btn btn-small right-floated');
$saveBtn->setIgnore(true);
$saveBtn->setLabel(_('Save'));
$this->addElement($saveBtn);
}