Пример #1
1
 public function __construct($options = null)
 {
     $this->_disabledDefaultActions = true;
     $this->_addRequiredAsterisks = false;
     parent::__construct($options);
     $baseDir = $this->getView()->baseUrl();
     $this->getView()->headLink()->appendStylesheet("{$this->getView()->baseUrl()}/themes/default/css/login.css", 'all');
     $this->setAttrib('class', 'login');
     $regexValidate = new Cible_Validate_Email();
     $regexValidate->setMessage($this->getView()->getCibleText('validation_message_emailAddressInvalid'), 'regexNotMatch');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel($this->getView()->getClientText('login_form_email_label'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))))->addValidator($regexValidate)->setAttrib('class', 'loginTextInput');
     $this->addElement($email);
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel($this->getView()->getClientText('login_form_password_label'))->addFilter('StripTags')->addFilter('StringTrim')->setAttrib('class', 'loginTextInput')->setRequired(true)->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $this->getView()->getCibleText('validation_message_empty_field'))));
     $this->addElement($password);
     // checkbox for client persistance
     $status = new Zend_Form_Element_Checkbox('stayOn');
     $status->setLabel($this->getView()->getClientText('login_form_stayOn_label'));
     $status->setValue(1);
     $status->setDecorators(array('ViewHelper', array('label', array('placement' => 'append')), array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
     $this->addElement($status);
     // Submit button
     $submit = new Zend_Form_Element_Submit('submit_login');
     $submit->setLabel('')->setAttrib('class', 'subscribeButton-' . Zend_Registry::get("languageSuffix"));
     $submit->setDecorators(array('ViewHelper', array(array('row' => 'HtmlTag'), array('tag' => 'dd'))));
     $this->addElement($submit);
     $this->setAttrib('class', 'login-form');
 }
Пример #2
0
 public function init()
 {
     $this->setName('Form User Edit');
     $this->setAttrib('class', 'Form_Edit');
     $this->setMethod('post')->setAction('/user/save');
     $id = new Zend_Form_Element_Hidden('id');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name:')->setRequired(true)->addValidator('alnum')->addValidator('regex', false, array('/^[a-z]+/'))->addValidator('stringLength', false, array(4, 12))->addFilter('StringToLower');
     $pwd = new Zend_Form_Element_Password('pwd');
     $pwd->setLabel('Password:'******'re_pwd');
     $re_pwd->setLabel('Re-password:'******'role');
     $role->setLabel('Role:')->addMultiOptions(array(array('key' => 'guest', 'value' => 'Guest'), array('key' => 'memeber', 'value' => 'Member'), array('key' => 'admin', 'value' => 'Admin')))->setDescription('Choose one role');
     $truename = new Zend_Form_Element_Text('true_name');
     $truename->setLabel('Real Name:');
     $phone = new Zend_Form_Element_Text('cellphone');
     $phone->setLabel('Cell Phone:')->addValidator(new SP_Validate_CellPhone());
     $btnSubmit = new Zend_Form_Element_Submit('submit');
     $btnSubmit->setLabel('Submit');
     $this->addElements(array($id, $name, $pwd, $re_pwd, $role, $truename, $phone, $btnSubmit));
     parent::init();
     $this->addDecorator('OuterBox', array('attrs' => array('class' => 'form user_edit_form'), 'title' => 'Edit/Create User', 'placement' => 'PREPEND'));
     $id->removeDecorator('Label');
     $btnSubmit->removeDecorator('Label');
 }
Пример #3
0
 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
0
    public function init()
    {
        $tr = Zend_Registry::get('tr');
        
        $handle = new Zend_Form_Element_Text('handle');
        $handle->setLabel($tr->_('HANDLE'));
        $handle->setRequired(true);
        $handle->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($handle);

        $password = new Zend_Form_Element_Password('password');
        $password->setLabel($tr->_('PASSWORD'));
        $password->setRequired(true);
        $password->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password);

        $password1 = new Zend_Form_Element_Password('password_again');
        $password1->setLabel($tr->_('RETYPE') . ' ' . $tr->_('PASSWORD'));
        $password1->setRequired(true);
        $password1->addValidator('NotEmpty', true, array('messages' => $tr->_('GENERAL_MISSING_TEXT_VALUE')));
        $this->addElement($password1);

        $this->addElement(new Zend_Form_Element_Submit($tr->_('SUBMIT')));

        parent::init();
    }
