/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); //source //alias aliasNotLogged viewIdentifier viewTitle params isStatic //metaKeywords metaDescription $id = new Zend_Form_Element_Hidden('urlAliasId'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $source = new Zend_Form_Element_Text('source'); $source->setOptions(array('label' => 'Source', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($source); $alias = new Zend_Form_Element_Text('alias'); $alias->setOptions(array('label' => 'Alias', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($alias); $params = new Zend_Form_Element_Text('params'); $params->setOptions(array('value' => '{"module":"frontend","controller":"__","action":"__"}', 'label' => 'Params', 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($params); $isStatic = new Zend_Form_Element_Text('isStatic'); $isStatic->setOptions(array('label' => 'isStatic', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($isStatic); $metaKeywords = new Zend_Form_Element_Text('metaKeywords'); $metaKeywords->setOptions(array('label' => 'metaKeywords', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($metaKeywords); $metaDescription = new Zend_Form_Element_Text('metaDescription'); $metaDescription->setOptions(array('label' => 'metaDescription', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($metaDescription); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save'), 'required' => true)); $this->addElement($submit); }
public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => $this->t('First name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => $this->t('Last name'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $checkEmailNotJunk = new Zend_Validate_Callback(array($this, 'emailNotJetable')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => $this->t('Email'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $checkEmailNotJunk, $uniqueEmailValidator))); $this->addElement($email); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $user = Zend_Auth::getInstance()->getIdentity(); $oldPasswordValidator = new App_Validate_PasswordExists(array('table' => 'backoffice_users', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkValue' => $user->id)); $complexityValidator = new Zend_Validate_Regex('/^(?=.*\\d)(?=.*[a-z|A-Z]).{7,}$/'); $complexityValidator->setMessage('The selected password does not meet the required complexity requirements'); $stringLengthValidator = new Zend_Validate_StringLength(); $stringLengthValidator->setMin(7); $stringLengthValidator->setMessage('Your password must be at least 7 characters long'); $passwordHistoryValidator = new App_Validate_NoPasswordExists(array('table' => 'password_log', 'field' => 'password', 'treatment' => 'BackofficeUser::hashPassword', 'userPkField' => 'user_id', 'userPkValue' => $user->id)); $oldPassword = new Zend_Form_Element_Password('old_password'); $oldPassword->setOptions(array('label' => 'Old password', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $oldPasswordValidator))); $this->addElement($oldPassword); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => 'New password', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $stringLengthValidator, $complexityValidator, $passwordHistoryValidator))); $this->addElement($password); $sameAsValidator = new App_Validate_SameAs($password); $sameAsValidator->setMessage('The two passwords do not coincide.', App_Validate_SameAs::NOT_THE_SAME); $retypeNewPassword = new Zend_Form_Element_Password('retype_new_password'); $retypeNewPassword->setOptions(array('label' => 'Retype new password', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $sameAsValidator))); $this->addElement($retypeNewPassword); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save password', 'required' => TRUE)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'readonly' => 'readonly')); $this->addElement($username); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => 'Email address', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', 'EmailAddress'))); $this->addElement($email); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save profile', 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); // form fields }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('required' => true, 'validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Yes, delete it', 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($username); $password = new Zend_Form_Element_Password('password'); $password->setOptions(array('label' => 'Password', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($password); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Log in →', 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $raisonsocial = new Zend_Form_Element_Text('raison sociale'); $raisonsocial->setOptions(array('label' => $this->t('Raison sociale'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($raisonsocial); // $groupsInArrayValidator = new Zend_Validate_InArray(array_keys(array(1, 2, 3))); // $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $status = new Zend_Form_Element_Radio('status'); $status->setOptions(array('label' => $this->t('Status'), 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => array('Gérant' => 'Gérant', 'Associé' => 'Associé', 'Freelance patenté' => 'Freelance patenté'))); $this->addElement($status); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => $this->t('Save user'), 'required' => true, 'order' => 100)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $uniqueGroupNameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'groups', 'field' => 'name')); $groupModel = new Group(); $parentIdOptions = $groupModel->findPairs(); $name = new Zend_Form_Element_Text('name'); $name->setOptions(array('label' => 'Name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueGroupNameValidator))); $this->addElement($name); $parentId = new Zend_Form_Element_Select('parent_id'); $parentId->setOptions(array('label' => 'Parent group', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $parentIdOptions)); $this->addElement($parentId); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save user group', 'required' => true)); $this->addElement($submit); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $groupModel = new Group(); $groupsOptions = $groupModel->findPairs(); $uniqueUsernameValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'username')); $uniqueEmailValidator = new Zend_Validate_Db_NoRecordExists(array('table' => 'backoffice_users', 'field' => 'email')); $groupsInArrayValidator = new Zend_Validate_InArray(array_keys($groupsOptions)); $groupsInArrayValidator->setMessage('Please select at least one group. If you are not sure about which group is better, select "member".'); $username = new Zend_Form_Element_Text('username'); $username->setOptions(array('label' => 'Username', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueUsernameValidator))); $this->addElement($username); $email = new Zend_Form_Element_Text('email'); $email->setOptions(array('label' => 'Email', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $uniqueEmailValidator))); $this->addElement($email); $firstname = new Zend_Form_Element_Text('firstname'); $firstname->setOptions(array('label' => 'First name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($firstname); $lastname = new Zend_Form_Element_Text('lastname'); $lastname->setOptions(array('label' => 'Last name', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($lastname); $phoneNumber = new Zend_Form_Element_Text('phone_number'); $phoneNumber->setOptions(array('label' => 'Phone number', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($phoneNumber); $groups = new Zend_Form_Element_MultiCheckbox('groups'); $groups->setOptions(array('label' => 'Select the one or more user groups for this user', 'required' => true, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty', $groupsInArrayValidator), 'multiOptions' => $groupsOptions)); $this->addElement($groups); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save user', 'required' => true, 'order' => 100)); $this->addElement($submit); $this->addDisplayGroup(array('username', 'email', 'firstname', 'lastname', 'phone_number'), 'userdata')->getDisplayGroup('userdata')->setLegend('User details'); $this->addDisplayGroup(array('groups'), 'usergroups')->getDisplayGroup('usergroups')->setLegend('Groups'); }
/** * Overrides init() in Zend_Form * * @access public * @return void */ public function init() { // init the parent parent::init(); // set the form's method $this->setMethod('post'); $flagModel = new Flag(); $flagIdOptions = $flagModel->findPairs(); $name = new Zend_Form_Element_Text('name'); $name->setOptions(array('label' => 'Name', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($name); $flagId = new Zend_Form_Element_Select('flag_id'); $flagId->setOptions(array('label' => 'Flag', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'), 'multiOptions' => $flagIdOptions)); $this->addElement($flagId); $description = new Zend_Form_Element_Text('description'); $description->setOptions(array('label' => 'Description', 'required' => TRUE, 'filters' => array('StringTrim', 'StripTags'), 'validators' => array('NotEmpty'))); $this->addElement($description); $id = new Zend_Form_Element_Hidden('id'); $id->setOptions(array('validators' => array(new Zend_Validate_Regex('/^\\d*$/')))); $this->addElement($id); $submit = new Zend_Form_Element_Submit('submit'); $submit->setOptions(array('label' => 'Save privilege', 'required' => TRUE)); $this->addElement($submit); }