本文整理汇总了PHP中Zend_Form_Element_Password::setDecorators方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Password::setDecorators方法的具体用法?PHP Zend_Form_Element_Password::setDecorators怎么用?PHP Zend_Form_Element_Password::setDecorators使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Password
的用法示例。
在下文中一共展示了Zend_Form_Element_Password::setDecorators方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$this->setMethod('post');
$this->setAction('/login');
$this->setOptions(array('class' => 'niceform', 'id' => 'form1'));
$this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
//$this->getDecorator('HtmlTag')->setOptions(array('tag' => 'fieldset'));
/*$this->setDecorators(array(
'Errors',
'FormElements',
array('HtmlTag', array('tag' => 'fieldset')),
'Form'
));*/
$username = new Zend_Form_Element_Text('username');
$username->setLabel('username');
$username->setRequired(true);
$username->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
$pass = new Zend_Form_Element_Password('password');
$pass->setlabel('password');
$pass->setRequired(true);
$pass->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array('Label', array('tag' => 'td'), array(array('row' => 'HtmlTag'), array('tag' => 'tr')))));
/*
$pass->setDecorators(array(
'ViewHelper',
'Errors',
array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')),
array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')),
array(array('row' => 'HtmlTag'), array('tag' => 'tr')),
));
*/
$submit = new Zend_Form_Element_Submit('login');
$submit->setLabel('login');
$submit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'element')), array(array('label' => 'HtmlTag'), array('tag' => 'td', 'placement' => 'prepend')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$this->addElements(array($username, $pass, $submit));
}
示例2: init
/**
*
* Change password form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/ChangePassword.phtml'))));
$Profiles = new Application_Model_Profiles();
// fields
$password_old = new Zend_Form_Element_Password('passwordold');
$password_old->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->setErrorMessages(array($this->translator->translate('Password is required')))->setLabel($this->translator->translate('Old Password:'))->setAttrib('class', 'form-control');
// check if blank password (facebook-registered user) and remove old password field if so
if (Zend_Auth::getInstance()->hasIdentity()) {
$profile = $Profiles->getProfile(Zend_Auth::getInstance()->getIdentity()->name);
if ($profile->password == '') {
$password_old->setAttrib('class', 'hidden');
$password_old->setRequired(false);
$password_old->setLabel('');
}
}
$password1 = new Zend_Form_Element_Password('password1');
$password1->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('StringLength', false, array(5))->setErrorMessages(array($this->translator->translate('Min 5 characters')))->setLabel($this->translator->translate('New Password:'))->setAttrib('class', 'form-control');
$password2 = new Zend_Form_Element_Password('password2');
$password2->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('Identical', false, array('token' => 'password1'))->setErrorMessages(array($this->translator->translate('The passwords do not match')))->setLabel($this->translator->translate('Confirm Password:'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('changepass');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Change Password'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($password_old, $password1, $password2, $submit));
$this->postInit();
}
示例3: getForm
function getForm()
{
$form = new Cible_Form(array('disabledDefaultActions' => true));
$base_dir = $this->getFrontController()->getBaseUrl();
$redirect = str_replace($base_dir, '', $this->_request->getParam('redirect'));
$form->setAction("{$base_dir}/auth/login")->setMethod('post');
$form->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
$form->setAttrib('class', 'auth-form');
$username = new Zend_Form_Element_Text('username');
$username->setLabel(Cible_Translation::getCibleText('form_label_username'));
$username->setRequired(true);
$username->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required'))));
$username->setAttrib('class', 'loginTextInput');
$username->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'username')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'openOnly' => true))));
$form->addElement($username);
$password = new Zend_Form_Element_Password('password');
$password->setLabel(Cible_Translation::getCibleText('form_label_password'));
$password->setRequired(true);
$password->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => Cible_Translation::getCibleText('error_field_required'))));
$password->setAttrib('class', 'loginTextInput');
$password->setDecorators(array('ViewHelper', 'Description', 'Errors', 'Label', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'class' => 'password')), array(array('row' => 'HtmlTag'), array('tag' => 'tr', 'closeOnly' => true))));
$form->addElement($password);
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel(Cible_Translation::getCibleText('button_authenticate'))->setAttrib('class', 'loginButton')->setAttrib('onmouseover', 'this.className=\'loginButtonOver\';')->setAttrib('onmouseout', 'this.className=\'loginButton\';')->removeDecorator('label')->setDecorators(array('ViewHelper', 'Description', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2', 'align' => 'right', 'class' => 'submit')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$form->addElement($submit);
$redirect_hidden = new Zend_Form_Element_Hidden('redirect');
$redirect_hidden->setValue($redirect)->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => '2')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))));
$form->addElement($redirect_hidden);
return $form;
}
示例4: init
public function init()
{
$this->clearDecorators();
$this->addElementPrefixPath('Pas_Validate', 'Pas/Validate/', 'validate');
$this->addPrefixPath('Pas_Form_Element', 'Pas/Form/Element/', 'element');
$decorators = array(array('ViewHelper'), array('Description', array('placement' => 'append', 'class' => 'info')), array('Errors', array('placement' => 'append', 'class' => 'error', 'tag' => 'li')), array('Label', array('separator' => ' ', 'requiredSuffix' => ' *', 'class' => 'leftalign')), array('HtmlTag', array('tag' => 'li')));
$oldpassword = new Zend_Form_Element_Password('oldpassword');
$oldpassword->setLabel('Your old password: ');
$oldpassword->setRequired(true)->addValidator('RightPassword')->addFilters(array('StripTags', 'StringTrim'));
$oldpassword->setDecorators($decorators);
$password = new Zend_Form_Element_Password("password");
$password->setLabel("New password:")->addValidator("NotEmpty")->setRequired(true)->addFilters(array('StripTags', 'StringTrim'))->setDecorators($decorators)->addValidator('IdenticalField', false, array('password2', ' confirm password field'));
// identical field validator with custom messages
$hash = new Zend_Form_Element_Hash('csrf');
$hash->setValue($this->_config->form->salt)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('label')->setTimeout(60);
$this->addElement($hash);
$password2 = new Zend_Form_Element_Password("password2");
$password2->setLabel("Confirm password:")->addValidator("NotEmpty")->addFilters(array('StripTags', 'StringTrim'))->setRequired(true)->setDecorators($decorators);
$submit = new Zend_Form_Element_Submit('submit');
$submit->clearDecorators();
$submit->addDecorators(array(array('ViewHelper'), array('HtmlTag', array('tag' => 'div', 'class' => 'submit'))));
$submit->setAttrib('class', 'large')->setLabel('Change password');
$this->addElement($submit);
$this->addElements(array($oldpassword, $password, $password2, $submit));
$this->addDisplayGroup(array('oldpassword', 'password', 'password2'), 'userdetails');
$this->addDecorator('FormElements')->addDecorator(array('ListWrapper' => 'HtmlTag'), array('tag' => 'div'))->addDecorator('FieldSet')->addDecorator('Form');
$this->userdetails->removeDecorator('DtDdWrapper');
$this->userdetails->removeDecorator('FieldSet');
$this->userdetails->addDecorator(array('DtDdWrapper' => 'HtmlTag'), array('tag' => 'ul'));
$this->addDisplayGroup(array('submit'), 'submit');
$this->setLegend('Edit account details: ');
}
示例5: init
public function init()
{
/* $email = $this->addElement('text', 'email', array(
'filters' => array('StringTrim', 'StringToLower'),
'validators' => array(
'EmailAddress',
),
'required' => true,
'label' => $this->translate->_("Email"),
'decorators' => $this->elementDecorators,
'description'=>"mustbe lower..."
)); */
$email = new Zend_Form_Element_Text("email");
$email->setLabel('Email');
$email->setDecorators($this->elementDecorators);
$email->addValidator("EmailAddress");
$email->addValidator("ExistUser", false, array("email"));
$email->addPrefixPath('VC_Validate', 'VC/Validate/', 'validate');
$this->addElements(array($email));
/*$username = $this->addElement('text', 'username', array(
'filters' => array('StringTrim', 'StringToLower'),
'validators' => array(
'Alpha',
array('StringLength', false, array(3, 20)),
),
'required' => true,
'label' => $this->translate->_("Username"),
'decorators' => $this->elementDecorators,
));
*/
$token = $this->addElement('hidden', 'token', array('disableLoadDefaultDecorators' => true));
$password = $this->addElement('password', 'password', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(6, 20))), 'required' => true, 'label' => $this->translate->_("Password"), 'decorators' => $this->elementDecorators));
/* $re_password = $this->addElement('password', 'password_confirm', array(
'filters' => array('StringTrim'),
'validators' => array(
array('SL_ValidatorMatch', false, array("password")),
),
'required' => true,
'label' => $this->translate->_("Confirm password"),
'decorators' => $this->elementDecorators,
)); */
$re_password = new Zend_Form_Element_Password("password_confirm");
$re_password->setLabel('Confirm Password');
$re_password->setDecorators($this->elementDecorators);
$re_password->addValidator("PasswordConfirmation", false, array("password"));
$re_password->addPrefixPath('VC_Validate', 'VC/Validate/', 'validate');
$this->addElements(array($re_password));
$username = $this->addElement('text', 'fullname', array('filters' => array('StringTrim'), 'validators' => array(array('StringLength', false, array(3, 70))), 'required' => true, 'label' => $this->translate->_("Full name"), 'decorators' => $this->elementDecorators));
// Add a captcha
$this->addElement('captcha', 'captcha', array('label' => $this->translate->_("Please enter the 5 letters displayed below:"), 'required' => true, 'captcha' => array('captcha' => 'Figlet', 'wordLen' => 5, 'timeout' => 300)));
$login = $this->addElement('submit', 'login', array('required' => false, 'ignore' => true, 'label' => $this->translate->_("Register"), 'decorators' => $this->buttonDecorators));
}
示例6: init
public function init()
{
// administrador_email
$administrador_email = new Zend_Form_Element_Text('administrador_email');
$administrador_email->setRequired();
$administrador_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$administrador_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe seu e-mail'));
// administrador_senha
$administrador_senha = new Zend_Form_Element_Password('administrador_senha');
$administrador_senha->setRequired();
$administrador_senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$administrador_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua senha'));
$this->addElements(array($administrador_email, $administrador_senha));
parent::init();
}
示例7: init
/**
*
* Forgot password form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/ChangeForgottenPassword.phtml'))));
// fields
$password1 = new Zend_Form_Element_Password('password1');
$password1->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('StringLength', false, array(5))->setErrorMessages(array($this->translator->translate('Min 5 characters')))->setLabel($this->translator->translate('New Password:'))->setAttrib('class', 'form-control');
$password2 = new Zend_Form_Element_Password('password2');
$password2->setDecorators(array('ViewHelper', 'Errors'))->setAttrib('autocomplete', 'off')->setRequired(true)->addValidator('Identical', false, array('token' => 'password1'))->setErrorMessages(array($this->translator->translate('The passwords do not match')))->setLabel($this->translator->translate('Confirm Password:'))->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('changepass');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Change Password'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($password1, $password2, $submit));
$this->postInit();
}
示例8: init
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');
}
示例9: init
public function init()
{
// senha
$senha = new Zend_Form_Element_Password('senha');
$senha->setLabel('Nova senha: ');
$senha->setRequired();
$senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe sua nova senha'));
// confirma a senha
$confirma_senha = new Zend_Form_Element_Password('confirma_senha');
$confirma_senha->setLabel('Confirme a nova senha: ');
$confirma_senha->setRequired();
$confirma_senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$confirma_senha->addValidator(new App_Validate_RecuperaSenha());
$confirma_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Confirme sua nova senha'));
$this->addElements(array($senha, $confirma_senha));
parent::init();
}
示例10: init
/**
*
* Login page form
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname), true, false);
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Login.phtml'))));
// fields
$name = new Zend_Form_Element_Text('name');
$name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Username or email'))->addFilter('StringToLower')->setErrorMessages(array($this->translator->translate('Enter your username or email')))->setAttrib('class', 'form-control')->setRequired(true);
$password = new Zend_Form_Element_Password('password');
$password->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Password'))->setErrorMessages(array($this->translator->translate('Enter your password')))->setAttrib('class', 'form-control')->setAttrib('autocomplete', 'off')->setRequired(true);
$remember = new Zend_Form_Element_Checkbox('remember_me');
$remember->setDecorators(array('ViewHelper', 'Errors'))->setValue('1')->setLabel($this->translator->translate('Remember me'));
$login = new Zend_Form_Element_Submit('loginbtn');
$login->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Sign In'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($name, $password, $login, $remember));
$this->postInit();
}
示例11: init
/**
*
* Small register form on login page
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname), true, false);
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Register.phtml'))));
$username_minchars = Zend_Registry::get('config')->get('username_minchars');
$username_maxchars = Zend_Registry::get('config')->get('username_maxchars');
// fields
// lowercase, alnum without whitespaces
$name = new Zend_Form_Element_Text('regname');
$name->setDecorators(array('ViewHelper', 'Errors'))->setRequired(true)->addFilter('StringToLower')->addValidator('alnum', false, array('allowWhiteSpace' => false))->addValidator('stringLength', false, array($username_minchars, $username_maxchars))->setErrorMessages(array(sprintf($this->translator->translate('Please choose a valid username between %d and %d characters'), $username_minchars, $username_maxchars)))->setAttrib('class', 'form-control alnum-only')->setLabel($this->translator->translate('Username'));
$email = new Zend_Form_Element_Text('regemail');
$email->setDecorators(array('ViewHelper', 'Errors'))->addFilter('StringToLower')->setRequired(true)->addValidator('EmailAddress', true)->setLabel($this->translator->translate('Email'))->setAttrib('class', 'form-control')->setErrorMessages(array($this->translator->translate('Enter a valid email address')));
$password = new Zend_Form_Element_Password('regpassword');
$password->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('Password'))->setErrorMessages(array($this->translator->translate('Password is required')))->setAttrib('class', 'form-control')->setAttrib('autocomplete', 'off')->setRequired(true);
$register = new Zend_Form_Element_Submit('registerbtn');
$register->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Create Account'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($name, $email, $password, $register));
$this->postInit();
}
示例12: init
public function init()
{
// administrador_email
$administrador_email = new Zend_Form_Element_Text('administrador_email');
$administrador_email->setLabel('E-mail: ');
$administrador_email->setRequired();
$administrador_email->setAttrib('class', 'form-control');
$administrador_email->setDecorators(Form_Decorators::$simpleElementDecorators);
// administrador_senha
$administrador_senha = new Zend_Form_Element_Password('administrador_senha');
$administrador_senha->setLabel('Senha: ');
$administrador_senha->setRequired();
$administrador_senha->setAttrib('class', 'form-control');
$administrador_senha->setDecorators(Form_Decorators::$simpleElementDecorators);
// submit
$submit = new Zend_Form_Element_Submit('submit');
$submit->setLabel('Logar');
$submit->setAttrib('class', 'form-control btn btn-info');
// add elements
$this->addElements(array($administrador_email, $administrador_senha, $submit));
}
示例13: init
public function init()
{
// autenticacao_senha_atual
$autenticacao_senhaAtual = new Zend_Form_Element_Password("autenticacao_senha_atual");
$autenticacao_senhaAtual->setLabel("Senha atual: ");
$autenticacao_senhaAtual->setRequired();
$autenticacao_senhaAtual->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$autenticacao_senhaAtual->setAttribs(array('class' => 'form-control', 'placeholder' => 'Digite a senha atual'));
// autenticacao_senha
$autenticacao_senha = new Zend_Form_Element_Password("autenticacao_senha");
$autenticacao_senha->setLabel("Nova Senha: ");
$autenticacao_senha->setRequired();
$autenticacao_senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$autenticacao_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Digite a nova senha'));
// autenticacao_senha_repetir
$autenticacao_senha_repetir = new Zend_Form_Element_Password("autenticacao_senha_repetir");
$autenticacao_senha_repetir->setLabel("Repita a nova Senha: ");
$autenticacao_senha_repetir->setRequired();
$autenticacao_senha_repetir->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$autenticacao_senha_repetir->setAttribs(array('class' => 'form-control', 'placeholder' => 'Repita a nova senha'));
$this->addElements(array($autenticacao_senha, $autenticacao_senha_repetir));
parent::init();
}
示例14: init
/**
*
* Mail settings
*
*/
public function init()
{
$cname = explode('_', get_class());
$this->preInit(end($cname));
// use template file
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/Settings.phtml'))));
// load settings
$AppOptions = new Application_Model_AppOptions();
$all_meta = $AppOptions->getAllOptions();
// fields
$mail_adapters = array('smtp' => 'smtp', 'mail' => 'php mail()');
$mail_adapter = new Zend_Form_Element_Select('mail_adapter');
$mail_adapter->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($mail_adapters)->setLabel($this->translator->translate('Email adapter'))->setRequired(true)->setValue(isset($all_meta['mail_adapter']) ? $all_meta['mail_adapter'] : 'Zend_Mail_Transport_Smtp')->setAttrib('class', 'form-control');
$mail_host = new Zend_Form_Element_Text('mail_host');
$mail_host->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) host'))->setValue(isset($all_meta['mail_host']) ? $all_meta['mail_host'] : 'example.com')->setAttrib('class', 'form-control');
$mail_port = new Zend_Form_Element_Text('mail_port');
$mail_port->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) port (25/465/587)'))->setValidators(array('digits'))->setValue(isset($all_meta['mail_port']) ? $all_meta['mail_port'] : '465')->setAttrib('class', 'form-control');
$mail_login = new Zend_Form_Element_Select('mail_login');
$mail_login->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions(array('login' => 'login', '' => 'open'))->setLabel($this->translator->translate('(smtp) auth method'))->setValue(isset($all_meta['mail_login']) ? $all_meta['mail_login'] : 'login')->setAttrib('class', 'form-control');
$mail_security_methods = array('ssl' => 'ssl', 'tls' => 'tls', '' => 'none');
$mail_security = new Zend_Form_Element_Select('mail_security');
$mail_security->setDecorators(array('ViewHelper', 'Errors'))->setMultiOptions($mail_security_methods)->setLabel($this->translator->translate('(smtp) security'))->setValue(isset($all_meta['mail_security']) ? $all_meta['mail_security'] : 'ssl')->setAttrib('class', 'form-control');
$mail_username = new Zend_Form_Element_Text('mail_username');
$mail_username->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('name'))->setValue(isset($all_meta['mail_username']) ? $all_meta['mail_username'] : '')->setAttrib('class', 'form-control');
$mail_password = new Zend_Form_Element_Password('mail_password');
$mail_password->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) auth password'))->setAttrib('autocomplete', 'off')->setRenderPassword(true)->setValue(isset($all_meta['mail_password']) ? $all_meta['mail_password'] : '')->setAttrib('class', 'form-control');
$mail_username = new Zend_Form_Element_Text('mail_username');
$mail_username->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('(smtp) auth username'))->setValue(isset($all_meta['mail_username']) ? $all_meta['mail_username'] : '')->setAttrib('class', 'form-control');
$mail_from = new Zend_Form_Element_Text('mail_from');
$mail_from->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('from'))->setValue(isset($all_meta['mail_from']) ? $all_meta['mail_from'] : '')->setAttrib('class', 'form-control');
$mail_from_name = new Zend_Form_Element_Text('mail_from_name');
$mail_from_name->setDecorators(array('ViewHelper', 'Errors'))->setLabel($this->translator->translate('from name'))->setValue(isset($all_meta['mail_from_name']) ? $all_meta['mail_from_name'] : '')->setAttrib('class', 'form-control');
$submit = new Zend_Form_Element_Submit('submitbtn');
$submit->setDecorators(array('ViewHelper'))->setLabel($this->translator->translate('Update'))->setAttrib('class', 'submit btn btn-default');
$this->addElements(array($mail_adapter, $mail_from, $mail_from_name, $mail_host, $mail_port, $mail_security, $mail_login, $mail_username, $mail_password, $submit));
$this->postInit();
}
示例15: init
//.........这里部分代码省略.........
$usertimezonepublic->setLabel($publictext);
$userProfilesModel = new Default_Model_UserProfiles();
$employments = $userProfilesModel->getEmployments();
$employments = array_merge(array('' => 'Select'), $employments);
$employment = new Zend_Form_Element_Select('employment');
$employment->setLabel('I am currently')->setAttrib('id', 'status')->setRequired(true)->addMultiOptions($employments)->setErrorMessages(array('Select status'));
$employmentpublic = new Zend_Form_Element_Checkbox('employment_publicity');
$employmentpublic->setLabel($publictext);
// DB: company
$employer_organization = new Zend_Form_Element_Text('company');
$employer_organization->setLabel('Employer / Organization')->setAttrib('id', 'employer-organization');
$employer_organizationpublic = new Zend_Form_Element_Checkbox('company_publicity');
$employer_organizationpublic->setLabel($publictext);
//Subscribe things
$favouritesModel = new Default_Model_UserHasFavourites();
$subscribeOptions = $favouritesModel->getFollows();
unset($subscribeOptions['8']);
//Unsetting the translation box till its in use.
//print_r($subscribeOptions);die;
$test = new Zend_Form_Element_MultiCheckbox('lol');
//$test->setV
$subscribeClasses = array("own_follows" => "Own contents", "fvr_follows" => "Favourite contents");
foreach ($subscribeClasses as $key => $value) {
$subscribe[$key] = new Zend_Form_Element_MultiCheckbox($key);
$subscribe[$key]->setLabel('Activities you want to follow in your ' . $value);
$subscribe[$key]->addMultiOptions($subscribeOptions);
}
$subscribeclear = new Oibs_Form_Element_Note('subscribeclear');
$subscribeclear->setValue($clear);
$save = new Zend_Form_Element_Submit('save');
$save->setLabel('Save profile')->setAttrib('id', 'save-profile')->setAttrib('class', 'submit-button');
$cancel = new Zend_Form_Element_Submit('cancel');
$cancel->setLabel('Cancel')->setAttrib('id', 'cancel')->setAttrib('class', 'submit-button');
$this->addElements(array($accountInformation, $username, $usernamepublic, $openid, $openidclear, $password, $passwordclear, $confirmpassword, $confirmpasswordclear, $personalInformation, $email, $emailclear, $gravatar, $gravatarcheck, $phone, $phonepublic, $firstname, $firstnamepublic, $lastname, $lastnamepublic, $gender, $genderpublic, $birthday, $birthdaypublic, $biography, $biographypublic, $weblinks_websites, $weblinks_name, $weblinks_url, $weblinks_name_site1, $weblinks_url_site1, $weblinks_name_site2, $weblinks_url_site2, $weblinks_name_site3, $weblinks_url_site3, $weblinks_name_site4, $weblinks_url_site4, $weblinks_name_site5, $weblinks_url_site5, $userlanguage, $userlanguageclear, $locationInformation, $hometown, $hometownpublic, $address, $addresspublic, $usercountry, $usercountrypublic, $usertimezone, $usertimezonepublic, $employmentInformation, $employment, $employmentpublic, $employer_organization, $employer_organizationpublic, $save, $cancel));
$accountInformation->setDecorators(array('ViewHelper'));
$personalInformation->setDecorators(array('ViewHelper'));
$locationInformation->setDecorators(array('ViewHelper'));
$employmentInformation->setDecorators(array('ViewHelper'));
$subscribeInformation->setDecorators(array('ViewHelper'));
$username->setDecorators(array('InputDecorator'));
$usernamepublic->setDecorators(array('PublicDecorator'));
$openid->setDecorators(array('InputDecorator'));
$openidclear->setDecorators(array('ViewHelper'));
$password->setDecorators(array('InputDecorator'));
$passwordclear->setDecorators(array('ViewHelper'));
$confirmpassword->setDecorators(array('InputDecorator'));
$confirmpasswordclear->setDecorators(array('ViewHelper'));
$email->setDecorators(array('InputDecorator'));
$emailclear->setDecorators(array('ViewHelper'));
$gravatar->setDecorators(array('InputDecorator'));
$gravatarcheck->setDecorators(array('PublicDecorator'));
$phone->setDecorators(array('InputDecorator'));
$phonepublic->setDecorators(array('PublicDecorator'));
$firstname->setDecorators(array('InputDecorator'));
$firstnamepublic->setDecorators(array('PublicDecorator'));
$lastname->setDecorators(array('InputDecorator'));
$lastnamepublic->setDecorators(array('PublicDecorator'));
$gender->setDecorators(array('InputDecorator'));
$genderpublic->setDecorators(array('PublicDecorator'));
$birthday->setDecorators(array('InputDecorator'));
$birthdaypublic->setDecorators(array('PublicDecorator'));
$biography->setDecorators(array('InputDecorator'));
$biographypublic->setDecorators(array('PublicDecorator'));
$intereststext->setDecorators(array('ViewHelper'));
$interests->setDecorators(array('InputDecorator'));
$interestsclear->setDecorators(array('ViewHelper'));
$weblinks_websites->setDecorators(array('ViewHelper'));
$weblinks_name->setDecorators(array('ViewHelper'));
$weblinks_url->setDecorators(array('ViewHelper'));
$weblinks_name_site1->setDecorators(array('InputWebsiteNameDecorator'));
$weblinks_url_site1->setDecorators(array('InputWebsiteUrlDecorator'));
$weblinks_name_site2->setDecorators(array('InputWebsiteNameDecorator'));
$weblinks_url_site2->setDecorators(array('InputWebsiteUrlDecorator'));
$weblinks_name_site3->setDecorators(array('InputWebsiteNameDecorator'));
$weblinks_url_site3->setDecorators(array('InputWebsiteUrlDecorator'));
$weblinks_name_site4->setDecorators(array('InputWebsiteNameDecorator'));
$weblinks_url_site4->setDecorators(array('InputWebsiteUrlDecorator'));
$weblinks_name_site5->setDecorators(array('InputWebsiteNameDecorator'));
$weblinks_url_site5->setDecorators(array('InputWebsiteUrlDecorator'));
$userlanguage->setDecorators(array('InputDecorator'));
$userlanguageclear->setDecorators(array('ViewHelper'));
$hometown->setDecorators(array('InputDecorator'));
$hometownpublic->setDecorators(array('PublicDecorator'));
$address->setDecorators(array('InputDecorator'));
$addresspublic->setDecorators(array('PublicDecorator'));
$usercountry->setDecorators(array('InputDecorator'));
$usercountrypublic->setDecorators(array('PublicDecorator'));
$usertimezone->setDecorators(array('InputDecorator'));
$usertimezonepublic->setDecorators(array('PublicDecorator'));
$employment->setDecorators(array('InputDecorator'));
$employmentpublic->setDecorators(array('PublicDecorator'));
$employer_organization->setDecorators(array('InputDecorator'));
$employer_organizationpublic->setDecorators(array('PublicDecorator'));
$subscribe['own_follows']->setDecorators(array('InputDecorator'));
$subscribe['fvr_follows']->setDecorators(array('InputDecorator'));
$subscribeclear->setDecorators(array('ViewHelper'));
$save->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'openOnly' => true, 'id' => 'save_changes'))));
$cancel->setDecorators(array('ViewHelper', array('HtmlTag', array('tag' => 'div', 'closeOnly' => true))));
$this->setDecorators(array('FormElements', 'Form'));
}