Пример #5
0
 /**
  * Creates the form to log in.
  * @see Zend_Form::init()
  */
 public function init()
 {
     $this->setMethod('post');
     $this->setAction("/auth/login/");
     $usernameElement = new Zend_Form_Element_Text('username');
     $usernameElement->setLabel("Benutzername");
     $usernameElement->addValidator('regex', false, array('/^[a-z0-9]/i'));
     $usernameElement->addValidator('stringLength', false, array(2, 64));
     $usernameElement->setAttrib('maxLength', 64);
     $usernameElement->setRequired(true);
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setLabel("Passwort");
     $passwordElement->addValidator('regex', false, array('/^[a-z0-9]/i'));
     $passwordElement->addValidator('stringLength', false, array(8, 32));
     $passwordElement->setAttrib('maxLength', 32);
     $passwordElement->setRequired(true);
     $submitElement = new Zend_Form_Element_Submit('submit');
     $submitElement->setLabel('Anmelden');
     $submitElement->setIgnore(true);
     $submitElement->setAttrib('class', 'submit');
     $submitElement->removeDecorator('DtDdWrapper');
     $this->addElements(array($usernameElement, $passwordElement));
     $this->addDisplayGroup(array('username', 'password'), 'credentialGroup', array('legend' => 'Zugangsdaten'));
     $this->addElements(array($submitElement));
 }
 public function init()
 {
     // initialize form
     $this->setAction('/signup')->setMethod('post');
     $firstname = new Zend_Form_Element_Text('FirstName');
     $firstname->setLabel('First name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim');
     $lastname = new Zend_Form_Element_Text('LastName');
     $lastname->setLabel('Last name:')->setOptions(array('size' => '35'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('Alpha', true)->addFilter('HtmlEntities')->addFilter('StringTrim');
     // create text input for email address
     $email = new Zend_Form_Element_Text('Email');
     $email->setLabel('Email address:');
     $email->setOptions(array('size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress', true)->addFilter('HtmlEntities')->addFilter('StringToLower')->addFilter('StringTrim');
     // create text input for name
     $UserName = new Zend_Form_Element_Text('UserName');
     $UserName->setLabel('Username:'******'size' => '50'))->setRequired(true)->addValidator('Alnum')->addFilter('HtmlEntities')->addFilter('StringTrim');
     // create text input for password
     $Password = new Zend_Form_Element_Password('Password');
     $Password->setLabel('Password:'******'size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntities')->addFilter('StringTrim');
     // create text input for password confirmation
     $ConfirmPassword = new Zend_Form_Element_Password('ConfirmPassword');
     $ConfirmPassword->setLabel('Confirm Password:'******'size' => '50'))->setRequired(true)->addValidator('NotEmpty', true)->addFilter('HtmlEntities')->addFilter('StringTrim');
     // create submit button
     $submit = new Zend_Form_Element_Submit('register');
     $submit->setLabel('Register')->setOptions(array('class' => 'submit'));
     // attach elements to form
     $this->addElement($firstname)->addElement($lastname)->addElement($email)->addElement($UserName)->addElement($Password)->addElement($ConfirmPassword)->addElement($submit);
 }
Пример #7
0
 /**
  * Create user details form (single user).
  *
  * @return void
  */
 public function init()
 {
     // Invoke the agent user manager
     $agentUserManager = new Manager_Core_Agent_User();
     // Create array of possible security questions
     $securityQuestions = array('' => '--- please select ---');
     $securityQuestions += $agentUserManager->getUserSecurityAllQuestions();
     // Add real name element
     $this->addElement('text', 'realname', array('label' => 'Full name', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your full name', 'notEmptyInvalid' => 'Please enter your full name'))), array('regex', true, array('pattern' => '/^[a-z\\-\\ \']{2,}$/i', 'messages' => 'Name must contain at least two alphabetic characters and only basic punctuation (hyphen, space and single quote)')))));
     // Add username element
     $this->addElement('text', 'username', array('label' => 'Username', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your username', 'notEmptyInvalid' => 'Please enter your username'))), array('regex', true, array('pattern' => '/^[a-z0-9]{1,64}$/i', 'messages' => 'Username must contain between 1 and 64 alphanumeric characters')))));
     if ($this->_role == Model_Core_Agent_UserRole::MASTER) {
         $this->getElement('username')->setRequired(true);
     } else {
         $this->getElement('username')->setAttrib('disabled', 'disabled');
     }
     // Add password1 element
     $passwordElement1 = new Zend_Form_Element_Password('password1');
     $passwordElement1->setRequired(false);
     $passwordElement1->setLabel('New password:'******'password2');
     $validator->setMessage('Passwords are not the same', Zend_Validate_Identical::NOT_SAME);
     $passwordElement1->addValidator($validator);
     $passwordElement2 = new Zend_Form_Element_Password('password2');
     $passwordElement2->setRequired(false);
     $passwordElement2->setLabel('New password (again)');
     $this->addElement($passwordElement2);
     // Add e-mail element
     $this->addElement('text', 'email', array('label' => 'E-mail address', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter your e-mail address'))))));
     $emailValidator = new Zend_Validate_EmailAddress();
     $emailValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid e-mail address'));
     $this->getElement('email')->addValidator($emailValidator);
     if ($this->_role == Model_Core_Agent_UserRole::MASTER) {
         $this->getElement('email')->setRequired(true);
     } else {
         $this->getElement('email')->setAttrib('disabled', 'disabled');
     }
     // Add e-mail element
     $this->addElement('text', 'emailcopyto', array('label' => 'Copy e-mail to', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter a copy-to e-mail address'))))));
     $emailCopyToValidator = new Zend_Validate_EmailAddress();
     $emailCopyToValidator->setMessages(array(Zend_Validate_EmailAddress::INVALID_HOSTNAME => 'Domain name invalid in copy-to e-mail address', Zend_Validate_EmailAddress::INVALID_FORMAT => 'Invalid copy-to e-mail address'));
     $this->getElement('emailcopyto')->addValidator($emailCopyToValidator);
     // Add security question element
     $this->addElement('select', 'question', array('label' => 'Security question', 'required' => false, 'multiOptions' => $securityQuestions));
     // Add security answer element
     $this->addElement('text', 'answer', array('label' => 'Security answer', 'required' => false, 'filters' => array('StringTrim'), 'validators' => array(array('regex', true, array('pattern' => '/^[\\w\\ \\.\\-\'\\,]{2,}$/i', 'messages' => 'Security answer must contain at least two characters and only basic punctuation (hyphen, apostrophe, comma, full stop and space)')))));
     // Add master user element
     $this->addElement('checkbox', 'master', array('label' => 'Master user', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     // Add agent reports element
     $this->addElement('checkbox', 'reports', array('label' => 'Agent reports', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     // Add status element
     $this->addElement('checkbox', 'status', array('label' => 'Active', 'required' => false, 'checkedValue' => '1', 'uncheckedValue' => '0'));
     // Set custom subform decorator
     $this->setDecorators(array(array('ViewScript', array('viewScript' => 'settings/subforms/useraccount.phtml', 'role' => $this->_role))));
     $this->setElementFilters(array('StripTags'));
     $this->setElementDecorators(array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false))));
 }
Пример #8
0
 /**
  * Form init
  *
  */
 public function init()
 {
     $this->setMethod('post');
     $this->addElement('text', 'first_name', array('label' => 'First Name*', 'placeholder' => 'e.g. John', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim')));
     $this->addElement('text', 'last_name', array('label' => 'Last Name*', 'placeholder' => 'e.g. Smith', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim')));
     //http://stackoverflow.com/questions/8014011/queyring-database-for-existing-username-with-zend-and-doctrine
     $this->addElement('text', 'username', array('label' => 'Username*', 'placeholder' => 'e.g. smithj01', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'validators' => array(array('StringLength', true, array('min' => 4, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Account username must be at least %min% characters'))), array('Regex', true, array('pattern' => '/^\\w(?:[\\w\\d\\.\\-_]+)(?:\\w|\\d)$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => "The username contained invalid characters"))))));
     $frmPassword1 = new Zend_Form_Element_Password('password', 'password', array('validators' => array(array('StringLength', false, array('min' => 6, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Password must be at least %min% characters long.'))))));
     $frmPassword1->setLabel('Password*')->setAttrib('class', 'col-md-7 col-xs-1 form-control input')->setRequired('true')->addFilter(new Zend_Filter_StringTrim());
     //->addValidator('StringLength', false, array(6, 20))
     $this->addElement($frmPassword1);
     $frmPassword2 = new Zend_Form_Element_Password('confirm_password');
     $frmPassword2->setLabel('Confirm Password*')->setAttrib('class', 'col-md-7 col-xs-1 form-control input')->setRequired('true')->addFilter(new Zend_Filter_StringTrim())->addValidator('StringLength', false, array(6, 20))->addValidator(new Zend_Validate_Identical('password'));
     $this->addElement($frmPassword2);
     //        $this->addElement('text', 'password', array(
     //            'label' => 'Password (Visible!)*',
     //            'class' => 'input',
     //            'required' => true,
     //            'filters' => array('StringTrim'),
     //            'validators' => array(
     //                array('validator' => 'StringLength', 'options' => array(6, 20))
     //            )
     //        ));
     $this->addElement('select', 'role', array('label' => 'Role*', 'class' => 'input', 'required' => true, 'filters' => array('StringTrim'), 'multiOptions' => array('reviewer' => 'reviewer', 'admin' => 'admin')));
     $fileUploader = new Zend_Form_Element_File('photo');
     $fileUploader->setLabel('Photo (max 2MB, JPEG)')->setAttrib('class', 'input')->setDestination(Zend_Registry::get('uploadPath'));
     $fileUploader->addValidator('Count', false, 1);
     $fileUploader->addValidator('Size', false, 2048000);
     $fileUploader->addValidator('Extension', false, 'jpg,jpeg');
     $this->addElement($fileUploader, 'photo');
     $this->addElement('submit', 'submit', array('ignore' => true, 'class' => 'submit', 'label' => 'Add User'));
 }
Пример #9
0
 public function init()
 {
     $this->setMethod('post')->setAttrib('id', 'frmRegistrar');
     $e = new Zend_Form_Element_Text('nombre');
     $e->setRequired();
     $e->setLabel('Nombre');
     $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 25)));
     $e->addValidator(new My_Validate_NoX());
     $e->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'usuario', 'field' => 'nombre')));
     $this->addElement($e);
     $e = new Zend_Form_Element_Text('login');
     $e->setRequired();
     $e->setLabel('Login');
     $e->addValidator(new Zend_Validate_Alnum());
     $e->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'usuario', 'field' => 'login')));
     $e->addValidator(new Zend_Validate_StringLength(array('min' => 5, 'max' => 25)));
     $this->addElement($e);
     $e = new Zend_Form_Element_Password('pwd');
     $e->setRequired();
     $e->setLabel('Password');
     $this->addElement($e);
     $e = new Zend_Form_Element_Password('pwd_2');
     $e->setRequired();
     $e->setLabel('Confirmación Password');
     $e->addValidator(new My_Validate_PasswordConfirmation());
     $this->addElement($e);
     $this->addElement('submit', 'Enviar');
 }
Пример #10
0
 public function init()
 {
     $this->setAttrib('class', 'form-horizontal');
     $login = new Zend_Form_Element_Text('login');
     $login->setRequired()->addValidator('StringLength', false, array('max' => 32))->setLabel('Nom d\'utilisateur');
     $db = Zend_Db_Table::getDefaultAdapter();
     $validator = new Zend_Validate_Db_NoRecordExists(array('adapter' => $db, 'schema' => 'twitter', 'table' => 'membre', 'field' => 'login'));
     $validator->setMessage("Le login '%value%' est déjà utilisé");
     $login->addValidator($validator);
     $pass = new Zend_Form_Element_Password('pass');
     $pass->setLabel('Mot de passe')->setRequired();
     $passConfirm = new Zend_Form_Element_Password('confirm');
     $passConfirm->setLabel('Confirmer le mot de passe');
     $validator = new Zend_Validate_Identical('pass');
     $validator->setMessage('La confirmation ne correspond pas au mot de passe');
     $passConfirm->addValidator($validator);
     //$passConfirm->addValidator('Identical', false, array('token'));
     $hash = new Zend_Form_Element_Hash('hash');
     $submit = new Zend_Form_Element_Submit('Inscription');
     $cancel = new Zend_Form_Element_Button('Annuler');
     $this->addElements(array($login, $pass, $passConfirm, $hash, $submit, $cancel));
     // add display group
     $this->addDisplayGroup(array('login', 'pass', 'confirm', 'Inscription', 'Annuler'), 'users');
     $this->getDisplayGroup('users')->setLegend('S\'inscrire');
     // set decorators
     EasyBib_Form_Decorator::setFormDecorator($this, EasyBib_Form_Decorator::BOOTSTRAP, 'Inscription', 'Annuler');
 }
Пример #11
0
 /**
  *
  * 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:'******'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:'******'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:'******'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();
 }
Пример #12
0
 public function init()
 {
     $this->setMethod('post');
     //The password element.
     $passwordElement = new Zend_Form_Element_Password('password');
     $passwordElement->setRequired(true);
     $passwordElement->setLabel('New Password:'******'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 New Password:'******'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(0 => 'Please select'), 'decorators' => array(array('ViewHelper', array('escape' => false)), array('Label', array('escape' => false)))));
     $this->addElement('text', 'security_answer', array('label' => 'Answer', 'required' => true, 'filters' => array('StringTrim'), 'attribs' => array('data-ctfilter' => 'yes')));
     $this->addElement('hidden', 'instruction', array('required' => false));
     $this->addElement('submit', 'submit', array('ignore' => true, 'label' => 'Save', 'class' => 'button'));
     $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');
     $element = $this->getElement('submit');
     $element->removeDecorator('label');
     // Remove the label from the submit button
 }
Пример #13
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $this->addElementPrefixPath('Users_Form_Auth_Validate', dirname(__FILE__) . "/Validate", 'validate');
     $this->setName('userRegisterForm');
     $username = new Zend_Form_Element_Text('login');
     $username->setLabel('User name')->addDecorators($this->_inputDecorators)->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('Alnum')->addValidator('StringLength', false, array(Users_Model_User::MIN_USERNAME_LENGTH, Users_Model_User::MAX_USERNAME_LENGTH))->addValidator('Db_NoRecordExists', false, array(array('table' => 'users', 'field' => 'login')));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->addDecorators($this->_inputDecorators)->setRequired(true)->setValue(null)->addValidator('StringLength', false, array(Users_Model_User::MIN_PASSWORD_LENGTH))->addValidator('PasswordConfirmation');
     $confirmPassword = new Zend_Form_Element_Password('password2');
     $confirmPassword->setLabel('Password again')->addDecorators($this->_inputDecorators)->setRequired(true)->setValue(null)->addValidator('StringLength', false, array(Users_Model_User::MIN_PASSWORD_LENGTH));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->addDecorators($this->_inputDecorators)->setRequired(true)->setValue(null)->addValidator('StringLength', false, array(6))->addValidator('EmailAddress')->addValidator('Db_NoRecordExists', false, array(array('table' => 'users', 'field' => 'email')));
     $imgDir = dirname(APPLICATION_PATH) . "/public/captcha";
     // check captcha path is writeable
     if (is_writable($imgDir)) {
         $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => "Please verify you're a human", 'captcha' => 'Image', 'captchaOptions' => array('captcha' => 'Image', 'wordLen' => 6, 'timeout' => 300, 'imgDir' => $imgDir, 'imgUrl' => '/captcha/', 'font' => dirname(APPLICATION_PATH) . "/data/fonts/Aksent_Normal.ttf")));
     } else {
         $captcha = new Zend_Form_Element_Captcha('captcha', array('label' => "Please verify you're a human", 'captcha' => 'Figlet', 'captchaOptions' => array('wordLen' => 6, 'timeout' => 300)));
     }
     $captcha->addDecorators($this->_inputDecorators);
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Register');
     $submit->setAttrib('class', 'btn btn-primary');
     $this->addElements(array($username, $password, $confirmPassword, $email, $captcha, $submit));
     return $this;
 }
Пример #14
0
 public function init()
 {
     $this->setName('registerForm');
     $this->setMethod('post');
     $this->setAction('/user/register/');
     $user = new Zend_Form_Element_Text('user');
     $user->setLabel('Username');
     $user->setRequired(true);
     $user->addValidator('Alnum', false);
     $user->addValidator('StringLength', true, array(3, 30));
     //$user->addValidator('Db_NoRecordExists', true, array('user', 'user') );
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password');
     $password->setRenderPassword(true);
     $password->setRequired(true);
     $password->addValidator('StringLength', true, array(5, 50));
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Full Name');
     $name->setRequired(true);
     $name->addValidator('StringLength', true, array(3, 128));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email');
     $email->setRequired(true);
     $email->addValidator('EmailAddress', true);
     $email->addValidator('StringLength', true, array(3, 128));
     $submit = new Zend_Form_Element_Submit('register');
     $submit->setLabel('Register');
     $hash = new Zend_Form_Element_Hash('hash');
     $this->setElements(array($user, $password, $name, $email, $submit, $hash));
 }
Пример #15
0
 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: '******'RightPassword')->addFilters(array('StripTags', 'StringTrim'));
     $oldpassword->setDecorators($decorators);
     $password = new Zend_Form_Element_Password("password");
     $password->setLabel("New password:"******"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:"******"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: ');
 }
Пример #16
0
 /**
  * Form initialization
  *
  * @return void
  */
 public function init()
 {
     $this->setName('loginForm');
     $this->setElementsBelongTo('loginForm');
     $element = new Zend_Form_Element_Text('username');
     $element->setLabel('Username')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Password('password');
     $element->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $this->addElement($element);
     $element = new Zend_Form_Element_Checkbox('rememberMe');
     $element->setLabel('Remember me');
     $this->addElement($element);
     /**
      * @var $request Zend_Controller_Request_Http
      */
     $request = Zend_Controller_Front::getInstance()->getRequest();
     $element = new Zend_Form_Element_Hidden('redirect');
     $element->setValue($request->getParam('from', '/'))->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim');
     $element->getDecorator('HtmlTag')->setOption('class', 'hidden');
     $element->getDecorator('Label')->setOption('tagClass', 'hidden');
     $this->addElement($element);
     $element = new Zend_Form_Element_Submit('submit');
     $element->setLabel('Connection');
     $this->addElement($element);
 }
 public function init()
 {
     /*
      * Some people consider this to be "interface" stuff,
      * to be done in the view. Personally, I think 'action' and 'method'
      * can be done here, though the fact that we need the view object
      * in order to ender the url for the action suggests that it, too, should
      * be in the view. But 'name' and 'attribs' really are kind of view-ish.
      *
      * Still, I like the idea that the view-script is so simple, just render the form.
      *
      * @todo To be discussed.
      */
     $this->setMethod('post')->setAction($this->getView()->url(array('module' => 'auth', 'controller' => 'login', 'action' => 'index')))->setAttrib('class', 'box')->setName('Login');
     # Email
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator('EmailAddress');
     # Password
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->setRequired(TRUE)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $hash = new Zend_Form_Element_Hash('csrf', array('salt' => 'unique'));
     $hash->setTimeout(300)->addErrorMessage('Form timed out. Please reload the page & try again');
     # Submit
     $submit = new Zend_Form_Element_Submit('login');
     # Create
     $this->addElements(array($email, $password, $submit));
 }
Пример #18
0
 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);
 }
Пример #19
0
 public function init()
 {
     $this->setName('user');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int');
     $id->removeDecorator('label');
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('name')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->addValidator('NotEmpty', true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('StringLength', false, array(3, 20))->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $date = new Zend_Form_Element_Text('date');
     $date->setLabel('Date')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('emailAddress', TRUE)->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $status = new Zend_Form_Element_Text('status');
     $status->setLabel('status')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $person_id = new Zend_Form_Element_Text('person_id');
     $person_id->setLabel('person_id')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $validation_code = new Zend_Form_Element_Text('validation_code');
     $validation_code->setLabel('validation')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $phone = new Zend_Form_Element_Text('phone');
     $phone->setLabel('Phone')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setAttrib('size', 30)->setAttrib('maxlength', 80)->setAttrib("class", "inputbox")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_text.phtml'))));
     $role_id = new Zend_Form_Element_Select('role_id');
     $role_id->setLabel('Role')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsRole())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
     $company_id = new Zend_Form_Element_Select('company_id');
     $company_id->setLabel('company')->setRequired(true)->addValidator('NotEmpty', true)->setmultiOptions($this->_selectOptionsCompany())->setAttrib('maxlength', 200)->setAttrib('size', 1)->setAttrib("class", "toolboxdrop")->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_select.phtml'))));
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setValue('Guardar')->setAttrib('id', 'submitbutton')->setDecorators(array(array('ViewScript', array('viewScript' => 'forms/_element_submit.phtml'))))->setAttrib('class', 'btn')->removeDecorator('label');
     $add_contact = new Zend_Form_Element_Checkbox('add_contact');
     $add_contact->setLabel('add contact')->setRequired(true);
     $this->addElements(array($id, $name, $password, $date, $email, $status, $validation_code, $person_id, $phone, $role_id, $company_id, $add_contact, $submit));
 }
Пример #20
0
 public function init()
 {
     $this->setName('f2')->setMethod('post')->setAttribs(array('id' => 'user'));
     $id = new Zend_Form_Element_Hidden('id');
     $id->addFilter('Int')->removeDecorator('label');
     $username = new Zend_Form_Element_Text('ten_dang_nhap');
     $username->setLabel('Tên đăng nhập (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addFilter('StringToLower')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 32))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten_dang_nhap', 'class' => 'text-input'));
     $password = new Zend_Form_Element_Password('mat_khau');
     $password->setLabel('Mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mat_khau', 'class' => 'text-input'));
     $repassword = new Zend_Form_Element_Password('mat_khau_2');
     $repassword->setLabel('Nhập lại mật khẩu (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator(new Zend_Validate_Identical('mat_khau'))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'mat_khau_2', 'class' => 'text-input'));
     $ho = new Zend_Form_Element_Text('ho');
     $ho->setLabel('Họ (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 100))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'style' => 'width: 83%')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ho', 'class' => 'text-input'));
     $ten = new Zend_Form_Element_Text('ten');
     $ten->setLabel('Tên (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_StringLength(0, 20))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ten', 'class' => 'text-input'));
     $ngay_sinh = new Zend_Form_Element_Text('ngay_sinh');
     $ngay_sinh->setLabel('Ngày sinh (*)')->setDescription('(dd-mm-YYYY)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->setDecorators(array('ViewHelper', 'Errors', array('Description', array('tag' => 'span')), array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'ngay_sinh', 'class' => 'text-input'));
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email (*)')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->addValidator(new Zend_Validate_EmailAddress())->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('tag' => 'td')), array('Label', array('tag' => 'td')), array(array('row' => 'HtmlTag'), array('tag' => 'tr'))))->setAttribs(array('id' => 'email', 'class' => 'text-input'));
     $submitCon = new Zend_Form_Element_Submit('submitCon');
     $submitCon->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $submitExit = new Zend_Form_Element_Submit('submitExit');
     $submitExit->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button'));
     $url = new Zend_View_Helper_Url();
     $link = $url->url(array('module' => 'admin', 'controller' => 'index', 'action' => 'index'));
     $cancel = new Zend_Form_Element_Button('cancel');
     $cancel->setDecorators(array('ViewHelper', array(array('data' => 'HtmlTag'), array('tag' => 'span')), array(array('row' => 'HtmlTag'), array('tag' => 'span'))))->setAttribs(array('class' => 'button', 'onclick' => 'window.location.href="' . $link . '"'));
     $this->addElements(array($id, $username, $password, $repassword, $ho, $ten, $ngay_sinh, $email, $submitCon, $submitExit, $cancel));
     $this->addDisplayGroup(array('submitCon', 'submitExit', 'cancel'), 'submitbtn', array('decorators' => array('FormElements', array(array('data' => 'HtmlTag'), array('tag' => 'td', 'colspan' => 2)), array(array('row' => 'HtmlTag'), array('tag' => 'td')), array('HtmlTag', array('tag' => 'tr', 'id' => 'btn')))));
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'table')), 'Form'));
 }
