public function init() { $this->setMethod('post'); $this->setAttrib('action', BASE_URL . 'geographygroup/edit'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'geographygroup'); $id = new Zend_Form_Element_Hidden('id'); $geographygroupname = new Zend_Form_Element_Text('geographygroupname'); $geographygroupname->setAttrib('maxLength', 50); $geographygroupname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid geography group.'))))); $geographygroupname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_geographygroup', 'field' => 'geographygroupname', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $geographygroupname->getValidator('Db_NoRecordExists')->setMessage('Geography group name already exists.'); $geographyregion = new Zend_Form_Element_Text('geographyregion'); $geographyregion->setAttrib('maxLength', 20); $geographyregion->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid geography region.'))); $geographycityname = new Zend_Form_Element_Text('geographycityname'); $geographycityname->setAttrib('maxLength', 20); $geographycityname->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[a-zA-Z\\s]+$/i', 'messages' => array('regexNotMatch' => 'Please enter valid geography city.'))))); $defaultGeographyGroup = new Zend_Form_Element_Text('defaultGeographyGroup'); $defaultGeographyGroup->setAttrib('maxLength', 20); $defaultGeographyGroup->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid default geography group.'))); $geographycode = new Zend_Form_Element_Text('geographycode'); $geographycode->setAttrib('maxLength', 20); $geographycode->setRequired(true); $geographycode->addValidator('NotEmpty', false, array('messages' => 'Please enter geography code.')); $geographycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid geography code.'))); $geographycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_geographygroup', 'field' => 'geographycode', 'exclude' => 'id!="' . Zend_Controller_Front::getInstance()->getRequest()->getParam('id') . '" and isactive=1'))); $geographycode->getValidator('Db_NoRecordExists')->setMessage('Geography code already exists.'); $currency = new Zend_Form_Element_Select('currency'); $currency->setAttrib('class', 'selectoption'); $currency->setRegisterInArrayValidator(false); $currency->addMultiOption('', 'Select Currency'); $currencymodel = new Default_Model_Currency(); $currencymodeldata = $currencymodel->getCurrencyList(); foreach ($currencymodeldata as $currencyres) { $currency->addMultiOption($currencyres['id'], utf8_encode($currencyres['currency'])); } $currency->setRequired(true); $currency->addValidator('NotEmpty', false, array('messages' => 'Please select currency.')); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($id, $geographygroupname, $geographyregion, $geographycityname, $defaultGeographyGroup, $geographycode, $currency, $submit)); $this->setElementDecorators(array('ViewHelper')); }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $msgarray = array(); $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $systempreferenceform = new Default_Form_systempreference(); $dateformatidmodel = new Default_Model_Dateformat(); $timeformatidmodel = new Default_Model_Timeformat(); $currencyidmodel = new Default_Model_Currency(); $systempreferencemodel = new Default_Model_Sitepreference(); $date_formats_arr = array(); $time_formats_arr = array(); $passworddataArr = array(); $timezonemodel = new Default_Model_Timezone(); $allTimezoneData = $timezonemodel->fetchAll('isactive=1', 'timezone')->toArray(); if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } if (sapp_Global::_checkprivileges(TIMEZONE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'timezone'); } if ($id && $id > 0 && is_numeric($id)) { try { $data = $systempreferencemodel->getsingleSystemPreferanceData($id); $date_formats_arr = $dateformatidmodel->getAllDateFormats(); $time_formats_arr = $timeformatidmodel->fetchAll()->toArray(); $currencyidmodeldata = $currencyidmodel->getCurrencyList(); $systempreferenceform->currencyid->addMultiOption('', 'Select Currency'); if (sizeof($currencyidmodeldata) > 0) { foreach ($currencyidmodeldata as $currencyidres) { $systempreferenceform->currencyid->addMultiOption($currencyidres['id'], utf8_encode($currencyidres['currencytext'])); } } $systempreferenceform->passwordid->addMultiOption('', 'Select Password Preference'); $passworddataArr = $systempreferencemodel->getPasswordData(); foreach ($passworddataArr as $passwordres) { $systempreferenceform->passwordid->addMultiOption($passwordres['id'], utf8_encode($passwordres['passwordtype'])); } if (sizeof($allTimezoneData) > 0) { foreach ($allTimezoneData as $timezoneidres) { $systempreferenceform->timezoneid->addMultiOption($timezoneidres['id'], utf8_encode($timezoneidres['timezone'] . ' [' . $timezoneidres['timezone_abbr'] . ']')); } } else { $msgarray['timezoneid'] = 'Time Zone is not configured yet.'; } $systempreferenceform->populate($data); $systempreferenceform->setDefault('dateformatid', $data['dateformatid']); $systempreferenceform->setDefault('timeformatid', $data['timeformatid']); $systempreferenceform->setDefault('currencyid', $data['currencyid']); $systempreferenceform->setDefault('passwordid', $data['passwordid']); $systempreferenceform->setAttrib('action', DOMAIN . 'sitepreference/edit/id/' . $id); $this->view->msgarray = $msgarray; } catch (Exception $e) { $this->view->nodata = "nodata"; } } else { $this->view->nodata = "nodata"; } $this->view->form = $systempreferenceform; $this->view->date_formats_arr = $date_formats_arr; $this->view->time_formats_arr = $time_formats_arr; $this->view->passworddata = $passworddataArr; if ($this->getRequest()->getPost()) { $result = $this->save($systempreferenceform); $this->view->msgarray = $result; } $this->view->popConfigPermission = $popConfigPermission; }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); $emptyFlag = 0; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } if (sapp_Global::_checkprivileges(ACCOUNTCLASSTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'accountclasstype'); } if (sapp_Global::_checkprivileges(BANKACCOUNTTYPE, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'bankaccounttype'); } $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('userid'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $empsalarydetailsform = new Default_Form_empsalarydetails(); try { if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empsalarydetailsModal = new Default_Model_Empsalarydetails(); $usersModel = new Default_Model_Users(); $currencymodel = new Default_Model_Currency(); $accountclasstypemodel = new Default_Model_Accountclasstype(); $bankaccounttypemodel = new Default_Model_Bankaccounttype(); $msgarray = array(); $basecurrencymodeldata = $currencymodel->getCurrencyList(); $empsalarydetailsform->currencyid->addMultiOption('', 'Select Salary Currency'); if (sizeof($basecurrencymodeldata) > 0) { foreach ($basecurrencymodeldata as $basecurrencyres) { $empsalarydetailsform->currencyid->addMultiOption($basecurrencyres['id'], utf8_encode($basecurrencyres['currency'])); } } else { $msgarray['currencyid'] = 'Currencies are not configured yet.'; $emptyFlag++; } $bankaccounttypeArr = $bankaccounttypemodel->getBankAccountList(); $empsalarydetailsform->bankaccountid->addMultiOption('', 'Select Bank Account Type'); if (!empty($bankaccounttypeArr)) { foreach ($bankaccounttypeArr as $bankaccounttyperes) { $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttyperes['id'], $bankaccounttyperes['bankaccounttype']); } } else { $msgarray['bankaccountid'] = 'Bank account types are not configured yet.'; $emptyFlag++; } $accountclasstypeArr = $accountclasstypemodel->getAccountClassTypeList(); $empsalarydetailsform->accountclasstypeid->addMultiOption('', 'Select Account Type'); if (!empty($accountclasstypeArr)) { foreach ($accountclasstypeArr as $accountclasstyperes) { $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstyperes['id'], $accountclasstyperes['accountclasstype']); } } else { $msgarray['accountclasstypeid'] = 'Account class types are not configured yet.'; $emptyFlag++; } $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id); if (!empty($data)) { $empsalarydetailsform->populate($data[0]); if ($data[0]['accountholding'] != '') { $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view'); $empsalarydetailsform->accountholding->setValue($accountholding); } if ($data[0]['accountclasstypeid'] != '') { $empsalarydetailsform->setDefault('accountclasstypeid', $data[0]['accountclasstypeid']); } $empsalarydetailsform->setDefault('currencyid', $data[0]['currencyid']); $empsalarydetailsform->setDefault('bankaccountid', $data[0]['bankaccountid']); } $empsalarydetailsform->user_id->setValue($id); $empsalarydetailsform->setAttrib('action', DOMAIN . 'empsalarydetails/edit/userid/' . $id); $this->view->form = $empsalarydetailsform; $this->view->data = isset($data[0]) ? $data[0] : array(); $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empsalarydetailsform, $id); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function editAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $popConfigPermission = array(); $basecurrexists = ''; $targetcurrexists = ''; if (sapp_Global::_checkprivileges(CURRENCY, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'currency'); } $this->view->popConfigPermission = $popConfigPermission; $id = $this->getRequest()->getParam('id'); $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $currencyconverterform = new Default_Form_currencyconverter(); $currencyconvertermodel = new Default_Model_Currencyconverter(); $currencymodel = new Default_Model_Currency(); $currencyconverterform->submit->setLabel('Update'); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $currencyconvertermodel->getCurrencyConverterDatabyID($id); $currencyconverterform->basecurrency->addMultiOption('', 'Select Base Currency'); if (!empty($data)) { $data = $data[0]; if ($data['basecurrency'] && $data['targetcurrency']) { $basecurrencydata = $currencymodel->getCurrencyList(); $targetcurrencydata = $currencymodel->getCurrencyList(); foreach ($basecurrencydata as $res) { $currencyconverterform->basecurrency->addMultiOption($res['id'], utf8_encode($res['currency'])); if ($res['id'] == $data['basecurrency']) { $basecurrexists = 'true'; } } foreach ($targetcurrencydata as $res) { if ($data['basecurrency'] != $res['id']) { $currencyconverterform->targetcurrency->addMultiOption($res['id'], utf8_encode($res['currency'])); if ($res['id'] == $data['targetcurrency']) { $targetcurrexists = 'true'; } } } } $currencyconverterform->populate($data); $startdate = sapp_Global::change_date($data["start_date"], 'view'); $enddate = sapp_Global::change_date($data["end_date"], 'view'); $currencyconverterform->start_date->setValue($startdate); $currencyconverterform->end_date->setValue($enddate); $currencyconverterform->setDefault('basecurrency', $data['basecurrency']); $currencyconverterform->setDefault('targetcurrency', $data['targetcurrency']); $currencyconverterform->setAttrib('action', BASE_URL . 'currencyconverter/edit/id/' . $id); $this->view->data = $data; $this->view->basecurrexists = $basecurrexists; $this->view->targetcurrexists = $targetcurrexists; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $currencyconverterform; if ($this->getRequest()->getPost()) { $result = $this->save($currencyconverterform); $this->view->msgarray = $result; } }
public function salarydetailsAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emp_salary', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); $emptyFlag = 0; $tabName = 'salarydetails'; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $loginUserId; $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $empsalarydetailsform = new Default_Form_empsalarydetails(); try { if ($id) { $employeeModal = new Default_Model_Employee(); $empdata = $employeeModal->getsingleEmployeeData($id); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $empsalarydetailsModal = new Default_Model_Empsalarydetails(); $usersModel = new Default_Model_Users(); $currencymodel = new Default_Model_Currency(); $accountclasstypemodel = new Default_Model_Accountclasstype(); $bankaccounttypemodel = new Default_Model_Bankaccounttype(); $payfrequencyModal = new Default_Model_Payfrequency(); $msgarray = array(); $basecurrencymodeldata = $currencymodel->getCurrencyList(); if (sizeof($basecurrencymodeldata) > 0) { $empsalarydetailsform->currencyid->addMultiOption('', 'Select Salary Currency'); foreach ($basecurrencymodeldata as $basecurrencyres) { $empsalarydetailsform->currencyid->addMultiOption($basecurrencyres['id'], utf8_encode($basecurrencyres['currency'])); } } else { $msgarray['currencyid'] = 'Salary currencies are not configured yet.'; $emptyFlag++; } $payfreqData = $payfrequencyModal->getActivePayFreqData(); $empsalarydetailsform->salarytype->addMultiOption('', 'Select Pay Frequency'); if (sizeof($payfreqData) > 0) { foreach ($payfreqData as $payfreqres) { $empsalarydetailsform->salarytype->addMultiOption($payfreqres['id'], $payfreqres['freqtype']); } } else { $msgarray['salarytype'] = 'Pay frequency is not configured yet.'; $emptyFlag++; } $bankaccounttypeArr = $bankaccounttypemodel->getBankAccountList(); if (!empty($bankaccounttypeArr)) { $empsalarydetailsform->bankaccountid->addMultiOption('', 'Select Bank Account Type'); foreach ($bankaccounttypeArr as $bankaccounttyperes) { $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttyperes['id'], $bankaccounttyperes['bankaccounttype']); } } else { $msgarray['bankaccountid'] = 'Bank account types are not configured yet.'; $emptyFlag++; } $accountclasstypeArr = $accountclasstypemodel->getAccountClassTypeList(); if (!empty($accountclasstypeArr)) { $empsalarydetailsform->accountclasstypeid->addMultiOption('', 'Select Account Type'); foreach ($accountclasstypeArr as $accountclasstyperes) { $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstyperes['id'], $accountclasstyperes['accountclasstype']); } } else { $msgarray['accountclasstypeid'] = 'Account class types are not configured yet.'; $emptyFlag++; } $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id); if (!empty($data)) { $empsalarydetailsform->populate($data[0]); if ($data[0]['accountholding'] != '') { $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view'); $empsalarydetailsform->accountholding->setValue($accountholding); } if ($data[0]['accountclasstypeid'] != '') { $empsalarydetailsform->setDefault('accountclasstypeid', $data[0]['accountclasstypeid']); } $empsalarydetailsform->setDefault('currencyid', $data[0]['currencyid']); $empsalarydetailsform->setDefault('bankaccountid', $data[0]['bankaccountid']); $this->view->data = $data[0]; } $empsalarydetailsform->user_id->setValue($id); $empsalarydetailsform->setAttrib('action', DOMAIN . 'mydetails/salarydetails'); $this->view->form = $empsalarydetailsform; $this->view->id = $id; $this->view->msgarray = $msgarray; $this->view->employeedata = $empdata[0]; $this->view->emptyFlag = $emptyFlag; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $this->view->empdata = $empdata; } } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($empsalarydetailsform, $tabName); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function init() { $this->setMethod('post'); $this->setAttrib('id', 'formid'); $this->setAttrib('name', 'systempreference'); $id = new Zend_Form_Element_Hidden('id'); $currencyid = new Zend_Form_Element_Hidden('currencyid'); $organisationid = new Zend_Form_Element_Hidden('organisationid'); $empcodeid = new Zend_Form_Element_Hidden('empcodeid'); $dateformatid = new Zend_Form_Element_Select('dateformatid'); $dateformatid->setAttrib('class', 'selectoption'); $dateformatid->setRegisterInArrayValidator(false); $dateformatid->setRequired(true); $dateformatid->addValidator('NotEmpty', false, array('messages' => 'Please select date format.')); $timeformatid = new Zend_Form_Element_Select('timeformatid'); $timeformatid->setAttrib('class', 'selectoption'); $timeformatid->setRegisterInArrayValidator(false); $timeformatid->setRequired(true); $timeformatid->addValidator('NotEmpty', false, array('messages' => 'Please select time format.')); $timezoneid = new Zend_Form_Element_Select('timezoneid'); $timezoneid->setAttrib('class', 'selectoption'); $timezoneid->setRegisterInArrayValidator(false); $timezoneid->setRequired(true); $timezoneid->addValidator('NotEmpty', false, array('messages' => 'Please select time zone preference.')); $timezoneid->addMultiOption('', 'Select Time zone'); $timezoneModal = new Default_Model_Timezone(); $timezoneData = $timezoneModal->fetchAll('isactive=1', 'timezone')->toArray(); foreach ($timezoneData as $data) { $timezoneid->addMultiOption($data['id'], $data['timezone'] . ' [' . $data['timezone_abbr'] . ']'); } $currencyname = new Zend_Form_Element_Select('currencyname'); $currencyname->setRegisterInArrayValidator(false); $currencyModel = new Default_Model_Currency(); $currencylistArr = $currencyModel->getCurrencyList(); if (sizeof($currencylistArr) > 0) { $currencyname->addMultiOption('', 'Select Currency'); foreach ($currencylistArr as $currencylistres) { $currencyname->addMultiOption($currencylistres['id'], $currencylistres['currencytext']); } $currencyname->addMultiOption('other', 'Other'); } $currencyname->setAttrib('onchange', 'displayOtherCurrency(this)'); $currencyname->setRequired(true); $currencyname->addValidator('NotEmpty', false, array('messages' => 'Please select currency.')); $othercurrencyname = new Zend_Form_Element_Text('othercurrencyname'); $othercurrencyname->setAttrib('maxLength', 50); $othercurrencyname->addFilter(new Zend_Filter_StringTrim()); $othercurrencyname->setRequired(true); $othercurrencyname->addValidator('NotEmpty', false, array('messages' => 'Please enter currency name.')); $othercurrencyname->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency name.'))); $othercurrencyname->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencyname'))); $othercurrencyname->getValidator('Db_NoRecordExists')->setMessage('Currency name already exists.'); $othercurrencycode = new Zend_Form_Element_Text('othercurrencycode'); $othercurrencycode->setAttrib('maxLength', 50); $othercurrencycode->addFilter(new Zend_Filter_StringTrim()); $othercurrencycode->setRequired(true); $othercurrencycode->addValidator('NotEmpty', false, array('messages' => 'Please enter currency code.')); $othercurrencycode->addValidator("regex", true, array('pattern' => '/^[a-zA-Z][a-zA-Z0-9\\s]*$/', 'messages' => array('regexNotMatch' => 'Please enter valid currency code.'))); $othercurrencycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'main_currency', 'field' => 'currencycode'))); $othercurrencycode->getValidator('Db_NoRecordExists')->setMessage('Currency code already exists.'); $passwordid = new Zend_Form_Element_Select('passwordid'); $passwordid->setAttrib('class', 'selectoption'); $passwordid->setAttrib('onchange', 'displayPasswordDesc(this)'); $passwordid->setRegisterInArrayValidator(false); $passwordid->setRequired(true); $passwordid->addValidator('NotEmpty', false, array('messages' => 'Please select default password.')); $perm_country = new Zend_Form_Element_Select('perm_country'); $perm_country->setAttrib('onchange', 'displayParticularState(this,"","perm_state","")'); $perm_country->setRegisterInArrayValidator(false); $countriesModel = new Default_Model_Countries(); $countrieslistArr = $countriesModel->getTotalCountriesList('addcountry'); if (sizeof($countrieslistArr) > 0) { $perm_country->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { $perm_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } $perm_country->setRequired(true); $perm_country->addValidator('NotEmpty', false, array('messages' => 'Please select country.')); $perm_state = new Zend_Form_Element_Select('perm_state'); $perm_state->setAttrib('onchange', 'displayParticularCity(this,"","perm_city","")'); $perm_state->setRegisterInArrayValidator(false); $perm_state->addMultiOption('', 'Select State'); $perm_state->setRequired(true); $perm_state->addValidator('NotEmpty', false, array('messages' => 'Please select state.')); $perm_city = new Zend_Form_Element_Select('perm_city'); $perm_city->setRegisterInArrayValidator(false); $perm_city->addMultiOption('', 'Select City'); $perm_city->setRequired(true); $perm_city->addValidator('NotEmpty', false, array('messages' => 'Please select city.')); $workcodename = new Zend_Form_Element_Multiselect('workcodename'); $workcodename->setRegisterInArrayValidator(false); $workcodename->setRequired(true); $workcodename->addValidator('NotEmpty', false, array('messages' => 'Please select employment status.')); $empCode = new Zend_Form_Element_Text('employee_code'); $empCode->addFilter(new Zend_Filter_StringTrim()); $empCode->setAttrib('maxLength', 5); $empCode->setRequired(true); $empCode->addValidator('NotEmpty', false, array('messages' => 'Please enter employee code.')); $empCode->addValidators(array(array('StringLength', false, array('min' => 1, 'max' => 5, 'messages' => array(Zend_Validate_StringLength::TOO_LONG => 'Employee code must contain at most %max% characters.', Zend_Validate_StringLength::TOO_SHORT => 'Employee code must contain at least %min% characters.'))))); $empCode->addValidators(array(array('validator' => 'Regex', 'breakChainOnFailure' => true, 'options' => array('pattern' => '/^[A-Za-z][a-zA-Z@\\-]*$/', 'messages' => array(Zend_Validate_Regex::NOT_MATCH => 'Please enter valid employee code.'))))); $submit = new Zend_Form_Element_Submit('submit'); $submit->setAttrib('id', 'submitbutton'); $submit->setLabel('Save'); $this->addElements(array($timezoneid, $id, $currencyid, $organisationid, $empcodeid, $dateformatid, $timeformatid, $othercurrencycode, $othercurrencyname, $currencyname, $passwordid, $perm_country, $perm_state, $perm_city, $workcodename, $empCode, $submit)); $this->setElementDecorators(array('ViewHelper')); }