Пример #1
0
 /**
  * Inserts two selections and buttons to control the elements between them.
  *
  * @param string $name - Define elements id. Important to javascript interaction
  * @param string $label
  * @param array $start_itens
  * @param array $end_itens
  */
 public function setSelectBox($name, $label, $start_itens, $end_itens = false)
 {
     $i18n = Zend_Registry::get("i18n");
     $header = new Zend_Form_Element_Hidden('elementHeader');
     $header->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selects', 'openOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::PREPEND));
     $start_box = new Zend_Form_Element_Multiselect("box");
     $start_box->setLabel($i18n->translate($label))->setMultiOptions($start_itens)->removeDecorator('DtDdWrapper')->setAttrib('id', $name . '_box')->setRegisterInArrayValidator(false);
     $end_box = new Zend_Form_Element_Multiselect("box_add");
     if ($end_itens) {
         $end_box->setMultiOptions($end_itens);
         $end_box->setValue(array_keys($end_itens));
     }
     $end_box->removeDecorator('DtDdWrapper')->removeDecorator('Label')->setAttrib('id', $name . '_box_add')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selects', 'closeOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::APPEND))->setRegisterInArrayValidator(false);
     $add_action = new Zend_Form_Element_Button($i18n->translate('Add'));
     $add_action->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'li'))->setAttrib('id', $name . '_add_bt')->setAttrib('class', 'add_item')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selectActions', 'openOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::PREPEND));
     $remove_action = new Zend_Form_Element_Button($i18n->translate('Remove'));
     $remove_action->removeDecorator("DtDdWrapper")->addDecorator('HtmlTag', array('tag' => 'li'))->setAttrib('id', $name . '_remove_bt')->setAttrib('class', 'remove_item')->addDecorator('HtmlTag', array('tag' => 'div', 'id' => 'selectActions', 'closeOnly' => true, 'placement' => Zend_Form_Decorator_Abstract::APPEND));
     $this->addElements(array($header, $start_box, $add_action, $remove_action, $end_box));
 }