Пример #21
0
 public function init()
 {
     $this->setName('LoginForm')->setMethod('post')->setAction('validate');
     $id = new Zend_Form_Element_Hidden('user_id');
     $id->addFilter('Int');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email address')->addValidator('EmailAddress')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     //$this->addElement(array($email_id));
     //->addFilter('stringtoLower');
     $email->setAttrib('class', 'input');
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     //->addValidator('StringLength',false,array(12));
     //->setRequired(true);
     //$this->addElement(array('$password'));
     $password->setAttrib('class', 'input');
     $submit = new Zend_Form_Element_Submit('Login');
     $submit->setLabel('Login here');
     $submit->setAttrib('id', 'submitbutton');
     //id=submitbutton
     /*$register = new Zend_Form_Element_Submit('Register');
     		$register->setLabel('Register here')
     		         ->setIgnore(true);
     		$register->setAttrib('id', 'submitbutton');*/
     $this->addElements(array($id, $email, $password, $submit));
 }
Пример #22
0
 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);
 }
Пример #23
0
 /** Initialize this form. */
 public function init()
 {
     $this->setName('ldap_admin');
     $this->setMethod('POST');
     $csrf = new Midas_Form_Element_Hash('csrf');
     $csrf->setSalt('pZyCgKUmRGcsxVdNEtJLrAhW');
     $csrf->setDecorators(array('ViewHelper'));
     $hostName = new Zend_Form_Element_Text(LDAP_HOST_NAME_KEY);
     $hostName->setLabel('LDAP Server Name');
     $hostName->setRequired(true);
     $hostName->addValidator('NotEmpty', true);
     $hostName->addValidator('Hostname', true, array('allow' => Zend_Validate_Hostname::ALLOW_ALL, 'tld' => false));
     $port = new Zend_Form_Element_Text(LDAP_PORT_KEY);
     $port->setLabel('LDAP Server Port');
     $port->setRequired(true);
     $port->addValidator('NotEmpty', true);
     $port->addValidator('Digits', true);
     $port->addValidator('Between', true, array('min' => 1, 'max' => 65535));
     $port->setAttrib('maxlength', 5);
     $backupServer = new Zend_Form_Element_Text(LDAP_BACKUP_SERVER_KEY);
     $backupServer->setLabel('Backup Server Name');
     $backupServer->addValidator('NotEmpty', true);
     $backupServer->addValidator('Hostname', true, array('allow' => Zend_Validate_Hostname::ALLOW_ALL, 'tld' => false));
     $bindRdn = new Zend_Form_Element_Text(LDAP_BIND_RDN_KEY);
     $bindRdn->setLabel('Bind DN');
     $bindRdn->addValidator('NotEmpty', true);
     $bindPassword = new Zend_Form_Element_Password(LDAP_BIND_PASSWORD_KEY);
     $bindPassword->setLabel('Bind Password');
     $bindPassword->addValidator('NotEmpty', true);
     $baseDn = new Zend_Form_Element_Text(LDAP_BASE_DN_KEY);
     $baseDn->setLabel('Base DN');
     $baseDn->setRequired(true);
     $baseDn->addValidator('NotEmpty', true);
     $protocolVersion = new Zend_Form_Element_Text(LDAP_PROTOCOL_VERSION_KEY);
     $protocolVersion->setLabel('LDAP Protocol Version');
     $protocolVersion->setRequired(true);
     $protocolVersion->addValidator('NotEmpty', true);
     $protocolVersion->addValidator('Digits', true);
     $protocolVersion->addValidator('GreaterThan', true, array('min' => 1));
     $protocolVersion->setAttrib('maxlength', 1);
     $searchTerm = new Zend_Form_Element_Text(LDAP_SEARCH_TERM_KEY);
     $searchTerm->setLabel('Search Term');
     $searchTerm->setRequired(true);
     $searchTerm->addValidator('NotEmpty', true);
     $proxyBaseDn = new Zend_Form_Element_Text(LDAP_PROXY_BASE_DN_KEY);
     $proxyBaseDn->setLabel('Proxy Base DN');
     $proxyBaseDn->addValidator('NotEmpty', true);
     $proxyPassword = new Zend_Form_Element_Password(LDAP_PROXY_PASSWORD_KEY);
     $proxyPassword->setLabel('Proxy Password');
     $proxyPassword->addValidator('NotEmpty', true);
     $useActiveDirectory = new Zend_Form_Element_Checkbox(LDAP_USE_ACTIVE_DIRECTORY_KEY);
     $useActiveDirectory->setLabel('Use Active Directory');
     $autoAddUnknownUser = new Zend_Form_Element_Checkbox(LDAP_AUTO_ADD_UNKNOWN_USER_KEY);
     $autoAddUnknownUser->setLabel('Automatically Add Unknown Users');
     $this->addDisplayGroup(array($hostName, $port, $backupServer, $bindRdn, $bindPassword, $baseDn, $protocolVersion, $searchTerm, $proxyBaseDn, $proxyPassword, $useActiveDirectory, $autoAddUnknownUser), 'global');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Save');
     $this->addElements(array($csrf, $hostName, $port, $backupServer, $bindRdn, $bindPassword, $baseDn, $protocolVersion, $searchTerm, $proxyBaseDn, $proxyPassword, $useActiveDirectory, $autoAddUnknownUser, $submit));
 }
