Exemplo n.º 1
0
 public function edituserlevelAction()
 {
     $id = $this->_getParam('id');
     $page = $this->_getParam('page');
     $model = new Application_Model_UserLevel();
     $row = $model->find($id);
     $options['identifire'] = $row->getIdentifire();
     $options['label'] = $row->getLabel();
     $request = $this->getRequest();
     $form = new Admin_Form_UserLevel();
     $form->populate($options);
     if ($this->getRequest()->isPost()) {
         $options = $request->getPost();
         if ($form->isValid($options)) {
             $row->setIdentifire($options['identifire']);
             $row->setLabel($options['label']);
             $row->save();
             return $this->_helper->redirector('view', 'userlevel', "admin", array('msg' => base64_encode("User level [Id:{$id}] is updated successfully!")));
         } else {
             $form->reset();
             $form->populate($options);
         }
     }
     $this->view->msg = base64_decode($this->getRequest()->getParam("msg"));
     // Assign the form to the view
     $this->view->form = $form;
 }
Exemplo n.º 2
0
 public function checkUserActiveStatus($options, $identityColumn)
 {
     $usersNs = new Zend_Session_Namespace("members");
     $user = new Application_Model_User();
     $RES = $user->fetchRow("{$identityColumn}='{$options['email']}' and status ='active'");
     if ($RES != false) {
         $usersNs->userObj = serialize($RES);
         $usersNs->userId = $RES->getId();
         $usersNs->userEmail = $RES->getEmail();
         $usersNs->userFullName = $RES->getFirstName() . " " . $RES->getLastName();
         $usersNs->userFirstName = $RES->getFirstName();
         $usersNs->userUsername = $RES->getUsername();
         //$usersNs->setExpirationSeconds(15);
         //setcookie("userName", $RES->getUsername(), time()+3600);  /* expire in 1 hour */
         /*--------- START CHECK USER PERSONAL IMAGE DIRECTORY -----------*/
         //$this->createUserDrectory($usersNs->userUsername);
         /*--------- END CHECK USER PERSONAL IMAGE DIRECTORY ------------*/
         $user_level = new Application_Model_UserLevel();
         $user_level_res = $user_level->find($RES->getUserLevelId());
         if ($user_level_res->getStatus() != "active") {
             Zend_Session::namespaceUnset("members");
             $auth = $this->getInstance();
             $auth->clearIdentity();
             return false;
         }
         $usersNs->userType = $user_level_res->getIdentifire();
         $usersNs->userTypeLabel = $user_level_res->getLabel();
         return true;
     } else {
         $this->doLogout();
         return false;
     }
 }
Exemplo n.º 3
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));
 }
Exemplo n.º 4
0
 public function getUserLevel()
 {
     $obj = new Application_Model_UserLevel();
     $entries = $obj->fetchAll("status='active'");
     $arrUserLevel = array();
     foreach ($entries as $entry) {
         $arrUserLevel[$entry->getId()] = $entry->getLabel();
     }
     return $arrUserLevel;
 }
Exemplo n.º 5
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));
 }