Пример #2
0
 public function init()
 {
     $passwordConfirm = new Rdine_Validate_PasswordConfirmation();
     $userId = $this->createElement('hidden', 'userid');
     $userId->removeDecorator('Label')->removeDecorator('HtmlTag');
     $salutionList = array(array('key' => 'Mr', 'value' => 'Mr'), array('key' => 'Ms', 'value' => 'Ms'), array('key' => 'Mrs', 'value' => 'Mrs'));
     $statusList = array(array('key' => '1', 'value' => 'Active'), array('key' => '2', 'value' => 'InActive'));
     $gengerList = array(array('key' => 'Male', 'value' => 'Male'), array('key' => 'Female', 'value' => 'Female'));
     $salution = $this->createElement('select', 'salution');
     $salution->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2 required')->setAttrib('style', 'width:68px')->addMultiOptions($salutionList)->setRequired(false);
     $status = $this->createElement('select', 'status');
     $status->removeDecorator('Label')->setAttrib('class', 'sel2 required')->removeDecorator('HtmlTag')->addMultiOptions($statusList)->setRequired(false);
     $restNameCtl = new Zend_Form_Element_Multiselect('EditRestaurantName');
     $restNameCtl->removeDecorator('Label')->removeDecorator('HtmlTag')->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select RestaurantName.'))))->setAttrib('class', 'sel2')->setRegisterInArrayValidator(false)->setRequired(true);
     $restRoleCtl = $this->createElement('select', 'RestaurantRole');
     $restRoleCtl->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel1 drpDown required')->setRegisterInArrayValidator(false)->setRequired(true);
     $emailAddress = $this->createElement('text', 'emailAddress');
     $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1 required')->setAttrib('placeholder', 'Email')->setAttrib('readonly', 'readonly')->setAttrib('maxlength', '40')->setValue('')->setRequired(true);
     $password = $this->createElement('password', 'password');
     $password->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('placeholder', 'Password')->setAttrib('class', 'inp1 required')->setAttrib('maxlength', '20')->setAttrib('minlength', '6')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please enter your New Password.')), array('StringLength', false, array(6, 20, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'Your password is too short(>6).', Zend_Validate_StringLength::TOO_LONG => 'Your password is too long(<30).')))))->setRequired(false)->setValue('');
     $confirmPassword = $this->createElement('password', 'password_confirm');
     $confirmPassword->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1 required')->setAttrib('placeholder', 'Re-type Password')->setAttrib('maxlength', '20')->setAttrib('minlength', '6')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please Confirm your password.'))))->setRequired(false)->setValue('');
     $firstName = $this->createElement('text', 'firstName');
     $firstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('placeholder', 'First Name')->setAttrib('maxlength', '30')->setAttrib('class', 'inp1 required')->setAttrib('style', 'width:70%')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter FirstName.')), array('StringLength', false, array(0, 30))))->setValue('')->setRequired(true);
     $lastName = $this->createElement('text', 'lastName');
     $lastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Last Name')->addFilters(array('StringTrim'))->addValidators(array(array('StringLength', false, array(0, 30))))->setValue('')->setRequired(true);
     $gender = $this->createElement('select', 'gender');
     $gender->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2 required')->addMultiOptions($gengerList)->setRequired(false);
     $address = $this->createElement('textarea', 'address', array('rows' => '4', 'cols' => '40'));
     $address->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '200')->setAttrib('placeholder', 'Address')->setAttrib('style', 'width:97%')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your Address.')), array('StringLength', false, array(1, 200, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'address should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'address is too long(>200).')))))->setValue('')->setRequired(false);
     //         $countryCode = $this->createElement('text', 'countryCode');
     //         $countryCode->removeDecorator('Label')
     //         			   ->removeDecorator('HtmlTag')
     //        		       ->setAttrib('class','inp1 required')
     //        		       ->setAttrib('style','width:68px;')
     //        		       ->setAttrib('readonly','readonly')
     //        		       ->addFilters(array('StringTrim'))
     //        		       ->setAttrib('title','Country Code')
     //        		       ->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select country code.'))))
     //        		       ->setValue('')
     //                       ->setAttrib('maxlength', '5')
     //                       ->setRequired(false);
     //        $phone = $this->createElement('text', 'phone');
     //        $phone->removeDecorator('Label')
     //        	  ->removeDecorator('HtmlTag')
     //              ->setAttrib('class','inp1 required')
     //			  ->setAttrib('placeholder','Phone')
     //			  ->setAttrib('style','width:68%')
     //              ->setAttrib('maxlength', '15')
     //              ->addFilters(array('StringTrim'))
     //              ->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter Your Phone Number.')),
     //                   					))
     //             ->addValidator('regex', false, array('pattern' =>'/^[0-9 ]+$/','messages' => 'Enter a valid Phone Number'))
     //              ->setValue('')
     //              ->setRequired(false);
     $mobile = $this->createElement('text', 'mobile');
     $mobile->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Mobile')->setAttrib('maxlength', '10')->addFilters(array('StringTrim'))->addValidators(array(array('StringLength', false, array(0, 15, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'mobile should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'mobile is too long(>10).')))))->setValue('')->setRequired(false);
     $designation = $this->createElement('text', 'designation');
     $designation->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Designation')->setAttrib('maxlength', '50')->addFilters(array('StringTrim'))->setValue('')->setRequired(false);
     $register = $this->createElement('submit', 'register');
     $register->setLabel("Submit")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtn')->setIgnore(true);
     $userList = array(array('key' => 'RSU', 'value' => 'Restaurant User'), array('key' => 'SRU', 'value' => 'Super User'));
     $EditrestUsersType = $this->createElement('select', 'EditrestUsersType');
     $EditrestUsersType->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2')->addMultiOptions($userList)->setRegisterInArrayValidator(false)->setRequired(true);
     $this->addElements(array($userId, $salution, $status, $emailAddress, $password, $confirmPassword, $firstName, $lastName, $gender, $address, $restNameCtl, $mobile, $designation, $register, $restRoleCtl, $EditrestUsersType));
 }
 /**
  * Inicializace formulare
  *
  */
 public function init()
 {
     $this->setMethod(self::METHOD_POST);
     // ################## FIRST COLUMN ###################
     // datum pohovoru
     $elem = new Zend_Form_Element_Text('datum_pohovoru');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', array('form-control', 'date-picker'));
     $elem->setAttrib('placeholder', 'Pick a date…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'datum_pohovoru');
     // Multi select (perzonalista – pokročilé informace)
     $elem = new Zend_Form_Element_Multiselect('perzonalista_informace');
     $elem->removeDecorator('Label');
     $elem->setAttrib('placeholder', 'Pick an interviewers…');
     $elem->setAttrib('class', 'form-control');
     $this->addElement($elem, 'perzonalista_informace');
     // vzdělání
     $elem = new Zend_Form_Element_Text('vzdelani');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Education…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'vzdelani');
     // motivace
     $elem = new Zend_Form_Element_Textarea('motivace');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Motivation…');
     $elem->setAttrib('rows', '1');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'motivace');
     // preferovaná práce
     $elem = new Zend_Form_Element_Textarea('preferovana_prace');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Kind of work preferred…');
     $elem->setAttrib('rows', '1');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'preferovana_prace');
     // ambice
     $elem = new Zend_Form_Element_Textarea('ambice');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Ambitions…');
     $elem->setAttrib('rows', '1');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'ambice');
     // jazyky
     $elem = new Zend_Form_Element_Text('jazyky');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Languages…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'jazyky');
     // cestování
     $elem = new Zend_Form_Element_Text('cestovani');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Travelling…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'cestovani');
     // ################## SECOND COLUMN ###################
     // plusy_minusy
     $elem = new Zend_Form_Element_Textarea('plusy_minusy');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Pluses/Minuses…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'plusy_minusy');
     // zkusenosti_v_tymu
     $elem = new Zend_Form_Element_Textarea('zkusenosti_v_tymu');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Team work experience…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'zkusenosti_v_tymu');
     // pracovni_misto
     $elem = new Zend_Form_Element_Textarea('pracovni_misto');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Domain/Areas of work…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'pracovni_misto');
     // knowhow
     $elem = new Zend_Form_Element_Textarea('knowhow');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Skills and technologies…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'knowhow');
     // dalsi_informace
     $elem = new Zend_Form_Element_Textarea('dalsi_informace');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Other informations…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'dalsi_informace');
     // ################## THIRD COLUMN ###################
     // shrnuti_pohovoru
     $elem = new Zend_Form_Element_Textarea('shrnuti_pohovoru');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Summary of the interview…');
     $elem->setAttrib('rows', '3');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'shrnuti_pohovoru');
     // idealni_pozice
     $elem = new Zend_Form_Element_Text('idealni_pozice');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Ideal for position/project…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'idealni_pozice');
     // datum_zahajeni
     $elem = new Zend_Form_Element_Text('datum_zahajeni');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', array('form-control', 'date-picker'));
     $elem->setAttrib('placeholder', 'Posible starting date…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'datum_zahajeni');
     // uvazek
     $elem = new Zend_Form_Element_Select('id_uvazek');
     $elem->removeDecorator('Label');
     $elem->setAttrib('class', 'form-control');
     $this->addElement($elem, 'id_uvazek');
     // mzda
     $elem = new Zend_Form_Element_Text('mzda');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', 'form-control');
     $elem->setAttrib('placeholder', 'Salary…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'mzda');
     $elem = new Zend_Form_Element_Select('id_mena');
     $elem->removeDecorator('Label');
     $elem->setAttrib('class', 'form-control');
     $this->addElement($elem, 'id_mena');
     // datum_pristiho_kontaktu
     $elem = new Zend_Form_Element_Text('datum_pristiho_kontaktu');
     $elem->addFilter('StringTrim');
     $elem->setAttrib('class', array('form-control', 'date-picker'));
     $elem->setAttrib('placeholder', 'Pick a date…');
     $elem->removeDecorator('Label');
     $this->addElement($elem, 'datum_pristiho_kontaktu');
     // ###################### BUTTON ######################
     $save = new Zend_Form_Element_Submit('saveButton');
     $save->setLabel('Save');
     $save->setAttrib('class', 'btn btn-success');
     $save->setDecorators(array('ViewHelper'));
     $this->addElement($save, 'saveButton');
 }
Пример #4
0
 public function init()
 {
     $passwordConfirm = new Rdine_Validate_PasswordConfirmation();
     $salutionList = array(array('key' => 'Mr', 'value' => 'Mr'), array('key' => 'Ms', 'value' => 'Ms'), array('key' => 'Mrs', 'value' => 'Mrs'));
     $genderList = array(array('key' => 'Male', 'value' => 'Male'), array('key' => 'Female', 'value' => 'Female'));
     $userList = array(array('key' => 'RSU', 'value' => 'Restaurant User'), array('key' => 'SRU', 'value' => 'Super User'));
     $CountryCodeMapper = new Application_Model_CountryCodeDataMapper();
     $CountryCode = $CountryCodeMapper->fetchAll();
     $CodeList = array();
     $CodeList[] = array('key' => '', 'value' => 'Select flag');
     foreach ($CountryCode as $listcode) {
         $CodeList[] = array('key' => $listcode->getDescription(), 'value' => $listcode->getCode());
     }
     /*	$restName = new Application_Model_RestaurantMapper();
     		$restNamesResult = $restName->getRestaurantsNames();
     		$restNamesList = array();
     		foreach($restNamesResult as $rstNme){
     		$restNamesList[] = array('key'=>$rstNme->getId(),'value'=>$rstNme->getRestaurantname());
     		}
     */
     $restNameCtl = new Zend_Form_Element_Multiselect('RestaurantNameSel');
     $restNameCtl->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2')->setRegisterInArrayValidator(false)->setRequired(true);
     $restUsersType = $this->createElement('select', 'restUsersType');
     $restUsersType->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2')->addMultiOptions($userList)->setRegisterInArrayValidator(false)->setRequired(true);
     $restUserRoles = $this->createElement('select', 'restUserRoles');
     $restUserRoles->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2 required')->setRegisterInArrayValidator(false)->setRequired(true);
     $emailAddress = $this->createElement('text', 'emailAddress');
     $emailAddress->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1 required')->setAttrib('placeholder', 'Email')->setAttrib('maxlength', '40')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your EmailAddress.'))))->addValidator('EmailAddress', false, array('messages' => array(Zend_Validate_EmailAddress::INVALID => 'Please enter a valid Host Name')))->addErrorMessage('Pleaes Enter Valid Email Address')->setValue('')->addFilter('StringToLower')->setRequired(true);
     $password = $this->createElement('password', 'password');
     $password->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('placeholder', 'Password')->setAttrib('class', 'inp1 required')->setAttrib('maxlength', '20')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please enter your Password.'))))->setRequired(true)->setValue('');
     $confirmPassword = $this->createElement('password', 'password_confirm');
     $confirmPassword->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1 required')->setAttrib('placeholder', 'Re-type Password')->setAttrib('maxlength', '20')->addValidators(array($passwordConfirm, array('NotEmpty', true, array('messages' => 'Please Confirm your password.'))))->setRequired(true)->setValue('');
     $salution = $this->createElement('select', 'salution');
     $salution->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2 required')->setAttrib('style', 'width:68px;')->addMultiOptions($salutionList)->setRequired(false);
     $firstName = $this->createElement('text', 'firstName');
     $firstName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->setAttrib('class', 'inp1 required')->setAttrib('placeholder', 'First Name')->setAttrib('style', 'width:70%')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your First Name.')), array('StringLength', false, array(0, 30))))->setValue('')->setRequired(true);
     $lastName = $this->createElement('text', 'lastName');
     $lastName->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '30')->setAttrib('placeholder', 'Last Name')->setAttrib('class', 'inp1')->addFilters(array('StringTrim'))->addValidators(array(array('StringLength', false, array(0, 30))))->setValue('')->setRequired(true);
     $gender = $this->createElement('select', 'gender');
     $gender->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'sel2 required')->addMultiOptions($genderList)->setRequired(false);
     $address = $this->createElement('textarea', 'address', array('label' => 'Address', 'rows' => '4', 'cols' => '40'));
     $address->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('maxlength', '200')->setAttrib('style', 'width:97%')->setAttrib('placeholder', 'Address')->addFilters(array('StringTrim'))->addValidators(array(array('NotEmpty', true, array('messages' => 'Please enter your Address.'))))->addValidator('StringLength', false, array(1, 200, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'address should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'address is too long(>200).')))->setValue('')->setRequired(false);
     //		$rescountryCode = $this->createElement('select','rescountryCode');
     //		$rescountryCode->removeDecorator('Label')
     //        			    ->removeDecorator('HtmlTag')
     //        			    ->setAttrib('maxlength', '100')
     //        			    ->setAttrib('class','sel1 drpDown')
     //        			    ->setAttrib('style','width:92px;')
     //        			    ->addMultiOptions($CodeList)
     //        			    ->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select country code.'))))
     //                        ->setValue('')
     //        			    ->setRequired(false);
     //         $countryCode = $this->createElement('text', 'countryCode');
     //         $countryCode->removeDecorator('Label')
     //         			   ->removeDecorator('HtmlTag')
     //        		       ->setAttrib('class','inp1 required')
     //        		       ->setAttrib('style','width:68px;')
     //        		       ->setAttrib('readonly','readonly')
     //        		       ->addFilters(array('StringTrim'))
     //        		       ->setAttrib('title','Country Code')
     //        		       ->addValidators(array(array('NotEmpty', true, array('messages' => 'Please select country code.'))))
     //        		       ->setValue('')
     //                       ->setAttrib('maxlength', '5')
     //                       ->setRequired(false);
     //        $phone = $this->createElement('text', 'phone');
     //        $phone->removeDecorator('Label')
     //        	  ->removeDecorator('HtmlTag')
     //              ->setAttrib('class','inp1 required')
     //			  ->setAttrib('placeholder','Phone')
     //              ->setAttrib('maxlength', '15')
     //              ->setAttrib('style','width:68%')
     //              ->addFilters(array('StringTrim'))
     //              ->addValidators(array
     //                   					(array('NotEmpty', true, array('messages' => 'Please enter Your Phone Number.'))
     //                   				 ))
     //              ->addValidator('regex', false, array('pattern' =>'/^[0-9 ]+$/','messages' => 'Enter a valid Phone Number'))
     //              ->setValue('')
     //              ->setRequired(false);
     $mobile = $this->createElement('text', 'mobile');
     $mobile->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('placeholder', 'Mobile')->setAttrib('maxlength', '10')->addFilters(array('StringTrim'))->addValidators(array(array('StringLength', false, array(0, 15, 'messages' => array(Zend_Validate_StringLength::TOO_SHORT => 'mobile should be minimum 10 charactors', Zend_Validate_StringLength::TOO_LONG => 'mobile is too long(>10).')))))->setValue('')->setRequired(false);
     $designation = $this->createElement('text', 'designation');
     $designation->removeDecorator('Label')->removeDecorator('HtmlTag')->setAttrib('class', 'inp1')->setAttrib('maxlength', '50')->addFilters(array('StringTrim'))->setValue('')->setRequired(false);
     $register = $this->createElement('submit', 'register');
     $register->setLabel("Register")->removeDecorator('DtDdWrapper')->setAttrib('class', 'submitBtn')->setIgnore(true);
     $reset = $this->createElement('reset', 'reset');
     $reset->removeDecorator('Label')->removeDecorator('DtDdWrapper')->setLabel("Reset")->setAttrib('class', 'submitBtn')->setIgnore(true);
     $this->addElements(array($emailAddress, $password, $confirmPassword, $salution, $firstName, $lastName, $gender, $address, $restNameCtl, $mobile, $designation, $register, $reset, $restUserRoles, $restUsersType));
 }
Пример #5
0
 /**
  * Inicializace formulare
  *
  */
 public function init()
 {
     $this->setMethod(self::METHOD_POST);
     // ################## FIRST COLUMN ###################
     // Photo (id_foto)
     // File picker
     $profilePhotoPicker = new Zend_Form_Element_File('profilePhoto');
     $profilePhotoPicker->setDestination(PUBLIC_PATH . '/temp');
     $profilePhotoPicker->addValidator('Count', false, 1);
     $profilePhotoPicker->addValidator('Size', false, 2097152);
     $profilePhotoPicker->removeDecorator('Label');
     $this->addElement($profilePhotoPicker, 'profilePhoto');
     $avatar = new Zend_Form_Element_Image('avatar');
     $avatar->setAttrib('class', array("profile-user-img", "img-responsive", "img-circle"));
     $this->addElement($avatar, 'avatar');
     // First name (jmeno)
     $firstName = $this->createElement('text', 'jmeno');
     $firstName->addFilter('StringTrim');
     $firstName->setRequired(true);
     $firstName->setAttrib('class', 'form-control');
     $firstName->setAttrib('placeholder', 'First name');
     $firstName->removeDecorator('Label');
     $this->addElement($firstName);
     // Last name (prijmeni)
     $lastName = $this->createElement('text', 'prijmeni');
     $lastName->addFilter('StringTrim');
     $lastName->setRequired(true);
     $lastName->setAttrib('class', 'form-control');
     $lastName->setAttrib('placeholder', 'Surname');
     $lastName->removeDecorator('Label');
     $this->addElement($lastName);
     // Date of birth (datum_narozeni)
     // Date picker
     $birthdate = $this->createElement('text', 'datum_narozeni');
     $birthdate->setRequired(true);
     $birthdate->setAttrib('class', array('form-control', 'date-picker'));
     $birthdate->removeDecorator('Label');
     $birthdate->setAttrib('placeholder', 'Birthdate');
     $this->addElement($birthdate);
     // ################## SECOND COLUMN ##################
     // Status (id_status)
     // Select box
     $status = new Zend_Form_Element_Select('id_status');
     $status->removeDecorator('Label');
     $status->setAttrib('class', 'form-control');
     $this->addElement($status, 'id_status');
     // Position (id_pozice)
     // Select box
     $position = new Zend_Form_Element_Select('id_pozice');
     $position->removeDecorator('Label');
     $position->setAttrib('class', 'form-control');
     $this->addElement($position, 'id_pozice');
     // Technology (kandidat_technologie)
     // Multi select
     $technology = new Zend_Form_Element_Multiselect('kandidat_technologie');
     $technology->removeDecorator('Label');
     $technology->setAttrib('class', 'form-control');
     $this->addElement($technology, 'kandidat_technologie');
     // Seniority (id_seniorita)
     // Select box
     $seniority = new Zend_Form_Element_Select('id_seniorita');
     $seniority->removeDecorator('Label');
     $seniority->setAttrib('class', 'form-control');
     $this->addElement($seniority, 'id_seniorita');
     // Comment (komentar)
     $comment = $this->createElement('textarea', 'komentar');
     $comment->addFilter('StringTrim');
     $comment->setAttrib('class', 'form-control');
     $comment->setAttrib('rows', '3');
     $comment->setAttrib('placeholder', 'Enter your comment…');
     $comment->removeDecorator('Label');
     $this->addElement($comment);
     // ################### ATTACHEMENTS ###################
     // Attchements (kandidat_priloha)
     // File picker
     $attachments = new Zend_Form_Element_File('attachments');
     $attachments->setDestination(PUBLIC_PATH . '/temp');
     $attachments->addValidator('Count', false, array('min' => 0, 'max' => 4));
     $attachments->addValidator('Size', false, 2097152);
     $attachments->setMultiFile(4);
     $attachments->removeDecorator('Label');
     $this->addElement($attachments, 'attachments');
     $attachmentsCheckGroup = new Zend_Form_Element_MultiCheckbox('attachmentsCheckGroup');
     $comment->removeDecorator('Label');
     $this->addElement($attachmentsCheckGroup, 'attachmentsCheckGroup');
     // ###################### BUTTON ######################
     $close = new Zend_Form_Element_Submit('closeButton');
     $close->setLabel('Back');
     $close->setAttrib('class', 'btn btn-default');
     $close->setDecorators(array('ViewHelper'));
     $this->addElement($close, 'closeButton');
     $save = new Zend_Form_Element_Submit('saveButton');
     $save->setLabel('Save');
     $save->setAttrib('class', 'btn btn-success');
     $save->setDecorators(array('ViewHelper'));
     $this->addElement($save, 'saveButton');
     $delete = new Zend_Form_Element_Submit('deleteButton');
     $delete->setLabel('Delete');
     $delete->setAttrib('class', 'btn btn-danger');
     $delete->setAttrib('onclick', 'if (confirm("Are you sure?")) { document.form.submit(); } return false;');
     $delete->setDecorators(array('ViewHelper'));
     $this->addElement($delete, 'deleteButton');
 }