Пример #24
0
 public function init()
 {
     $this->setName('ong');
     $this->setAction("new-ong");
     $nome = new Zend_Form_Element_Text('nome');
     $nome->setLabel("Nome")->setRequired(true)->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addFilter('StripTags')->addValidator("StringLength", false, array(4, 80, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $sobreNome = new Zend_Form_Element_Text('sobrenome');
     $sobreNome->setLabel("Sobrenome:")->setRequired(true)->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campoFim'))->addFilter('StripTags')->addValidator("StringLength", false, array(4, 50, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $login = new Zend_Form_Element_Text('login');
     $login->setLabel('usuario:')->setRequired(true)->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addValidator("StringLength", false, array(4, 50, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $passworf = new Zend_Form_Element_Password("senha");
     $passworf->setLabel('senha:')->setRequired(true)->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addValidator("StringLength", false, array(4, 50, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $confirmPassworf = new Zend_Form_Element_Password("confirm_senha");
     $confirmPassworf->setLabel('confirma senha:')->setRequired(true)->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addValidator("StringLength", false, array(4, 50, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('email:')->setRequired(true)->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campoFim'))->addValidator("StringLength", false, array(4, 50, 'messages' => 'StringLength'))->addValidator('NotEmpty')->addValidator('regex', false, array('/[^a-zA-Z0-9@#\\[\\].]/'));
     //-----
     $fantasia = new Zend_Form_Element_Text('fantasia');
     $fantasia->setLabel("Nome Fantasia:")->setRequired(true)->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addFilter('StripTags')->addValidator("StringLength", false, array(4, 80, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $razao = new Zend_Form_Element_Text('razao');
     $razao->setLabel("Raz�o Social:")->setRequired(true)->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addFilter('StripTags')->addValidator("StringLength", false, array(4, 80, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $cpf = new Zend_Form_Element_Text('cnpj');
     $cpf->setLabel('CNPJ:')->setRequired(true)->setAttrib('alt', 'cnpj')->addFilter('StripTags')->addValidator('cnpj')->addFilter('StringTrim')->addValidator('NotEmpty')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campoFim'));
     //------------------
     //endere�o
     $endereco = new Zend_Form_Element_Text('endereco');
     $endereco->setLabel('Endere�o:')->setRequired(true)->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'))->addValidator("StringLength", false, array(4, 50, 'messages' => 'StringLength'))->addValidator('NotEmpty');
     $numero = new Zend_Form_Element_Text('numero');
     $numero->setLabel('N�:')->setAttrib('size', 5)->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'));
     $complemento = new Zend_Form_Element_Text('complemento');
     $complemento->setLabel('Complemento:')->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'));
     $bairro = new Zend_Form_Element_Text('bairro');
     $bairro->setLabel('Bairro:')->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'));
     $cep = new Zend_Form_Element_Text('bairro');
     $cep->setLabel('Bairro:')->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'));
     $db_estado = new Application_Model_DbTable_SysEstado();
     $state_array = $db_estado->fetchAll()->toArray();
     $arr[0] = "Escolha estado";
     foreach ($state_array as $est) {
         $arr[] = $est["nome"];
     }
     unset($arr[29]);
     unset($arr[28]);
     $state = new Zend_Form_Element_Select("estado");
     $state->setLabel('Estado:')->setName("estado")->addMultiOptions($arr)->setRequired(true)->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'));
     $cities = new Zend_Form_Element_Select("cidade");
     $cities->setLabel('Cidade:')->setName("cidade")->setOptions(array('RegisterInArrayValidator' => false))->setRequired(true)->addMultiOptions(array('0' => 'Escolha estado'))->addFilter('StripTags')->addDecorator('HtmlTag', array('tag' => 'div', 'class' => 'campo'));
     $capoOculto = new Zend_Form_Element_Hidden("campo_oculto");
     $capoOculto->setValue("1");
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel('Cadastrar')->setAttrib('id', 'submitbutton');
     //decoracao
     $this->setDecorators(array('FormElements', array('HtmlTag', array('tag' => 'div', 'class' => 'zend_form')), array('Description', array('placement' => 'prepend')), 'Form'));
     $this->addElements(array($nome, $sobreNome, $login, $passworf, $confirmPassworf, $email, $fantasia, $razao, $state, $cities, $capoOculto, $submit));
     $translate = Zend_Registry::get('Zend_Translate');
     $this->setTranslator($translate);
     $translate->setLocale('br');
 }
Пример #25
0
 public function init()
 {
     /* Form Elements & Other Definitions Here ... */
     $this->setName('nome');
     $this->setAttrib('enctype', 'multipart/form-data');
     $ID_OPERADOR = new Zend_Form_Element_Hidden('ID_OPERADOR');
     $ID_OPERADOR->addFilter('Int');
     $NM_OPERADOR = new Zend_Form_Element_Text('NM_OPERADOR');
     $NM_OPERADOR->setLabel('NOME')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter nome');
     $DS_TELEFONE_PESSOAL = new Zend_Form_Element_Text('DS_TELEFONE_PESSOAL');
     $DS_TELEFONE_PESSOAL->setLabel('TELEFONE PESSOAL')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter telefone pessoal');
     $DS_TELEFONE_BIOS = new Zend_Form_Element_Text('DS_TELEFONE_BIOS');
     $DS_TELEFONE_BIOS->setLabel('TELEFONE BIOS')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter telefone bios');
     $DS_EMAIL_PESSOAL = new Zend_Form_Element_Text('DS_EMAIL_PESSOAL');
     $DS_EMAIL_PESSOAL->setLabel('E-MAIL PESSOAL')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter e-mail pessoal');
     $DS_EMAIL_BIOS = new Zend_Form_Element_Text('DS_EMAIL_BIOS');
     $DS_EMAIL_BIOS->setLabel('E-MAIL BIOS')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter e-mail bios');
     $DS_ENDERECO = new Zend_Form_Element_Text('DS_ENDERECO');
     $DS_ENDERECO->setLabel('ENDEREÇO')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter endereco');
     $DS_BAIRRO = new Zend_Form_Element_Text('DS_BAIRRO');
     $DS_BAIRRO->setLabel('BAIRRO')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter bairro');
     $NR_CEP = new Zend_Form_Element_Text('NR_CEP');
     $NR_CEP->setLabel('CEP')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter cep');
     $NR_CPF = new Zend_Form_Element_Text('NR_CPF');
     $NR_CPF->setLabel('CPF')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter cpf');
     $NR_IDENTIDADE = new Zend_Form_Element_Text('NR_IDENTIDADE');
     $NR_IDENTIDADE->setLabel('Nº IDENTIDADE')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter nº identidade');
     $DT_NASCIMENTO = new Zend_Form_Element_Text('DT_NASCIMENTO');
     $DT_NASCIMENTO->setLabel('DATA NASCIMENTO')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter data nascimento');
     $DS_REGISTRO_PROFISSIONAL = new Zend_Form_Element_Text('DS_REGISTRO_PROFISSIONAL');
     $DS_REGISTRO_PROFISSIONAL->setLabel('REGISTRO PROFISSIONAL')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter data registro profissional');
     $DS_CTF_IBAM = new Zend_Form_Element_Text('DS_CTF_IBAM');
     $DS_CTF_IBAM->setLabel('CTF IBAMA')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter ctf ibama');
     $DS_SKYPE = new Zend_Form_Element_Text('DS_SKYPE');
     $DS_SKYPE->setLabel('SKYPE')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter skype');
     $DS_LOGIN = new Zend_Form_Element_Text('DS_LOGIN');
     $DS_LOGIN->setLabel('LOGIN')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter skype');
     $DS_SENHA = new Zend_Form_Element_Password('DS_SENHA');
     $DS_SENHA->setLabel('SENHA')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter senha');
     $REPETIR_SENHA = new Zend_Form_Element_Password('REPETIR_SENHA');
     $REPETIR_SENHA->setLabel('REPETIR SENHA')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter repetir senha');
     $NM_CONTATO_FAMILIAR = new Zend_Form_Element_Text('NM_CONTATO_FAMILIAR');
     $NM_CONTATO_FAMILIAR->setLabel('NOME CONTATO FAMILIAR')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter nome contato familiar');
     $NR_TELEFONE_CONTATO_FAMILIAR = new Zend_Form_Element_Text('NR_TELEFONE_CONTATO_FAMILIAR');
     $NR_TELEFONE_CONTATO_FAMILIAR->setLabel('Nº TELEFONE CONTATO FAMILIAR')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty')->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control')->setAttrib('placeholder', 'Enter n� telefone contato familiar');
     $FK_PERFIL = new Zend_Form_Element_Select('FK_PERFIL');
     $perfil = new Application_Model_DbTable_Perfil();
     $FK_PERFIL->setLabel('Perfil');
     $FK_PERFIL->setMultiOptions($perfil->getPerfil())->setRequired(true)->removeDecorator('DtDdWrapper')->removeDecorator('HtmlTag')->removeDecorator('Label')->setAttrib('class', 'form-control select2');
     $submit = new Zend_Form_Element_Submit('submit');
     $submit->setLabel("Adiconar");
     $submit->setAttrib('id', 'submitbutton');
     $submit->removeDecorator('DtDdWrapper')->setAttrib('class', 'btn btn-primary button')->removeDecorator('HtmlTag')->removeDecorator('Label');
     $this->addElements(array($ID_OPERADOR, $NM_OPERADOR, $DS_TELEFONE_PESSOAL, $DS_TELEFONE_BIOS, $DS_EMAIL_PESSOAL, $DS_EMAIL_BIOS, $DS_ENDERECO, $DS_BAIRRO, $NR_CEP, $NR_CPF, $NR_IDENTIDADE, $DT_NASCIMENTO, $DS_REGISTRO_PROFISSIONAL, $DS_CTF_IBAM, $DS_SKYPE, $DS_LOGIN, $DS_SENHA, $REPETIR_SENHA, $NM_CONTATO_FAMILIAR, $NR_TELEFONE_CONTATO_FAMILIAR, $FK_PERFIL, $submit));
     // $this->addElements(array($id, $nome, $email,$senha, $submit));
     $this->setDecorators(array(array('ViewScript', array('viewScript' => '/forms/formularioOperador.phtml'))));
 }
Пример #26
0
 /**
  * (non-PHPdoc)
  * @see Zend_Form#init()
  */
 public function init()
 {
     $this->addElementPrefixPath('Tri_Filter', 'Tri/Filter', 'FILTER');
     $this->addElementPrefixPath('Tri_Validate', 'Tri/Validate', 'VALIDATE');
     $user = new Tri_Db_Table('user');
     $validators = $user->getValidators();
     $filters = $user->getFilters();
     $statusOptions = $user->fetchPairs('status', 'status');
     $roles = $user->fetchPairs('role', 'role');
     $uploadDir = str_replace('APPLICATION_PATH', APPLICATION_PATH, Tri_Config::get('tri_upload_dir'));
     $this->setAction('user/save')->setMethod('post')->setAttrib('enctype', 'multipart/form-data');
     $id = new Zend_Form_Element_Hidden('id');
     $id->addValidators($validators['id'])->addFilters($filters['id'])->removeDecorator('Label')->removeDecorator('HtmlTag');
     $filters['name'][] = 'StripTags';
     $name = new Zend_Form_Element_Text('name');
     $name->setLabel('Name')->addValidators($validators['name'])->addFilters($filters['name'])->setAllowEmpty(false);
     $email = new Zend_Form_Element_Text('email');
     $email->setLabel('Email')->addValidators($validators['email'])->addFilters($filters['email'])->setAllowEmpty(false);
     $filters['password'][] = 'Md5';
     $validators['password'][] = 'PasswordConfirmation';
     $password = new Zend_Form_Element_Password('password');
     $password->setLabel('Password')->addValidators($validators['password'])->addFilters($filters['password']);
     $passwordConfirmation = new Zend_Form_Element_Password('password_confirm');
     $passwordConfirmation->setLabel('Password confirmation')->addFilter('Md5');
     $sex = new Zend_Form_Element_Select('sex');
     $sex->setLabel('Sex')->addValidators($validators['sex'])->addFilters($filters['sex'])->addMultiOptions(array('' => '[select]', 'M' => 'Male', 'F' => 'Female'));
     $born = new Zend_Form_Element_Text('born');
     $born->setLabel('Born')->setAttrib('class', 'date')->addFilters($filters['born'])->addValidators($validators['born']);
     $filters['description'][] = 'StripTags';
     $description = new Zend_Form_Element_Textarea('description');
     $description->setLabel('Description')->addValidators($validators['description'])->addFilters($filters['description'])->setAllowEmpty(false);
     $file = new Zend_Form_Element_File('image');
     $file->setLabel('Image')->setDestination($uploadDir)->setMaxFileSize(2097152)->setValueDisabled(true)->addFilter('Rename', uniqid())->addValidator('Count', false, 1)->addValidator('Size', false, 2097152)->addValidator('Extension', false, 'jpg,png,gif');
     if (!$roles || isset($roles[''])) {
         $role = new Zend_Form_Element_Text('role');
     } else {
         $rolea = array_unique($roles);
         $role = new Zend_Form_Element_Select('role');
         $role->addMultiOptions(array('' => '[select]') + $roles)->setRegisterInArrayValidator(false);
     }
     $role->setLabel('Role')->addValidators($validators['role'])->addFilters($filters['role']);
     if (!$statusOptions || isset($statusOptions[''])) {
         $status = new Zend_Form_Element_Text('status');
     } else {
         $statusOptions = array_unique($statusOptions);
         $status = new Zend_Form_Element_Select('status');
         $status->addMultiOptions(array('' => '[select]') + $statusOptions)->setRegisterInArrayValidator(false);
     }
     $status->setLabel('Status')->addValidators($validators['status'])->addFilters($filters['status']);
     $this->addElement($id)->addElement($name)->addElement($email)->addElement($password)->addElement($passwordConfirmation)->addElement($description)->addElement($sex)->addElement($born)->addElement($file);
     $identity = Zend_Auth::getInstance()->getIdentity();
     if ($identity && $identity->role == 'institution') {
         $this->addElement($status)->addElement($role);
     }
     $this->addElement('submit', 'Save');
 }
Пример #27
0
 public function init()
 {
     $usernameField = new \SAP\Form\Element\Text('username');
     $usernameField->setLabel('Username')->setRequired(true)->setAllowEmpty(false)->setDescription('Your personal username');
     $passwordField = new Zend_Form_Element_Password('password');
     $passwordField->setLabel('Password')->setRequired(true)->setAllowEmpty(false)->setDescription('Your personal password');
     $submitButton = new Zend_Form_Element_Submit('login');
     $submitButton->setLabel('Login');
     $this->addElements(array($usernameField, $passwordField, $submitButton));
 }
Пример #28
0
 public function init()
 {
     $this->setName('Login');
     $login = new Zend_Form_Element_Text('login');
     $login->setLabel('Login')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $senha = new Zend_Form_Element_Password('senha');
     $senha->setLabel('Senha')->setRequired(true)->addFilter('StripTags')->addFilter('StringTrim')->addValidator('NotEmpty');
     $submit = new Zend_Form_Element_Submit('Entrar');
     $this->addElements(array($login, $senha, $submit));
 }
Пример #29
0
 public function init()
 {
     $this->setName('Login')->setAttrib('id', 'login')->setMethod('post')->setElementFilters(array('StripTags', 'StringTrim'));
     $cpf = new Zend_Form_Element_Text('COU_COD_MATRICULA');
     $cpf->setLabel('Matrícula:')->setAttrib('size', '24')->setRequired(true)->addValidator('Alnum')->addFilter('HtmlEntities')->addFilter('StringTrim')->addValidator('StringLength', false, array(4, 11))->setOptions(array('maxLength' => 11));
     $password = new Zend_Form_Element_Password('COU_COD_PASSWORD');
     $password->setLabel('Senha:')->setAttrib('size', '24')->setRequired(true)->addFilter('StringTrim');
     $submit = new Zend_Form_Element_Submit('Conectar');
     $this->addElements(array($cpf, $password, $submit));
 }
Пример #30
0
 public function init()
 {
     $username = new Zend_Form_Element_Text('username', array('class' => 'form-control'));
     $username->setLabel('Логин')->setRequired(true)->setAttrib('placeholder', 'username')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[A-Za-z1-90 \\.\\-\\А\\П\\Н]{3,20}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     $password = new Zend_Form_Element_Password('password', array('class' => 'form-control'));
     $password->setLabel('Пароль')->setRequired(true)->setAttrib('placeholder', 'password')->addFilter('StripTags')->addFilter('StringTrim')->addValidator('regex', true, array("/^[A-Za-z1-90 \\.\\-\\А\\П\\Н]{3,20}\$/i", 'messages' => $settings['messages']['error']))->addValidator('NotEmpty', true, array('messages' => array('isEmpty' => $settings['messages']['empty'])))->setDecorators(array('ViewHelper', 'Errors', array(array('data' => 'HtmlTag'), array('class' => 'test')), array('Label', array('tag' => 'div', 'class' => 'form-control-static')), array('Errors', array('tag' => 'div', 'class' => 'form-control-static')), array(array('row' => 'HtmlTag'), array('tag' => 'div', 'class' => 'form-group'))));
     // Создаём элемент формы Submit c именем = submit
     $submit = new Zend_Form_Element_Submit('submit', array('class' => 'btn btn-lg btn-success btn-block'));
     $this->addElements(array($username, $password, $submit));
 }