Ejemplo n.º 1
0
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('frmRegistration');
     //        $this->addElementPrefixPath('Base_Decorator',
     //                            'Base/Decorator/',
     //                            'decorator');
     $this->addElement('text', 'employeeCode', array('label' => 'Employee Code:', 'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter employee code'))), array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'employee_code', 'messages' => 'This employee code is already taken!'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'username', array('label' => 'Username:'******'autocomplete' => "off", 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter username'))), array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'username', 'messages' => 'username already exists'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('password', 'password', array('label' => 'Password:'******'autocomplete' => "off", 'required' => true, 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter password'))), array('validator' => 'StringLength', 'options' => array(6, 20)))))->getElement('password')->addValidator('IdenticalField', false, array('confirmPassword', 'Confirm Password'));
     // Add an password element
     $this->addElement('password', 'confirmPassword', array('label' => 'Confirm Password:'******'required' => true, 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20)))));
     // Add an password element
     // Add an first name element
     $this->addElement('text', 'firstName', array('label' => 'First Name:', 'class' => 'text-input medium-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'middleName', array('label' => 'Middle Name:', 'class' => 'text-input medium-input', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an last name element
     $this->addElement('text', 'lastName', array('label' => 'Last Name:', 'class' => 'text-input medium-input', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim')));
     $this->addElement('text', 'email', array('label' => 'Email Address:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter email')))), 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'dob', array('label' => 'Date of Birth:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please enter dob')))), 'class' => 'text-input medium-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('text', 'doj', array('label' => 'Date of Joining:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter date of joining')))), 'class' => 'text-input medium-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $model = new Application_Model_Designation();
     $arrDesignation = $model->getDesignation();
     $this->addElement('select', 'designationId', array('label' => 'Designation:', 'id' => 'designationId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select employee designation.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrDesignation));
     $model = new Application_Model_Department();
     $arrDepartment = $model->getDepartment();
     $this->addElement('select', 'departmentId', array('label' => 'Department:', 'id' => 'departmentId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select department.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrDepartment));
     $model = new Application_Model_UserLevel();
     $arrUserLevel = $model->getUserLevel();
     $this->addElement('select', 'userLevelId', array('label' => 'User Level:', 'id' => 'userLevelId', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user level.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrUserLevel));
     $this->addElement('text', 'fatherName', array('label' => "Father's Name:", 'class' => 'text-input medium-input', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('select', 'sex', array('label' => 'Gender:', 'class' => 'text-input small-input', 'required' => true, 'decorators' => $this->elementDecorators, 'MultiOptions' => array('male' => "Male", 'female' => "Female"), 'value' => "male"));
     $this->addElement('text', 'pan', array('label' => 'Permanent Account No. (PAN):', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'mobile', array('label' => 'Mobile Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'extensionNo', array('label' => 'Extension Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'skype', array('label' => 'Skype Id:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'contactNo', array('label' => 'Contact Number:', 'class' => 'text-input medium-input', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'marriageAnniversary', array('label' => 'Marriage Anniversary:', 'required' => false, 'class' => 'text-input medium-input', 'readonly' => 'true', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('textarea', 'correspondenceAddress', array('label' => 'Correspondence Address:', 'class' => 'text-input textarea address', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('file', 'profilePicture', array('class' => 'text-input medium-input', 'label' => 'Profile Picture:', 'required' => false, 'decorators' => $this->fileDecorators));
     $this->getElement('profilePicture')->addValidator('Size', false, 1024 * 1024 * 5);
     //2 MB file is allowed
     $this->getElement('profilePicture')->getValidator('Size')->setMessages(array("fileSizeTooBig" => "Maximum allowed file size is 5 MB.", "fileSizeTooSmall" => ""));
     $this->getElement('profilePicture')->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $this->getElement('profilePicture')->getValidator('Extension')->setMessages(array("fileExtensionFalse" => "Please upload jpg,jpeg,png,gif file.", "fileExtensionNotFound" => ""));
     $this->addElement('select', 'status', array('label' => 'Status:', 'id' => 'status', 'style' => 'width:193px', 'class' => 'text-input small-input', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select status.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => array("active" => "Active", "inactive" => "Inactive")));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'button', 'ignore' => true, 'label' => 'Submit', 'value' => 'submit', 'decorators' => $this->buttonDecorators));
 }
Ejemplo n.º 2
0
 public function init()
 {
     $this->addElementPrefixPath('Base_Validate', 'Base/Validate/', 'validate');
     $this->setName('frmRegistration');
     /*
     $FName		=	new Zend_Form_Element_Text('firstName');
             $FName		->	setLabel('First Name')
             			
                     	->	setRequired(true)
                     	->	addFilter('StripTags')
                     	->	addFilter('StringTrim')
                     	->	addValidator('NotEmpty')
                     	-> clearDecorators()
                     	->	addDecorators($this->elementDecorators);
     
             $LName		=	new Zend_Form_Element_Text('lastName');
             $LName 		-> setLabel('Last Name')
             			
                    		->	setRequired(true)
                    		->	addFilter('StripTags')
                    		->	addFilter('StringTrim')
                    		->	addValidator('NotEmpty')
                    		-> clearDecorators()
                    		->	addDecorators($this->elementDecorators);
                    		
     $Country	=	new Zend_Form_Element_Text('countryId');
             $Country	->	setLabel('CountryName')
             			
                   		->	setRequired(true)
                   		->	addFilter('StripTags')
                   		->	addFilter('StringTrim')
                   		->	addValidator('NotEmpty')
                   		-> clearDecorators()
                   		->	addDecorators($this->elementDecorators);              
                           
             $City		=	new Zend_Form_Element_Text('cityName');
             $City		->	setLabel('City')
             			
                   		->	setRequired(true)
                   		->	addFilter('StripTags')
                   		->	addFilter('StringTrim')
                   		->	addValidator('NotEmpty')
                   		-> clearDecorators()
                   		->	addDecorators($this->elementDecorators);
                   		
             
     $model=new Application_Model_UserLevel();
             $arrUserLevel=$model->getUserLevel();
     
         	$userlevel=new	Zend_Form_Element_Select('userLevelId');
         	$userlevel	->setAttrib('id','userLevelId')
         				->setAttrib('style', 'width:100%')
         				->setLabel('User Level')
         				->setRequired(true)
         				->addMultiOptions($arrUserLevel)	
     			->clearDecorators()
                   		->addDecorators($this->elementDecorators)
                   		
                   		;
                   		
             $submit		=	new Zend_Form_Element_Submit('submitbutton');
             $submit		->	setAttrib('id', 'submitbutton')        
             			
             			->	setLabel('Submit')
             			-> clearDecorators()
             			->	addDecorators($this->buttonDecorators)
             			;
            
     
             
     
             $this->addElements(array($FName, $LName, $Country, $City,  $userlevel,$submit));
     */
     $this->addElement('text', 'username', array('label' => 'Username:'******'autocomplete' => "off", 'class' => 'form', 'TABINDEX' => '2', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter username'))), array('Db_NoRecordExists', true, array('table' => 'user', 'field' => 'username', 'messages' => 'username already exists'))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $this->addElement('password', 'password', array('label' => 'Password:'******'autocomplete' => "off", 'required' => true, 'TABINDEX' => '3', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter password'))), array('validator' => 'StringLength', 'options' => array(6, 20)))))->getElement('password')->addValidator('IdenticalField', false, array('confirmPassword', 'Confirm Password'));
     // Add an password element
     $this->addElement('password', 'confirmPassword', array('label' => 'Confirm Password:'******'required' => true, 'TABINDEX' => '3', 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'validators' => array(array('validator' => 'StringLength', 'options' => array(6, 20)))));
     // Add an password element
     // Add an first name element
     $this->addElement('text', 'firstName', array('label' => 'First Name:', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter first name')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     // Add an last name element
     $this->addElement('text', 'lastName', array('label' => 'Surame:', 'class' => 'form', 'required' => true, 'decorators' => $this->elementDecorators, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter surname')))), 'filters' => array('StringTrim')));
     $this->addElement('text', 'email', array('label' => 'Email Address:', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must enter email')))), 'class' => 'form', 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $language = new Application_Model_Language();
     $arrLang = $language->getLanguage("--select--");
     $this->addElement('select', 'preferredLanguage', array('label' => 'Preferred Language:', 'class' => 'form', 'style' => 'width:193px', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select language')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrLang));
     $this->addElement('text', 'otherLanguages', array('label' => 'Other Languages:', 'class' => 'form', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim')));
     $country = new Application_Model_Country();
     //$arrCountry=$country->getCountry("--select---");
     $nationalitiesArr = $country->getNationalities("---Select Nationality---");
     $this->addElement('select', 'countryPassport', array('label' => 'Nationality:', 'class' => 'form', 'style' => 'width:193px', 'required' => false, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select nationality.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $nationalitiesArr));
     $this->addElement('hidden', 'cityId', array('label' => '', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('text', 'cityName', array('label' => 'Home Town/City:', 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $day[''] = "Day";
     for ($i = 1; $i < 32; $i++) {
         $day[$i] = $i;
     }
     $this->addElement('select', 'day', array('label' => 'Date of Birth:', 'class' => "select-box", 'style' => 'width:193px', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $day));
     $month[""] = "Month";
     for ($i = 1; $i < 13; $i++) {
         $month[$i] = $i;
     }
     $this->addElement('select', 'month', array('class' => "select-box", 'style' => 'width:193px', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $month));
     $year[''] = "Year";
     for ($i = date("Y"); $i > 1900; $i--) {
         $year[$i] = $i;
     }
     $this->addElement('select', 'year', array('class' => "select-box", 'style' => 'width:193px', 'required' => false, 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $year));
     $this->addElement('radio', 'sex', array('label' => 'Gender: ', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'You must select the gender.')))), 'multiOptions' => array('male' => "Male", 'female' => "Female"), 'value' => "male", 'separator' => "", 'decorators' => $this->elementDecorators));
     $this->addElement('radio', 'firstTimeTraveller', array('label' => 'First time traveller? ', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select option.')))), 'multiOptions' => array('yes' => "Yes", 'no' => "No"), 'value' => "no", 'separator' => "", 'decorators' => $this->elementDecorators));
     /*
             $this->addElement('text', 'mobileCountryCode', array(
                 'label'      => 'Mobil No. Country Code:',
             	'validators'=>array('Digits'),
             	'class' =>'form',
             	'decorators' => $this->elementDecorators,	
                 'required'   => false,
                 'filters'    => array('StringTrim'),
             ));*/
     $this->addElement('text', 'mobile', array('label' => 'Mobile Number:', 'validators' => array('Digits'), 'class' => 'form', 'decorators' => $this->elementDecorators, 'required' => false, 'filters' => array('StringTrim')));
     $this->addElement('file', 'image', array('class' => "input-browse", 'label' => 'Profile Photo:', 'required' => false, 'decorators' => $this->fileDecorators));
     $this->getElement('image')->addValidator('Size', false, 1024 * 1024 * 5);
     //2 MB file is allowed
     $this->getElement('image')->getValidator('Size')->setMessages(array("fileSizeTooBig" => "Maximum allowed file size is 5 MB.", "fileSizeTooSmall" => ""));
     $this->getElement('image')->addValidator('Extension', false, 'jpg,jpeg,png,gif');
     $this->getElement('image')->getValidator('Extension')->setMessages(array("fileExtensionFalse" => "Please upload jpg,jpeg,png,gif file.", "fileExtensionNotFound" => ""));
     /*$this->addElement('textarea', 'dreamDestination', array(
                 'label'      => 'What is your dream destination?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             	
             $this->addElement('textarea', 'wayToTravel', array(
                 'label'      => 'Favourite way to travel?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             $this->addElement('textarea', 'travelGear', array(
                 'label'      => 'Best bit of travel gear?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             $this->addElement('textarea', 'yearGoal', array(
                 'label'      => 'Gap Year goal?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
             	
             $this->addElement('textarea', 'leaveHomeWithout', array(
                 'label'      => 'Never leave home without …?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));
     
            $this->addElement('textarea', 'interests', array(
                 'label'      => 'Interests?',
                 'required'   => false,
              	'rows'=>'5',
              	'cols'=>'50',
             	'decorators' => $this->elementDecorators,
             	));*/
     $this->addElement('textarea', 'evenTakenGapYear', array('label' => 'Ever taken a gap year?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'nextTravelToDoList', array('label' => 'Next on your travel To Do list?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $this->addElement('textarea', 'favouriteTravelExperience', array('label' => 'Your favourite travel experience so far?', 'required' => false, 'rows' => '5', 'cols' => '50', 'decorators' => $this->elementDecorators));
     $model = new Application_Model_UserLevel();
     $arrUserLevel = $model->getUserLevel();
     $this->addElement('select', 'userLevelId', array('label' => 'User Level:', 'id' => 'userLevelId', 'style' => 'width:193px', 'class' => 'form', 'required' => true, 'validators' => array(array('NotEmpty', true, array('messages' => array('isEmpty' => 'Please select user level.')))), 'decorators' => $this->elementDecorators, 'filters' => array('StringTrim'), 'MultiOptions' => $arrUserLevel));
     $this->addElement('submit', 'submit', array('required' => false, 'class' => 'signup', 'ignore' => true, 'label' => 'Submit', 'decorators' => $this->buttonDecorators));
 }