本文整理汇总了PHP中Zend_Form_Element_Password::setAttribs方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Form_Element_Password::setAttribs方法的具体用法?PHP Zend_Form_Element_Password::setAttribs怎么用?PHP Zend_Form_Element_Password::setAttribs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Form_Element_Password
的用法示例。
在下文中一共展示了Zend_Form_Element_Password::setAttribs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$tr = Application_Form_FrmLanguages::getCurrentlanguage();
$request = Zend_Controller_Front::getInstance()->getRequest();
$db = new Application_Model_DbTable_DbGlobal();
//user typefilter
$sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
$rs = $db->getGlobalDb($sql);
$options = array('All');
$usertype = $request->getParam('user_type_filter');
foreach ($rs as $read) {
$options[$read['user_type_id']] = $read['user_type'];
}
$user_type_filter = new Zend_Form_Element_Select('user_type_filter');
$user_type_filter->setMultiOptions($options);
$user_type_filter->setAttribs(array('id' => 'user_type_filter', 'class' => 'validate[required]', 'onchange' => 'this.form.submit()'));
$user_type_filter->setValue($usertype);
$this->addElement($user_type_filter);
//uer title
$user_title = new Zend_Form_Element_Select("title");
$user_title->setMultiOptions(array("Mr" => "Mr", "Ms" => "Ms"));
$this->addElement($user_title);
//user full name
$user_fullname = new Zend_Form_Element_Text("fullname");
$user_fullname->setAttribs(array('id' => 'fullname', 'class' => 'validate[required]'));
$this->addElement($user_fullname);
//user name
$user_name = new Zend_Form_Element_Text('username');
$user_name->setAttribs(array('id' => 'username', 'class' => 'validate[required]'));
$this->addElement($user_name);
//email
$email = new Zend_Form_Element_Text('email');
$email->setAttribs(array('id' => 'email', 'class' => 'validate[required]'));
$this->addElement($email);
//password
$password = new Zend_Form_Element_Password('password');
$password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
$this->addElement($password);
//confirm password
$confirm_password = new Zend_Form_Element_Password('confirm_password');
$confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required]'));
$this->addElement($confirm_password);
//user type
$sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
$rs = $db->getGlobalDb($sql);
$options = array('' => $tr->translate('Please_Select'));
foreach ($rs as $read) {
$options[$read['user_type_id']] = $read['user_type'];
}
$user_type_id = new Zend_Form_Element_Select('user_type_id');
$user_type_id->setMultiOptions($options);
$user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'validate[required]'));
$this->addElement($user_type_id);
//location
$rs = $db->getGlobalDb('SELECT LocationId, Name FROM tb_sublocation WHERE Name!="" AND status=1 ORDER BY LocationId DESC');
$option = array("1" => $tr->translate("Please_Select"), "-1" => $tr->translate("Add_New_Location"));
if (!empty($rs)) {
foreach ($rs as $read) {
$option[$read['LocationId']] = $read['Name'];
}
}
$locationID = new Zend_Form_Element_Select('LocationId');
$locationID->setMultiOptions($option);
$locationID->setattribs(array('id' => 'LocationId', 'Onchange' => 'AddLocation()', 'class' => 'demo-code-language'));
$this->addElement($locationID);
}
示例2: editUserPassword
function editUserPassword()
{
$this->setMethod('post');
$this->addAttribs(array('id' => 'formAccountEditPassword', 'class' => ''));
$filters = array(new Zend_Filter_StringTrim(), new Zend_Filter_StripTags());
$control = new Zend_Form_Element_Hidden('control');
$control->setValue('editPassword');
$this->addElement($control);
$oldPassword = new Zend_Form_Element_Password('oldPassword');
$oldPassword->setLabel('Old password');
$oldPassword->addValidator(new Zend_Validate_StringLength(6, 32));
$oldPassword->setAttribs(array('class' => 'text validate[required,minSize[6],maxSize[32]] rightAdd', 'minlenght' => '6', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'data-prompt-position' => 'topLeft:0'));
$oldPassword->setRequired(true);
$this->addElement($oldPassword);
$password = new Zend_Form_Element_Password('password');
$password->setLabel(Zend_Registry::get('translate')->_('admin_administrators_new_password'));
$password->addValidator(new Zend_Validate_StringLength(6, 32));
$password->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false'));
$password->setRequired(true);
$this->addElement($password);
$retypePassword = new Zend_Form_Element_Password('retypePassword');
$retypePassword->setLabel(Zend_Registry::get('translate')->_('admin_administrators_retype_new_password'));
$retypePassword->addValidator(new Zend_Validate_Identical('password'));
$retypePassword->addValidator(new Zend_Validate_StringLength(6, 32));
$retypePassword->setAttribs(array('class' => 'text validate[required] rightAdd', 'maxlenght' => '32', 'autocomplete' => 'off', 'oncontextmenu' => 'return false', 'ondrop' => 'return false', 'onpaste' => 'return false'));
$retypePassword->setRequired(true);
$retypePassword->setIgnore(true);
$this->addElement($retypePassword);
$submit = new Zend_Form_Element_Submit('savePassword');
$submit->setValue(Zend_Registry::get('translate')->_('apply_password'));
$submit->setAttribs(array('class' => 'submit tsSubmitLogin fL'));
$submit->setIgnore(true);
$this->addElement($submit);
$this->setElementFilters($filters);
}
示例3: init
/**
* Initialise the form
*
* @todo Validation
* @return void
*/
public function init()
{
// Set request method
$this->setMethod('POST');
// Add title element
$this->addElement('select', 'title', array('label' => 'Title', 'required' => true, 'multiOptions' => TenantsInsuranceQuote_Form_Subforms_PersonalDetails::$titles, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select your title', 'notEmptyInvalid' => 'Please select your title')))), 'class' => 'form-control'));
// Add first name element
$this->addElement('text', 'first_name', array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your first name', 'notEmptyInvalid' => 'Please enter your first name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'First name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))), 'class' => 'form-control'));
// Add last name element
$this->addElement('text', 'last_name', array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your last name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Last name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)'))), 'class' => 'form-control'));
// Email element
$this->addElement('text', 'email', array('label' => 'Email Address', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Email address is required')))), 'class' => 'form-control'));
// Modify email error messages & add validator
$emailValidator = new Zend_Validate_EmailAddress();
$emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => "Domain name invalid in email address", Zend_Validate_EmailAddress::INVALID_FORMAT => "Invalid email address"));
$this->getElement('email')->addValidator($emailValidator);
//The password element.
$passwordElement = new Zend_Form_Element_Password('password', array('validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Password is required')))), 'class' => 'form-control'));
$passwordElement->setRequired(true);
$passwordElement->setLabel('Password');
$passwordElement->setAttribs(array('class' => 'form-control'));
$passwordElement->addValidator(new Zend_Validate_PasswordStrength());
$validator = new Zend_Validate_Identical();
$validator->setToken('confirm_password');
$validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
$passwordElement->addValidator($validator);
$this->addElement($passwordElement);
//The confirm password element.
$confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
$confirmPasswordElement->setRequired(true);
$confirmPasswordElement->setLabel('Confirm Password');
$confirmPasswordElement->setAttribs(array('class' => 'form-control'));
$validator = new Zend_Validate_NotEmpty();
$validator->setMessage('Please confirm your password');
$confirmPasswordElement->addValidator($validator);
$this->addElement($confirmPasswordElement);
// Security question & answer
$this->addElement('select', 'security_question', array('label' => 'Security Question', 'required' => true, 'multiOptions' => array('' => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Security question is required')))), 'class' => 'form-control'));
$this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Security answer is required')))), 'class' => 'form-control'));
$this->addElement('hidden', 'refno', array('required' => false, 'class' => 'noalt'));
// Add the submit button
$this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Register', 'class' => 'btn btn-primary pull-right'));
// Set up the element decorators
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors'));
// Set up the decorator on the form and add in decorators which are removed
$this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section'))->addDecorator('Form');
// Remove the label from the submit button
$element = $this->getElement('submit');
$element->removeDecorator('label');
$this->getElement('refno')->removeDecorator('HtmlTag');
}
示例4: init
public function init()
{
//current password
$current_password = new Zend_Form_Element_Password('current_password');
$current_password->setAttribs(array('id' => 'current_password', 'class' => 'validate[required]'));
$this->addElement($current_password);
//password
$password = new Zend_Form_Element_Password('password');
$password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
$this->addElement($password);
//confirm password
$confirm_password = new Zend_Form_Element_Password('confirm_password');
$confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required, equals[password]]'));
$this->addElement($confirm_password);
}
示例5: 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();
}
示例6: 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->setAttribs(array('class' => 'form-control'));
// administrador_senha
$administrador_senha = new Zend_Form_Element_Password("administrador_senha");
$administrador_senha->setLabel("Senha: ");
$administrador_senha->setRequired();
$administrador_senha->setAttribs(array('class' => 'form-control'));
$this->addElements(array($administrador_email, $administrador_senha));
parent::init();
}
示例7: init
/**
* Initialise the form
*
* @todo Validation
* @return void
*/
public function init()
{
// Set request method
$this->setMethod('POST');
// Add title element
$this->addElement('text', 'title', array('label' => 'Title'));
// Add first name element
$this->addElement('text', 'first_name', array('label' => 'First name'));
// Add last name element
$this->addElement('text', 'last_name', array('label' => 'Last name'));
$this->addElement('password', 'existing_password', array('required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
// Email element
$this->addElement('text', 'email', array('label' => 'Email Address'));
//The password element.
$passwordElement = new Zend_Form_Element_Password('password');
$passwordElement->setRequired(false);
// New password is not required to update options
$passwordElement->addValidator(new Zend_Validate_PasswordStrength());
$passwordElement->setAttribs(array('class' => 'form-control'));
$validator = new Zend_Validate_Identical();
$validator->setToken('confirm_password');
$validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
$passwordElement->addValidator($validator);
$this->addElement($passwordElement);
//The confirm password element.
$confirmPasswordElement = new Zend_Form_Element_Password('confirm_password');
$confirmPasswordElement->setRequired(false);
// New password is not required to update options
$confirmPasswordElement->setAttribs(array('class' => 'form-control'));
$validator = new Zend_Validate_NotEmpty();
$validator->setMessage('Please confirm your password');
$confirmPasswordElement->addValidator($validator);
$this->addElement($confirmPasswordElement);
// Security question & answer
$this->addElement('select', 'security_question', array('required' => true, 'multiOptions' => array(0 => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))), 'class' => 'form-control'));
$this->addElement('text', 'security_answer', array('required' => true, 'filters' => array('StringTrim'), 'class' => 'form-control'));
// Add the submit button
$this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'btn btn-primary pull-right', 'label' => 'Save'));
// Set up the element decorators
$this->setElementDecorators(array('ViewHelper', 'Label', 'Errors', array('HtmlTag', array('tag' => 'div'))));
// Set up the decorator on the form and add in decorators which are removed
$this->addDecorator('FormElements')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'form_section one-col'))->addDecorator('Form');
// Set custom subform decorator
$this->setDecorators(array(array('ViewScript', array('viewScript' => 'subforms/edit-account.phtml'))));
// Remove the label from the submit button
$element = $this->getElement('submit');
$element->removeDecorator('label');
}
示例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: frmuser
public function frmuser($frm = null)
{
$db = new Application_Model_DbTable_DbGlobal();
$status = new Zend_Form_Element_Select('status');
$_arr_status = array(1 => $this->tr->translate("ACTIVE"), 0 => $this->tr->translate("DACTIVE"));
$status->setMultiOptions($_arr_status);
$status->setAttribs(array('class' => 'form-control validate[required]'));
$id_code = new Zend_Form_Element_Text('id_code');
$id_code->setAttribs(array('class' => 'form-control validate[required]'));
$fullname = new Zend_Form_Element_Text('fullname');
$fullname->setAttribs(array('class' => 'form-control validate[required]'));
$username = new Zend_Form_Element_Text('username');
$username->setAttribs(array('class' => 'form-control validate[required]', 'Onkeyup' => 'getfillterUserType()'));
$email = new Zend_Form_Element_Text('email');
$email->setAttribs(array('class' => 'validate[required,custom[email]] form-control', 'Onkeyup' => 'getfillterUserType()'));
$old_password = new Zend_Form_Element_Password('old_password');
$old_password->setAttribs(array('class' => 'validate[required,minSize[5]] form-control'));
$password = new Zend_Form_Element_Password('password');
$password->setAttribs(array('class' => 'validate[required,minSize[5]] form-control'));
$confirm_password = new Zend_Form_Element_Password('confirm_password');
$confirm_password->setAttribs(array('class' => 'validate[required,equals[password]] form-control'));
$rs = $db->getGlobalDb('SELECT user_type_id,user_type FROM tb_user_type where user_type_id');
$options = array('' => '--- ជ្រើសរើសប្រភេទអ្នកប្រើប្រាស់ ---');
foreach ($rs as $read) {
$options[$read['user_type_id']] = $read['user_type'];
}
$user_type_id = new Zend_Form_Element_Select('user_type');
$user_type_id->setMultiOptions($options);
$user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'form-control chzn-select validate[required]'));
$id = new Zend_Form_Element_Hidden('id');
$photo = new Zend_Form_Element_File('photo');
$this->addElements(array($status, $id_code, $photo, $id, $fullname, $username, $email, $password, $confirm_password, $user_type_id, $old_password));
if ($frm != "") {
$id->setValue($frm['user_id']);
$fullname->setValue($frm['name']);
$username->setValue($frm['user_name']);
$email->setValue($frm['email']);
$id_code->setValue($frm['user_code']);
// $password->setValue($frm['password']);
$user_type_id->setValue($frm['user_type']);
$photo->setValue($frm['photo']);
$status->setValue($frm['status']);
}
return $this;
}
示例10: init
public function init()
{
// administrador_email
$administrador_email = new Zend_Form_Element_Text("administrador_email");
$administrador_email->setLabel("E-mail");
$administrador_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o email'));
$administrador_email->setRequired();
// administrador_senha
$administrador_senha = new Zend_Form_Element_Password("administrador_senha");
$administrador_senha->setLabel("Senha");
$administrador_senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe a senha'));
$administrador_senha->setRequired();
// submit
$submit = new Zend_Form_Element_Submit("submit");
$submit->setLabel("Enviar");
$submit->setAttribs(array('class' => 'form-control btn btn-sm btn-success'));
$this->addElements(array($administrador_email, $administrador_senha, $submit));
}
示例11: 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();
}
示例12: 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();
}
示例13: init
public function init()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$db = new Application_Model_DbTable_DbGlobal();
//user typefilter
$sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
$rs = $db->getGlobalDb($sql);
$options = array('All');
$usertype = $request->getParam('user_type_filter');
foreach ($rs as $read) {
$options[$read['user_type_id']] = $read['user_type'];
}
$user_type_filter = new Zend_Form_Element_Select('user_type_filter');
$user_type_filter->setMultiOptions($options);
$user_type_filter->setAttribs(array('id' => 'user_type_filter', 'class' => 'validate[required]', 'onchange' => 'this.form.submit()'));
$user_type_filter->setValue($usertype);
$this->addElement($user_type_filter);
//uer title
$user_title = new Zend_Form_Element_Select("title");
$user_title->setMultiOptions(array("Mr" => "Mr", "Ms" => "Ms"));
$this->addElement($user_title);
//user full name
$user_fullname = new Zend_Form_Element_Text("name");
$user_fullname->setAttribs(array('id' => 'name', 'class' => 'validate[required]'));
$this->addElement($user_fullname);
//user cso
/*$user_cso = new Zend_Form_Element_Select("cso_id");
$user_cso->setMultiOptions($db->getOptionCSO());
$user_cso->setAttribs(array(
'id'=>'cso_id',
'class'=>'validate[required]',
));
$this->addElement($user_cso);*/
//Select CSO
$rs = $db->getGlobalDb('SELECT id, name_en FROM fi_cso');
$options = array('' => 'Please select');
foreach ($rs as $read) {
$options[$read['id']] = $read['name_en'];
}
$cso_id = new Zend_Form_Element_Select('cso_id');
$cso_id->setMultiOptions($options);
$cso_id->setattribs(array('class' => 'validate[required]'));
$this->addElement($cso_id);
//user name
$user_name = new Zend_Form_Element_Text('username');
$user_name->setAttribs(array('id' => 'username', 'class' => 'validate[required]'));
$this->addElement($user_name);
//email
$email = new Zend_Form_Element_Text('email');
$email->setAttribs(array('id' => 'email', 'class' => 'validate[required]'));
$this->addElement($email);
//password
$password = new Zend_Form_Element_Password('password');
$password->setAttribs(array('id' => 'password', 'class' => 'validate[required]'));
$this->addElement($password);
//confirm password
$confirm_password = new Zend_Form_Element_Password('confirm_password');
$confirm_password->setAttribs(array('id' => 'confirm_password', 'class' => 'validate[required]'));
$this->addElement($confirm_password);
//user type
$sql = 'SELECT user_type_id,user_type FROM rsv_acl_user_type';
$rs = $db->getGlobalDb($sql);
$options = array('' => 'Please select');
foreach ($rs as $read) {
$options[$read['user_type_id']] = $read['user_type'];
}
$user_type_id = new Zend_Form_Element_Select('user_type_id');
$user_type_id->setMultiOptions($options);
$user_type_id->setAttribs(array('id' => 'user_type_id', 'class' => 'validate[required]'));
$this->addElement($user_type_id);
}
示例14: FromBooking
public function FromBooking()
{
$request = Zend_Controller_Front::getInstance()->getRequest();
$_db = new Application_Model_DbTable_DbGlobal();
$c_date = date("d-m-Y");
$pickup_date = new Zend_Form_Element_Text("pickup_date");
$pickup_date->setAttribs(array('id' => 'pick_date', 'size' => "20", 'style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$pickup_date->setValue($c_date);
if ($request->getParam("pickup_date") == "") {
$pickup_date->setValue($c_date);
} else {
$pickup_date->setValue($request->getParam("pickup_date"));
}
$return_date = new Zend_Form_Element_Text("return_date");
$return_date->setAttribs(array('id' => 'datepicker', 'style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
if ($request->getParam("return_date") == "") {
$return_date->setValue($c_date);
} else {
$return_date->setValue($request->getParam("return_date"));
}
$rows = $_db->getGlobalDb("SELECT id,province_name FROM `ldc_province` WHERE `status` = 1");
$opt_location = array(0 => $this->tr->translate("CHOOSE_LOCTION"));
if (!empty($rows)) {
foreach ($rows as $row) {
$opt_location[$row['id']] = $row['province_name'];
}
}
$pickup_location = new Zend_Form_Element_Select("pickup_location");
$pickup_location->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$pickup_location->setMultiOptions($opt_location);
//$pickup_location->setValue(25);
if ($request->getParam("pickup_location") == "") {
$pickup_location->setValue(25);
} else {
$pickup_location->setValue($request->getParam("pickup_location"));
}
$return_location = new Zend_Form_Element_Select("return_location");
$return_location->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$return_location->setMultiOptions($opt_location);
if ($request->getParam("return_location") == "") {
$return_location->setValue(25);
} else {
$return_location->setValue($request->getParam("return_location"));
}
for ($i = 1; $i < 12; $i++) {
$time = $i + 6;
if ($i + 6 <= 12) {
$icon = " AM";
} else {
$icon = " PM";
}
$value = $time . $icon;
$option_time[$time] = $value;
}
$pickup_time = new Zend_Form_Element_Select("pickup_time");
$pickup_time->setMultiOptions($option_time);
$pickup_time->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$return_time = new Zend_Form_Element_Select("return_time");
$return_time->setMultiOptions($option_time);
$return_time->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$option_minute = array('00' => '00');
$sum = 0;
for ($j = 1; $j <= 3; $j++) {
$min = $sum + 15;
$sum = $sum + 15;
$option_minute[$min] = $sum;
}
$pickup_minute = new Zend_Form_Element_Select("pickup_minute");
$pickup_minute->setMultiOptions($option_minute);
$pickup_minute->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$return_minute = new Zend_Form_Element_Select("return_minute");
$return_minute->setMultiOptions($option_minute);
$return_minute->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$user_name = new Zend_Form_Element_Text("user_name");
$user_name->setAttribs(array('style' => 'width: 100% !important;', 'class' => 'control_style'));
$password = new Zend_Form_Element_Password("password");
$password->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$s_user_name = new Zend_Form_Element_Text("s_user_name");
$s_user_name->setAttribs(array('data-validation-length' => "min4", 'style' => 'width: 100% !important;padding:1px !important;', 'onChange' => 'checkUserName(1);', 'class' => 'control_style'));
$s_password = new Zend_Form_Element_Password("s_password");
$s_password->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$first_name = new Zend_Form_Element_Text("first_name");
$first_name->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$last_name = new Zend_Form_Element_Text("last_name");
$last_name->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$phone = new zend_form_element_text("phone");
$phone->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$email = new zend_form_element_text('email');
$email->setAttribs(array('type' => 'email', 'style' => 'width: 100% !important;padding:1px !important;', 'onChange' => 'checkUserName(2);', 'class' => 'control_style'));
$passport_id = new zend_form_element_text('pass_id');
$passport_id->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$pass_issue_date = new zend_form_element_text("pass_issue_date");
$pass_issue_date->setAttribs(array('id' => 'pass_issue_date', 'style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$pass_exp_date = new zend_form_element_text('pass_exp_date');
$pass_exp_date->setAttribs(array('id' => 'pass_exp_date', 'style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$nationl = new zend_form_element_text('national');
$nationl->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
$opt_gender = array(1 => 'M', 2 => 'F');
$gender = new Zend_Form_Element_Select('gender');
$gender->setAttribs(array('style' => 'width: 100% !important;padding:1px !important;', 'class' => 'control_style'));
//.........这里部分代码省略.........
示例15: init
public function init()
{
/**
* salao_cnpj
*/
$salao_cnpj = new Zend_Form_Element_Text("salao_cnpj");
$salao_cnpj->setLabel("CNPJ: ");
$salao_cnpj->setRequired();
$salao_cnpj->addValidator(new App_Validate_Cnpj());
$salao_cnpj->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o CNPJ'));
$salao_cnpj->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* salao_salao
*/
$salao_salao = new Zend_Form_Element_Text('salao_nome');
$salao_salao->setLabel('Nome do Salão: ');
$salao_salao->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do salão'));
$salao_salao->setRequired();
$salao_salao->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$salao_salao->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* salao_nome
*/
$salao_nome = new Zend_Form_Element_Text('salao_proprietario');
$salao_nome->setLabel('Nome Proprietário: ');
$salao_nome->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o nome do proprietário'));
$salao_nome->setRequired();
$salao_nome->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$salao_nome->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* salao_email
*/
$salao_email = new Zend_Form_Element_Text('salao_email');
$salao_email->setLabel('E-mail: ');
$salao_email->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o e-mail de contato'));
$salao_email->setRequired();
$salao_email->addValidator(new App_Validate_Salao());
$salao_email->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* senha
*/
$senha = new Zend_Form_Element_Password('senha');
$senha->setLabel("Senha: ");
$senha->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe a senha'));
$senha->setRequired();
$senha->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* salao_contato
*/
$salao_contato = new Zend_Form_Element_Text('salao_contato');
$salao_contato->setLabel('Telefone: ');
$salao_contato->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe um telefone de contato'));
$salao_contato->setRequired();
$salao_contato->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$salao_contato->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* profisional_cep
*/
$salao_cep = new Zend_Form_Element_Text('salao_cep');
$salao_cep->setLabel('CEP: ');
$salao_cep->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o cep do salão'));
$salao_cep->setRequired();
$salao_cep->addValidator(new App_Validate_Cep());
$salao_cep->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
/**
* profisional_logradouro
*/
$salao_logradouro = new Zend_Form_Element_Text('salao_logradouro');
$salao_logradouro->setLabel("Logradouro: ");
$salao_logradouro->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o logradouro', 'readonly' => true));
$salao_logradouro->setRequired();
$salao_logradouro->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
$salao_logradouro->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
//$salao_logradouro->setOrder(7);
/**
* sala_numero
*/
$salao_numero = new Zend_Form_Element_Text('salao_numero');
$salao_numero->setLabel('Número: ');
$salao_numero->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o numero'));
$salao_numero->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$salao_numero->setRequired();
$salao_numero->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
/**
* sala_complemento
*/
$salao_complemento = new Zend_Form_Element_Text('salao_complemento');
$salao_complemento->setLabel('Complemento: ');
$salao_complemento->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o complemento'));
//$salao_complemento->setRequired();
/**
* profisional_bairro
*/
$salao_bairro = new Zend_Form_Element_Text('salao_bairro');
$salao_bairro->setLabel("Bairro: ");
$salao_bairro->setAttribs(array('class' => 'form-control', 'placeholder' => 'Informe o bairro', 'readonly' => true));
$salao_bairro->setDecorators(App_Forms_Decorators::$simpleElementDecorators);
$salao_bairro->setRequired();
$salao_bairro->addErrorMessages(array(Zend_Validate_NotEmpty::IS_EMPTY => "Campo obrigatório!"));
/**
//.........这里部分代码省略.........