public function addAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('visadetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             $data = array();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $employeeModal = new Default_Model_Employee();
             $isrowexist = $employeeModal->getsingleEmployeeData($id);
             if ($isrowexist == 'norows') {
                 $this->view->rowexist = "norows";
             } else {
                 $this->view->rowexist = "rows";
             }
             $empdata = $employeeModal->getActiveEmployeeData($id);
             if (!empty($empdata)) {
                 $visaandimmigrationDetailsform = new Default_Form_Visaandimmigrationdetails();
                 $visaandimmigrationdetailsModel = new Default_Model_Visaandimmigrationdetails();
                 if ($id) {
                     $usersModel = new Default_Model_Users();
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     $this->view->id = $id;
                     $visaandimmigrationDetailsform->setAttrib('action', BASE_URL . 'visaandimmigrationdetails/add/userid/' . $id);
                 }
                 $this->view->form = $visaandimmigrationDetailsform;
                 $this->view->employeedata = $employeeData[0];
                 $this->view->data = $data;
                 if ($this->getRequest()->getPost()) {
                     $result = $this->save($visaandimmigrationDetailsform);
                     $this->view->msgarray = $result;
                 }
             }
             $this->view->empdata = $empdata;
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('employeedocs', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $employeeModal = new Default_Model_Employee();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     if (!empty($empdata)) {
                         $empDocuModel = new Default_Model_Employeedocs();
                         $empDocuments = $empDocuModel->getEmpDocumentsByFieldOrAll('user_id', $id);
                         $this->view->empDocuments = $empDocuments;
                     }
                     $usersModel = new Default_Model_Users();
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if (!empty($employeeData)) {
                         $this->view->employeedata = $employeeData[0];
                     }
                     $this->view->id = $id;
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_performanceappraisal', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $userid = $this->getRequest()->getParam('userid');
             $employeeModal = new Default_Model_Employee();
             $isrowexist = $employeeModal->getsingleEmployeeData($userid);
             if ($isrowexist == 'norows') {
                 $this->view->rowexist = "norows";
             } else {
                 $this->view->rowexist = "rows";
             }
             $empdata = $employeeModal->getActiveEmployeeData($userid);
             if (!empty($empdata)) {
                 $empperformanceApprModel = new Default_Model_Empperformanceappraisal();
                 if ($userid) {
                     //To display Employee Profile information......
                     $usersModel = new Default_Model_Users();
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($userid);
                 }
                 $this->view->id = $userid;
                 $this->view->employeedata = $employeeData[0];
                 if ($this->getRequest()->getPost()) {
                 }
             }
             $this->view->empdata = $empdata;
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction_27092013()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('userid');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'empcommunicationdetails';
     $empcommdetailsform = new Default_Form_empcommunicationdetails();
     $empcommdetailsform->removeElement("submit");
     $elements = $empcommdetailsform->getElements();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     try {
         if ($id) {
             $employeeModal = new Default_Model_Employee();
             $isrowexist = $employeeModal->getsingleEmployeeData($id);
             if ($isrowexist == 'norows') {
                 $this->view->rowexist = "norows";
             } else {
                 $this->view->rowexist = "rows";
             }
             $empdata = $employeeModal->getActiveEmployeeData($id);
             if (!empty($empdata)) {
                 //TO get the Employee  profile information....
                 $usersModel = new Default_Model_Users();
                 $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                 $empcommdetailsModal = new Default_Model_Empcommunicationdetails();
                 $usersModel = new Default_Model_Users();
                 $countriesModel = new Default_Model_Countries();
                 $statesmodel = new Default_Model_States();
                 $citiesmodel = new Default_Model_Cities();
                 $orgInfoModel = new Default_Model_Organisationinfo();
                 $msgarray = array();
                 $orgid = 1;
                 $orgdata = $orgInfoModel->getOrganisationData($orgid);
                 $countryId = $orgdata['country'];
                 $stateId = $orgdata['state'];
                 $cityId = $orgdata['city'];
                 if ($countryId != '') {
                     $countryData = $countriesModel->getActiveCountryName($countryId);
                     $orgdata['country'] = $countryData[0]['country'];
                 }
                 if ($stateId != '') {
                     $stateData = $statesmodel->getStateNameData($stateId);
                     $orgdata['state'] = $stateData[0]['state'];
                 }
                 if ($cityId != '') {
                     $citiesData = $citiesmodel->getCitiesNameData($cityId);
                     $orgdata['city'] = $citiesData[0]['city'];
                 }
                 $countrieslistArr = $countriesModel->getActiveCountriesList();
                 if (sizeof($countrieslistArr) > 0) {
                     $empcommdetailsform->perm_country->addMultiOption('', 'Select Country');
                     $empcommdetailsform->current_country->addMultiOption('', 'Select Country');
                     foreach ($countrieslistArr as $countrieslistres) {
                         $empcommdetailsform->perm_country->addMultiOption($countrieslistres['country_id_org'], $countrieslistres['country']);
                         $empcommdetailsform->current_country->addMultiOption($countrieslistres['country_id_org'], $countrieslistres['country']);
                     }
                 } else {
                     $msgarray['perm_country'] = 'Countries are not configured yet.';
                     $msgarray['current_country'] = 'Countries are not configured yet.';
                 }
                 $data = $empcommdetailsModal->getsingleEmpCommDetailsData($id);
                 if (!empty($data)) {
                     $statePermlistArr = $statesmodel->getStatesList($data[0]['perm_country']);
                     if (sizeof($statePermlistArr) > 0) {
                         $empcommdetailsform->perm_state->addMultiOption('', 'Select State');
                         foreach ($statePermlistArr as $statelistres) {
                             $empcommdetailsform->perm_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']);
                         }
                     }
                     $cityPermlistArr = $citiesmodel->getCitiesList($data[0]['perm_state']);
                     if (sizeof($cityPermlistArr) > 0) {
                         $empcommdetailsform->perm_city->addMultiOption('', 'Select City');
                         foreach ($cityPermlistArr as $cityPermlistres) {
                             $empcommdetailsform->perm_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']);
                         }
                     }
                     if ($data[0]['current_country'] != '' && $data[0]['current_state'] != '') {
                         $statecurrlistArr = $statesmodel->getStatesList($data[0]['current_country']);
                         if (sizeof($statecurrlistArr) > 0) {
                             $empcommdetailsform->current_state->addMultiOption('', 'Select State');
                             foreach ($statecurrlistArr as $statecurrlistres) {
                                 $empcommdetailsform->current_state->addMultiOption($statecurrlistres['id'] . '!@#' . $statecurrlistres['state_name'], $statecurrlistres['state_name']);
                             }
                         }
                         $currstateNameArr = $statesmodel->getStateName($data[0]['current_state']);
                     }
                     if ($data[0]['current_country'] != '' && $data[0]['current_state'] != '' && $data[0]['current_city'] != '') {
                         $cityCurrlistArr = $citiesmodel->getCitiesList($data[0]['current_state']);
                         if (sizeof($cityCurrlistArr) > 0) {
                             $empcommdetailsform->current_city->addMultiOption('', 'Select State');
                             foreach ($cityCurrlistArr as $cityCurrlistres) {
                                 $empcommdetailsform->current_city->addMultiOption($cityCurrlistres['id'] . '!@#' . $cityCurrlistres['city_name'], $cityCurrlistres['city_name']);
                             }
                         }
                         $currcityNameArr = $citiesmodel->getCityName($data[0]['current_city']);
                     }
                     $permstateNameArr = $statesmodel->getStateName($data[0]['perm_state']);
                     $permcityNameArr = $citiesmodel->getCityName($data[0]['perm_city']);
                     $empcommdetailsform->populate($data[0]);
                     $empcommdetailsform->setDefault('perm_country', $data[0]['perm_country']);
                     $empcommdetailsform->setDefault('perm_state', $permstateNameArr[0]['id'] . '!@#' . $permstateNameArr[0]['statename']);
                     $empcommdetailsform->setDefault('perm_city', $permcityNameArr[0]['id'] . '!@#' . $permcityNameArr[0]['cityname']);
                     if ($data[0]['current_country'] != '') {
                         $empcommdetailsform->setDefault('current_country', $data[0]['current_country']);
                     }
                     if ($data[0]['current_state'] != '') {
                         $empcommdetailsform->setDefault('current_state', $currstateNameArr[0]['id'] . '!@#' . $currstateNameArr[0]['statename']);
                     }
                     if ($data[0]['current_city'] != '') {
                         $empcommdetailsform->setDefault('current_city', $currcityNameArr[0]['id'] . '!@#' . $currcityNameArr[0]['cityname']);
                     }
                 }
                 $this->view->controllername = $objName;
                 $this->view->data = $data;
                 $this->view->dataArray = $orgdata;
                 $this->view->id = $id;
                 $this->view->employeedata = $employeeData[0];
                 $this->view->form = $empcommdetailsform;
             }
             $this->view->empdata = $empdata;
         }
     } catch (Exception $e) {
         $this->view->rowexist = "norows";
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_leaves', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $conText = "";
             $call = $this->_getParam('call');
             if ($call == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
                 $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid');
                 $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context');
             }
             $usersModel = new Default_Model_Users();
             if ($id == '') {
                 $id = $userID;
             }
             $Uid = $id ? $id : $userID;
             if ($Uid != "") {
                 $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
             }
             $employeeleavesModel = new Default_Model_Employeeleaves();
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $isrowexist = $employeeModal->getsingleEmployeeData($id);
                     if ($isrowexist == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         $this->view->rowexist = "rows";
                     }
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     if (!empty($empdata)) {
                         $usersModel = new Default_Model_Users();
                         if ($id) {
                             $empleavesform = new Default_Form_empleaves();
                             $employeeleavesModal = new Default_Model_Employeeleaves();
                             $data = $employeeleavesModal->getsingleEmployeeleaveData($id);
                             $used_leaves = 0;
                             $date = date('Y');
                             if (!empty($data)) {
                                 $empleavesform->populate($data[0]);
                                 $used_leaves = $data[0]['used_leaves'];
                             }
                             $empleavesform->alloted_year->setValue($date);
                             $empleavesform->setAttrib('action', BASE_URL . 'empleaves/edit/userid/' . $id);
                             $this->view->form = $empleavesform;
                             $this->view->data = $data;
                             $this->view->id = $id;
                         }
                         $objname = $this->_getParam('objname');
                         $refresh = $this->_getParam('refresh');
                         $dashboardcall = $this->_getParam('dashboardcall', null);
                         $data = array();
                         $searchQuery = '';
                         $searchArray = array();
                         $tablecontent = '';
                         if ($refresh == 'refresh') {
                             if ($dashboardcall == 'Yes') {
                                 $perPage = DASHBOARD_PERPAGE;
                             } else {
                                 $perPage = PERPAGE;
                             }
                             $sort = 'DESC';
                             $by = 'e.modifieddate';
                             $pageNo = 1;
                             $searchData = '';
                             $searchQuery = '';
                             $searchArray = array();
                         } else {
                             $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                             $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'e.modifieddate';
                             if ($dashboardcall == 'Yes') {
                                 $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                             } else {
                                 $perPage = $this->_getParam('per_page', PERPAGE);
                             }
                             $pageNo = $this->_getParam('page', 1);
                             $searchData = $this->_getParam('searchData');
                             $searchData = rtrim($searchData, ',');
                         }
                         $dataTmp = $employeeleavesModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $Uid, $conText);
                         array_push($data, $dataTmp);
                         $this->view->dataArray = $data;
                         $this->view->call = $call;
                         $this->view->id = $id;
                         $this->view->messages = $this->_helper->flashMessenger->getMessages();
                         if (!empty($employeeData)) {
                             $this->view->employeedata = $employeeData[0];
                         }
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('workeligibilitydetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $employeeData = array();
             $id = $this->getRequest()->getParam('userid');
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'workeligibilitydetails';
             $issuingauthority = '';
             $employeeModal = new Default_Model_Employee();
             $workeligibilityform = new Default_Form_Workeligibilitydetails();
             $workeligibilityform->removeElement("submit");
             $elements = $workeligibilityform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $workeligibilityModel = new Default_Model_Workeligibilitydetails();
                             if ($id) {
                                 $usersModel = new Default_Model_Users();
                                 $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes();
                                 $countriesModel = new Default_Model_Countries();
                                 $statesmodel = new Default_Model_States();
                                 $citiesmodel = new Default_Model_Cities();
                                 $countrieslistArr = $countriesModel->getTotalCountriesList();
                                 if (sizeof($countrieslistArr) > 0) {
                                     $workeligibilityform->issuingauth_country->addMultiOption('', 'Select Country');
                                     foreach ($countrieslistArr as $countrieslistres) {
                                         $workeligibilityform->issuingauth_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                                     }
                                 } else {
                                     $msgarray['issuingauth_country'] = 'Countries are not configured yet.';
                                 }
                                 $data = $workeligibilityModel->getWorkEligibilityRecord($id);
                                 if (!empty($data) && isset($data)) {
                                     $countryId = $data[0]['issuingauth_country'];
                                     $stateId = $data[0]['issuingauth_state'];
                                     $cityId = $data[0]['issuingauth_city'];
                                     $documenttype_id = $data[0]['documenttype_id'];
                                     if ($countryId != '') {
                                         $statelistArr = $statesmodel->getStatesList($countryId);
                                         if (sizeof($statelistArr) > 0) {
                                             $workeligibilityform->issuingauth_state->addMultiOption('', 'Select State');
                                             foreach ($statelistArr as $statelistres) {
                                                 $workeligibilityform->issuingauth_state->addMultiOption($statelistres['id'] . '!@#' . $statelistres['state_name'], $statelistres['state_name']);
                                             }
                                         }
                                     }
                                     if ($stateId != '') {
                                         $citylistArr = $citiesmodel->getCitiesList($stateId);
                                         if (sizeof($citylistArr) > 0) {
                                             $workeligibilityform->issuingauth_city->addMultiOption('', 'Select City');
                                             foreach ($citylistArr as $cityPermlistres) {
                                                 $workeligibilityform->issuingauth_city->addMultiOption($cityPermlistres['id'] . '!@#' . $cityPermlistres['city_name'], $cityPermlistres['city_name']);
                                             }
                                         }
                                         $stateNameArr = $statesmodel->getStateName($stateId);
                                     }
                                     if ($cityId != '') {
                                         $cityNameArr = $citiesmodel->getCityName($cityId);
                                     }
                                     if ($documenttype_id != '') {
                                         $issuingauthorityArr = $workeligibilityDoctypesModal->getIssuingAuthority($documenttype_id);
                                     }
                                     if (!empty($issuingauthorityArr)) {
                                         $issuingauthority = $issuingauthorityArr[0]['issuingauthority'];
                                         $workeligibilityform->issuingauthflag->setValue($issuingauthority);
                                         $workeligibilityform->documenttype_id->addMultiOption($issuingauthorityArr[0]['id'], $issuingauthorityArr[0]['documenttype']);
                                     }
                                     $workeligibilityform->setDefault("id", $data[0]["id"]);
                                     $workeligibilityform->setDefault("user_id", $data[0]["user_id"]);
                                     $workeligibilityform->setDefault('issuingauth_country', $data[0]['issuingauth_country']);
                                     if (!empty($stateNameArr)) {
                                         $workeligibilityform->setDefault('issuingauth_state', $stateNameArr[0]['id'] . '!@#' . $stateNameArr[0]['statename']);
                                     }
                                     if (!empty($cityNameArr)) {
                                         $workeligibilityform->setDefault('issuingauth_city', $cityNameArr[0]['id'] . '!@#' . $cityNameArr[0]['cityname']);
                                     }
                                     $workeligibilityform->setDefault("documenttype_id", $data[0]["documenttype_id"]);
                                     $workeligibilityform->setDefault("issuingauth_name", $data[0]["issuingauth_name"]);
                                     $workeligibilityform->setDefault("issuingauth_postalcode", $data[0]["issuingauth_postalcode"]);
                                     $issue_date = date(DATEFORMAT_PHP, strtotime($data[0]["doc_issue_date"]));
                                     $workeligibilityform->setDefault('doc_issue_date', $issue_date);
                                     $expiry_date = date(DATEFORMAT_PHP, strtotime($data[0]["doc_expiry_date"]));
                                     $workeligibilityform->setDefault('doc_expiry_date', $expiry_date);
                                 }
                                 $this->view->controllername = $objName;
                                 $this->view->id = $id;
                                 $this->view->data = $data;
                                 $this->view->employeedata = $employeeData[0];
                                 $this->view->form = $workeligibilityform;
                                 $this->view->issuingauthority = $issuingauthority;
                             }
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_additional', $empOrganizationTabs)) {
             $userID = "";
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
             }
             $id = $this->getRequest()->getParam('userid');
             $conText = '';
             $call = $this->_getParam('call');
             if ($call == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
                 $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid');
                 $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context');
             }
             if ($id == '') {
                 $id = $userID;
             }
             $Uid = $id ? $id : $userID;
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($Uid && is_numeric($Uid) && $Uid > 0) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($Uid);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $empadditionaldetailsModal = new Default_Model_Empadditionaldetails();
                             $view = Zend_Layout::getMvcInstance()->getView();
                             $objname = $this->_getParam('objname');
                             $refresh = $this->_getParam('refresh');
                             $dashboardcall = $this->_getParam('dashboardcall', null);
                             $data = array();
                             $searchQuery = '';
                             $searchArray = array();
                             $tablecontent = '';
                             if ($refresh == 'refresh') {
                                 if ($dashboardcall == 'Yes') {
                                     $perPage = DASHBOARD_PERPAGE;
                                 } else {
                                     $perPage = PERPAGE;
                                 }
                                 $sort = 'DESC';
                                 $by = 'e.modifieddate';
                                 $pageNo = 1;
                                 $searchData = '';
                                 $searchQuery = '';
                                 $searchArray = '';
                             } else {
                                 $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                                 $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'e.modifieddate';
                                 if ($dashboardcall == 'Yes') {
                                     $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                                 } else {
                                     $perPage = $this->_getParam('per_page', PERPAGE);
                                 }
                                 $pageNo = $this->_getParam('page', 1);
                                 $searchData = $this->_getParam('searchData');
                                 $searchData = rtrim($searchData, ',');
                             }
                             $dataTmp = $empadditionaldetailsModal->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $Uid, $conText);
                             array_push($data, $dataTmp);
                             $this->view->dataArray = $data;
                             $this->view->call = $call;
                             $this->view->employeedata = $employeeData[0];
                             $this->view->id = $id;
                             $this->view->messages = $this->_helper->flashMessenger->getMessages();
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'employee';
     $employeeform = new Default_Form_employee();
     $employeeform->removeElement("submit");
     $elements = $employeeform->getElements();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     try {
         if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
             $employeeModal = new Default_Model_Employee();
             $usersModel = new Default_Model_Users();
             $employmentstatusModel = new Default_Model_Employmentstatus();
             $busineesUnitModel = new Default_Model_Businessunits();
             $deptModel = new Default_Model_Departments();
             $role_model = new Default_Model_Roles();
             $user_model = new Default_Model_Usermanagement();
             $candidate_model = new Default_Model_Candidatedetails();
             $jobtitlesModel = new Default_Model_Jobtitles();
             $positionsmodel = new Default_Model_Positions();
             $prefixModel = new Default_Model_Prefix();
             $data = array();
             $data = $employeeModal->getsingleEmployeeData($id);
             if ($data == 'norows') {
                 $this->view->rowexist = "norows";
             } else {
                 if (!empty($data)) {
                     $this->view->rowexist = "rows";
                     $data = $data[0];
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($data['user_id']);
                     $roles_arr = $role_model->getRolesDataByID($data['emprole']);
                     if (sizeof($roles_arr) > 0) {
                         $employeeform->emprole->addMultiOption($roles_arr[0]['id'] . '_' . $roles_arr[0]['group_id'], utf8_encode($roles_arr[0]['rolename']));
                     }
                     $referedby_options = $user_model->getRefferedByForUsers();
                     $reportingManagerData = $usersModel->getReportingManagerList_employees($data['department_id'], $data['id'], $roles_arr[0]['group_id']);
                     if (!empty($reportingManagerData)) {
                         $employeeform->reporting_manager->addMultiOption('', 'Select Reporting Manager');
                         foreach ($reportingManagerData as $reportingManagerres) {
                             $employeeform->reporting_manager->addMultiOption($reportingManagerres['id'], $reportingManagerres['name']);
                         }
                     }
                     $employeeform->setDefault('reporting_manager', $data['reporting_manager']);
                     $employmentStatusData = $employmentstatusModel->getempstatuslist();
                     if (sizeof($employmentStatusData) > 0) {
                         $employeeform->emp_status_id->addMultiOption('', 'Select Employment Status');
                         foreach ($employmentStatusData as $employmentStatusres) {
                             $employeeform->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']);
                         }
                     }
                     $businessunitData = $busineesUnitModel->getDeparmentList();
                     if (sizeof($businessunitData) > 0) {
                         $employeeform->businessunit_id->addMultiOption('0', 'No Business Unit');
                         foreach ($businessunitData as $businessunitres) {
                             $employeeform->businessunit_id->addMultiOption($businessunitres['id'], $businessunitres['unitname']);
                         }
                     }
                     $departmentsData = $deptModel->getDepartmentList($data['businessunit_id']);
                     if (sizeof($departmentsData) > 0) {
                         $employeeform->department_id->addMultiOption('', 'Select Department');
                         foreach ($departmentsData as $departmentsres) {
                             $employeeform->department_id->addMultiOption($departmentsres['id'], $departmentsres['deptname']);
                         }
                     }
                     $jobtitleData = $jobtitlesModel->getJobTitleList();
                     if (sizeof($jobtitleData) > 0) {
                         $employeeform->jobtitle_id->addMultiOption('', 'Select Job Title');
                         foreach ($jobtitleData as $jobtitleres) {
                             $employeeform->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']);
                         }
                     }
                     $positionlistArr = $positionsmodel->getPositionList($data['jobtitle_id']);
                     if (sizeof($positionlistArr) > 0) {
                         $employeeform->position_id->addMultiOption('', 'Select a Position');
                         foreach ($positionlistArr as $positionlistres) {
                             $employeeform->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']);
                         }
                     }
                     if (isset($data['prefix_id']) && $data['prefix_id'] != '') {
                         $singlePrefixArr = $prefixModel->getsinglePrefixData($data['prefix_id']);
                         if ($singlePrefixArr != 'norows') {
                             $employeeform->prefix_id->addMultiOption($singlePrefixArr[0]['id'], $singlePrefixArr[0]['prefix']);
                         }
                     }
                     $employeeform->populate($data);
                     $employeeform->setDefault('user_id', $data['user_id']);
                     $employeeform->setDefault('emp_status_id', $data['emp_status_id']);
                     $employeeform->setDefault('businessunit_id', $data['businessunit_id']);
                     $employeeform->setDefault('jobtitle_id', $data['jobtitle_id']);
                     $employeeform->setDefault('department_id', $data['department_id']);
                     $employeeform->setDefault('position_id', $data['position_id']);
                     $date_of_joining = sapp_Global::change_date($data['date_of_joining'], 'view');
                     $employeeform->date_of_joining->setValue($date_of_joining);
                     if ($data['date_of_leaving'] != '' && $data['date_of_leaving'] != '0000-00-00') {
                         $date_of_leaving = sapp_Global::change_date($data['date_of_leaving'], 'view');
                         $employeeform->date_of_leaving->setValue($date_of_leaving);
                     }
                     if ($data['modeofentry'] != 'Direct') {
                         $employeeform->rccandidatename->setValue($data['userfullname']);
                     }
                     if (sizeof($referedby_options) > 0 && $data['candidatereferredby'] != '' && $data['candidatereferredby'] != 0) {
                         $employeeform->candidatereferredby->setValue($referedby_options[$data['candidatereferredby']]);
                     }
                     if ($data['rccandidatename'] != '' && $data['rccandidatename'] != 0) {
                         $cand_data = $candidate_model->getCandidateById($data['rccandidatename']);
                         $data['requisition_code'] = $cand_data['requisition_code'];
                     }
                     $employeeform->setAttrib('action', BASE_URL . 'employee/edit/id/' . $id);
                     $this->view->id = $id;
                     $this->view->form = $employeeform;
                     $this->view->employeedata = !empty($employeeData) ? $employeeData[0] : "";
                     $this->view->messages = $this->_helper->flashMessenger->getMessages();
                     $this->view->data = $data;
                     $this->view->controllername = $objName;
                     $this->view->id = $id;
                 }
             }
         } else {
             $this->view->rowexist = "norows";
         }
     } catch (Exception $e) {
         $this->view->rowexist = "norows";
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('dependency_details', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
             }
             $userid = $this->getRequest()->getParam('userid');
             $employeeData = array();
             $empdata = array();
             $userID = '';
             $conText = "";
             $call = $this->_getParam('call');
             if ($call == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
                 $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid');
                 $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context');
             }
             if ($userid == '') {
                 $userid = $userID;
             }
             $dependencydetailsModel = new Default_Model_Dependencydetails();
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($userid && is_numeric($userid) && $userid > 0 && $userid != $loginUserId) {
                     $isrowexist = $employeeModal->getsingleEmployeeData($userid);
                     if ($isrowexist == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         $this->view->rowexist = "rows";
                     }
                     $empdata = $employeeModal->getActiveEmployeeData($userid);
                     if (!empty($empdata)) {
                         $view = Zend_Layout::getMvcInstance()->getView();
                         $objname = $this->_getParam('objname');
                         $refresh = $this->_getParam('refresh');
                         $data = array();
                         $searchQuery = '';
                         $searchArray = array();
                         $tablecontent = '';
                         if ($refresh == 'refresh') {
                             $sort = 'DESC';
                             $by = 'modifieddate';
                             $perPage = 10;
                             $pageNo = 1;
                             $searchData = '';
                         } else {
                             $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                             $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'modifieddate';
                             $perPage = $this->_getParam('per_page', 10);
                             $pageNo = $this->_getParam('page', 1);
                             $searchData = $this->_getParam('searchData');
                             $searchData = rtrim($searchData, ',');
                             /** search from grid - START **/
                             $searchData = $this->_getParam('searchData');
                             if ($searchData != '' && $searchData != 'undefined') {
                                 $searchValues = json_decode($searchData);
                                 foreach ($searchValues as $key => $val) {
                                     $searchQuery .= " " . $key . " like '%" . $val . "%' AND ";
                                     $searchArray[$key] = $val;
                                 }
                                 $searchQuery = rtrim($searchQuery, " AND");
                             }
                             /** search from grid - END **/
                         }
                         $objName = 'dependencydetails';
                         $Uid = $userid ? $userid : $userID;
                         $tableFields = array('action' => 'Action', 'dependent_name' => 'Dependent Name', 'dependent_relation' => 'Dependent Relation', 'dependent_dob' => 'Dependent DOB');
                         $tablecontent = $dependencydetailsModel->getdependencydetailsData($sort, $by, $pageNo, $perPage, $searchQuery, $Uid);
                         if ($Uid != "") {
                             $usersModel = new Default_Model_Users();
                             $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
                         }
                         $dataTmp = array('userid' => $Uid, 'sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getEmployeeAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'add' => 'add', 'menuName' => 'Dependency', 'formgrid' => 'true', 'unitId' => $Uid, 'call' => $call, 'context' => $conText);
                         array_push($data, $dataTmp);
                         $this->view->id = $userid;
                         $this->view->controllername = $objName;
                         $this->view->dataArray = $data;
                         $this->view->call = $call;
                         $this->view->employeedata = $employeeData[0];
                         $this->view->messages = $this->_helper->flashMessenger->getMessages();
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('disabilitydetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             $emptyFlag = 0;
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
             }
             $id = $this->getRequest()->getParam('userid');
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $isrowexist = $employeeModal->getsingleEmployeeData($id);
                     if ($isrowexist == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         $this->view->rowexist = "rows";
                     }
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     if (!empty($empdata)) {
                         $callval = $this->getRequest()->getParam('call');
                         if ($callval == 'ajaxcall') {
                             $this->_helper->layout->disableLayout();
                         }
                         $objName = 'disabilitydetails';
                         $employeeData = array();
                         $empDisabilitydetailsform = new Default_Form_Disabilitydetails();
                         $empDisabilitydetailsModel = new Default_Model_Disabilitydetails();
                         $empDisabilitydetailsform->removeElement("submit");
                         $elements = $empDisabilitydetailsform->getElements();
                         if (count($elements) > 0) {
                             foreach ($elements as $key => $element) {
                                 if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                                     $element->setAttrib("disabled", "disabled");
                                 }
                             }
                         }
                         $data = $empDisabilitydetailsModel->getempDisabilitydetails($id);
                         $usersModel = new Default_Model_Users();
                         $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                         if (!empty($data)) {
                             $empDisabilitydetailsform->setDefault('user_id', $data[0]['user_id']);
                             $empDisabilitydetailsform->setDefault('disability_name', $data[0]['disability_name']);
                             $empDisabilitydetailsform->setDefault('disability_type', $data[0]['disability_type']);
                             $empDisabilitydetailsform->setDefault('other_disability_type', $data[0]['other_disability_type']);
                             $empDisabilitydetailsform->setDefault('disability_description', $data[0]['disability_description']);
                         }
                         $this->view->controllername = $objName;
                         $this->view->id = $id;
                         $this->view->data = $data;
                         $this->view->employeedata = $employeeData[0];
                         $this->view->form = $empDisabilitydetailsform;
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_holidays', $empOrganizationTabs)) {
             $conText = "";
             $userID = '';
             $msgarray = array();
             $empGroupId = '';
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $call = $this->_getParam('call');
             if ($call == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
                 $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid');
                 $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context');
             }
             if ($id == '') {
                 $id = $userID;
             }
             $Uid = $id ? $id : $userID;
             if ($Uid != "") {
                 //TO dispaly EMployee Profile information.....
                 $usersModel = new Default_Model_Users();
                 $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
             }
             $employeesModel = new Default_Model_Employees();
             $holidaydatesmodel = new Default_Model_Holidaydates();
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $isrowexist = $employeeModal->getsingleEmployeeData($id);
                     if ($isrowexist == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         $this->view->rowexist = "rows";
                     }
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     if (!empty($empdata)) {
                         if ($id) {
                             $empholidaysform = new Default_Form_empholidays();
                             $holidaygroupModel = new Default_Model_Holidaygroups();
                             $holidaygroupArr = $holidaygroupModel->getAllGroupData();
                             if (sizeof($holidaygroupArr) > 0) {
                                 $empGroupId = $holidaygroupArr[0]['id'];
                                 foreach ($holidaygroupArr as $holidaygroupres) {
                                     $empholidaysform->holiday_group->addMultiOption($holidaygroupres['id'], $holidaygroupres['groupname']);
                                 }
                             } else {
                                 $msgarray['empholidaysform'] = 'Holiday groups not configured yet';
                             }
                             $data = $employeesModel->getHolidayGroupForEmployee($id);
                             if ($data[0]['holiday_group'] != '') {
                                 $singleholidaygroupArr = $holidaygroupModel->getsingleGroupData($data[0]['holiday_group']);
                                 $empholidaysform->populate($data[0]);
                                 $empholidaysform->setDefault('holiday_group', $data[0]['holiday_group']);
                                 $empGroupId = $data[0]['holiday_group'];
                                 $this->view->data = $data;
                             }
                             $empholidaysform->setAttrib('action', BASE_URL . 'empholidays/edit/userid/' . $id);
                             $this->view->form = $empholidaysform;
                         }
                         if ($this->getRequest()->getPost()) {
                             $result = $this->save($empholidaysform, $id);
                             $this->view->msgarray = $result;
                         }
                         $objname = $this->_getParam('objname');
                         $refresh = $this->_getParam('refresh');
                         $dashboardcall = $this->_getParam('dashboardcall', null);
                         $data = array();
                         $searchQuery = '';
                         $searchArray = array();
                         $tablecontent = '';
                         if ($refresh == 'refresh') {
                             if ($dashboardcall == 'Yes') {
                                 $perPage = DASHBOARD_PERPAGE;
                             } else {
                                 $perPage = PERPAGE;
                             }
                             $sort = 'DESC';
                             $by = 'h.modifieddate';
                             $pageNo = 1;
                             $searchData = '';
                             $searchQuery = '';
                             $searchArray = array();
                         } else {
                             $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                             $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'h.modifieddate';
                             if ($dashboardcall == 'Yes') {
                                 $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                             } else {
                                 $perPage = $this->_getParam('per_page', PERPAGE);
                             }
                             $pageNo = $this->_getParam('page', 1);
                             $searchData = $this->_getParam('searchData');
                             $searchData = rtrim($searchData, ',');
                         }
                         $objName = 'empholidays';
                         $dataTmp = $holidaydatesmodel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $objName, $empGroupId, $Uid, $conText);
                         array_push($data, $dataTmp);
                         $this->view->dataArray = $data;
                         $this->view->call = $call;
                         $this->view->id = $id;
                         $this->view->messages = $this->_helper->flashMessenger->getMessages();
                         if (!empty($employeeData)) {
                             $this->view->employeedata = $employeeData[0];
                         }
                     }
                     $this->view->empdata = $empdata;
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function editAction()
 {
     $genderaddpermission = '';
     $msaddpermission = '';
     $ethnicaddpermission = '';
     $racecodepermission = '';
     $languagepermission = '';
     $nationalityaddpermission = '';
     $identityDocumentArr = array();
     $documentsArr = array();
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emppersonaldetails', $empOrganizationTabs)) {
             $loginUserId = '';
             $loginUserGroup = '';
             $loginUserRole = '';
             $auth = Zend_Auth::getInstance();
             $emptyFlag = 0;
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
             }
             $genderaddpermission = sapp_Global::_checkprivileges(GENDER, $loginUserGroup, $loginUserRole, 'add');
             $msaddpermission = sapp_Global::_checkprivileges(MARITALSTATUS, $loginUserGroup, $loginUserRole, 'add');
             $ethnicaddpermission = sapp_Global::_checkprivileges(ETHNICCODE, $loginUserGroup, $loginUserRole, 'add');
             $racecodepermission = sapp_Global::_checkprivileges(RACECODE, $loginUserGroup, $loginUserRole, 'add');
             $languagepermission = sapp_Global::_checkprivileges(LANGUAGE, $loginUserGroup, $loginUserRole, 'add');
             $nationalityaddpermission = sapp_Global::_checkprivileges(NATIONALITY, $loginUserGroup, $loginUserRole, 'add');
             $id = $this->getRequest()->getParam('userid');
             if ($id == '') {
                 $id = $loginUserId;
             }
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $employeeModal = new Default_Model_Employee();
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $empperdetailsModal = new Default_Model_Emppersonaldetails();
                             $usersModel = new Default_Model_Users();
                             $emppersonaldetailsform = new Default_Form_emppersonaldetails();
                             if ($loginUserGroup == MANAGEMENT_GROUP || $loginUserGroup == HR_GROUP || $loginUserRole == SUPERADMINROLE) {
                                 $identitydocumentsModel = new Default_Model_Identitydocuments();
                                 $identityDocumentArr = $identitydocumentsModel->getIdentitydocumnetsrecord();
                             }
                             $genderModel = new Default_Model_Gender();
                             $maritalstatusmodel = new Default_Model_Maritalstatus();
                             $nationalitymodel = new Default_Model_Nationality();
                             $ethniccodemodel = new Default_Model_Ethniccode();
                             $racecodemodel = new Default_Model_Racecode();
                             $languagemodel = new Default_Model_Language();
                             $msgarray = array();
                             $genderlistArr = $genderModel->getGenderList();
                             if (!empty($genderlistArr)) {
                                 foreach ($genderlistArr as $genderlistres) {
                                     $emppersonaldetailsform->genderid->addMultiOption($genderlistres['id'], $genderlistres['gendername']);
                                 }
                             } else {
                                 $msgarray['genderid'] = 'Gender is not configured yet.';
                                 $emptyFlag++;
                             }
                             $maritalstatuslistArr = $maritalstatusmodel->getMaritalStatusList();
                             if (!empty($maritalstatuslistArr)) {
                                 foreach ($maritalstatuslistArr as $maritalstatuslistres) {
                                     $emppersonaldetailsform->maritalstatusid->addMultiOption($maritalstatuslistres['id'], $maritalstatuslistres['maritalstatusname']);
                                 }
                             } else {
                                 $msgarray['maritalstatusid'] = 'Marital status is not configured yet.';
                                 $emptyFlag++;
                             }
                             $nationalitylistArr = $nationalitymodel->getNationalityList();
                             if (!empty($nationalitylistArr)) {
                                 foreach ($nationalitylistArr as $nationalitylistres) {
                                     $emppersonaldetailsform->nationalityid->addMultiOption($nationalitylistres['id'], $nationalitylistres['nationalitycode']);
                                 }
                             } else {
                                 $msgarray['nationalityid'] = 'Nationality is not configured yet.';
                                 $emptyFlag++;
                             }
                             $ethniccodeArr = $ethniccodemodel->gettotalEthnicCodeData();
                             if (!empty($ethniccodeArr)) {
                                 foreach ($ethniccodeArr as $ethniccoderes) {
                                     $emppersonaldetailsform->ethniccodeid->addMultiOption($ethniccoderes['id'], $ethniccoderes['ethnicname']);
                                 }
                             } else {
                                 $msgarray['ethniccodeid'] = 'Ethnic codes are not configured yet.';
                                 $emptyFlag++;
                             }
                             $racecodeArr = $racecodemodel->gettotalRaceCodeData();
                             if (!empty($racecodeArr)) {
                                 foreach ($racecodeArr as $racecoderes) {
                                     $emppersonaldetailsform->racecodeid->addMultiOption($racecoderes['id'], $racecoderes['racename']);
                                 }
                             } else {
                                 $msgarray['racecodeid'] = 'Race codes are not configured yet.';
                                 $emptyFlag++;
                             }
                             $languageArr = $languagemodel->gettotalLanguageData();
                             if (!empty($languageArr)) {
                                 foreach ($languageArr as $languageres) {
                                     $emppersonaldetailsform->languageid->addMultiOption($languageres['id'], $languageres['languagename']);
                                 }
                             } else {
                                 $msgarray['languageid'] = 'Languages are not configured yet.';
                                 $emptyFlag++;
                             }
                             if (!empty($identityDocumentArr)) {
                                 $this->view->identitydocument = $identityDocumentArr;
                             }
                             $data = $empperdetailsModal->getsingleEmpPerDetailsData($id);
                             if (!empty($data)) {
                                 $emppersonaldetailsform->populate($data[0]);
                                 $dob = sapp_Global::change_date($data[0]["dob"], 'view');
                                 $emppersonaldetailsform->dob->setValue($dob);
                                 /*
                                 if($data[0]['celebrated_dob'] !='')
                                 {
                                 
                                 	$celebrated_dob = sapp_Global::change_date($data[0]["celebrated_dob"], 'view');
                                 	$emppersonaldetailsform->celebrated_dob->setValue($celebrated_dob);
                                 }
                                 */
                                 if ($data[0]['identity_documents'] != '') {
                                     $documentsArr = get_object_vars(json_decode($data[0]['identity_documents']));
                                 }
                                 $emppersonaldetailsform->setDefault('genderid', $data[0]['genderid']);
                                 $emppersonaldetailsform->setDefault('maritalstatusid', $data[0]['maritalstatusid']);
                                 $emppersonaldetailsform->setDefault('nationalityid', $data[0]['nationalityid']);
                                 $emppersonaldetailsform->setDefault('ethniccodeid', $data[0]['ethniccodeid']);
                                 $emppersonaldetailsform->setDefault('racecodeid', $data[0]['racecodeid']);
                                 $emppersonaldetailsform->setDefault('languageid', $data[0]['languageid']);
                             }
                             $emppersonaldetailsform->user_id->setValue($id);
                             $emppersonaldetailsform->setAttrib('action', BASE_URL . 'emppersonaldetails/edit/userid/' . $id);
                             $this->view->form = $emppersonaldetailsform;
                             $this->view->data = $data;
                             $this->view->documentsArr = $documentsArr;
                             $this->view->id = $id;
                             $this->view->msgarray = $msgarray;
                             $this->view->employeedata = $employeeData[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($emppersonaldetailsform, $id, $identityDocumentArr);
                 $this->view->msgarray = $result;
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
     $this->view->genderaddpermission = $genderaddpermission;
     $this->view->msaddpermission = $msaddpermission;
     $this->view->ethnicaddpermission = $ethnicaddpermission;
     $this->view->racecodepermission = $racecodepermission;
     $this->view->languagepermission = $languagepermission;
     $this->view->nationalityaddpermission = $nationalityaddpermission;
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('emp_salary', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             if ($id == '') {
                 $id = $loginUserId;
             }
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'empsalarydetails';
             $empsalarydetailsform = new Default_Form_empsalarydetails();
             $empsalarydetailsform->removeElement("submit");
             $elements = $empsalarydetailsform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $employeeModal = new Default_Model_Employee();
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($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();
                             $data = $empsalarydetailsModal->getsingleEmpSalaryDetailsData($id);
                             if (!empty($data)) {
                                 if (isset($data[0]['currencyid']) && $data[0]['currencyid'] != '') {
                                     $currencyArr = $currencymodel->getCurrencyDataByID($data[0]['currencyid']);
                                     if (sizeof($currencyArr) > 0) {
                                         $empsalarydetailsform->currencyid->addMultiOption($currencyArr[0]['id'], $currencyArr[0]['currencyname'] . ' ' . $currencyArr[0]['currencycode']);
                                     }
                                 }
                                 if (isset($data[0]['accountclasstypeid']) && $data[0]['accountclasstypeid'] != '') {
                                     $accountclasstypeArr = $accountclasstypemodel->getsingleAccountClassTypeData($data[0]['accountclasstypeid']);
                                     if (sizeof($accountclasstypeArr) > 0) {
                                         $empsalarydetailsform->accountclasstypeid->addMultiOption($accountclasstypeArr[0]['id'], $accountclasstypeArr[0]['accountclasstype']);
                                     }
                                 }
                                 if (isset($data[0]['bankaccountid']) && $data[0]['bankaccountid'] != '') {
                                     $bankaccounttypeArr = $bankaccounttypemodel->getsingleBankAccountData($data[0]['bankaccountid']);
                                     if ($bankaccounttypeArr != 'norows') {
                                         $empsalarydetailsform->bankaccountid->addMultiOption($bankaccounttypeArr[0]['id'], $bankaccounttypeArr[0]['bankaccounttype']);
                                     }
                                 }
                                 if (isset($data[0]['salarytype']) && $data[0]['salarytype'] != '') {
                                     $payfreqData = $payfrequencyModal->getActivePayFreqData($data[0]['salarytype']);
                                     if (sizeof($payfreqData) > 0) {
                                         foreach ($payfreqData as $payfreqres) {
                                             $empsalarydetailsform->salarytype->addMultiOption($payfreqres['id'], $payfreqres['freqtype']);
                                         }
                                     }
                                 }
                                 $empsalarydetailsform->populate($data[0]);
                                 if ($data[0]['accountholding'] != '') {
                                     $accountholding = sapp_Global::change_date($data[0]["accountholding"], 'view');
                                     $empsalarydetailsform->accountholding->setValue($accountholding);
                                 }
                             }
                             $this->view->controllername = $objName;
                             $this->view->data = $data;
                             $this->view->id = $id;
                             $this->view->form = $empsalarydetailsform;
                             $this->view->employeedata = $employeeData[0];
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function doceditAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('employeedocs', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
             }
             $id = $this->getRequest()->getParam('userid');
             $myEmployees_model = new Default_Model_Myemployees();
             $getMyTeamIds = $myEmployees_model->getTeamIds($loginUserId);
             $teamIdArr = array();
             if (!empty($getMyTeamIds)) {
                 foreach ($getMyTeamIds as $teamId) {
                     array_push($teamIdArr, $teamId['user_id']);
                 }
             }
             if ($loginUserRole == SUPERADMINROLE || $loginUserGroup == MANAGEMENT_GROUP || $loginUserGroup == HR_GROUP || $loginUserGroup == MANAGER_GROUP && in_array($id, $teamIdArr)) {
                 try {
                     if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                         $employeeModal = new Default_Model_Employee();
                         $empdata = $employeeModal->getActiveEmployeeData($id);
                         if (!empty($empdata)) {
                             $empDocuModel = new Default_Model_Employeedocs();
                             $empDocuments = $empDocuModel->getEmpDocumentsByFieldOrAll('user_id', $id);
                             $this->view->empDocuments = $empDocuments;
                         }
                         $usersModel = new Default_Model_Users();
                         $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                         if (!empty($employeeData)) {
                             $this->view->employeedata = $employeeData[0];
                         }
                         $this->view->id = $id;
                         $this->view->empdata = $empdata;
                     } else {
                         $this->view->rowexist = "norows";
                     }
                 } catch (Exception $e) {
                     $this->view->rowexist = "norows";
                 }
                 // Show message to user when document was deleted by other user.
                 $this->view->messages = $this->_helper->flashMessenger->getMessages();
             } else {
                 $this->_redirect('error');
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('creditcarddetails', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
             }
             $id = $this->getRequest()->getParam('userid');
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             $objName = 'creditcarddetails';
             $creditcardDetailsform = new Default_Form_Creditcarddetails();
             $creditcardDetailsModel = new Default_Model_Creditcarddetails();
             $creditcardDetailsform->removeElement("submit");
             $elements = $creditcardDetailsform->getElements();
             if (count($elements) > 0) {
                 foreach ($elements as $key => $element) {
                     if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                         $element->setAttrib("disabled", "disabled");
                     }
                 }
             }
             $data = $creditcardDetailsModel->getcreditcarddetailsRecord($id);
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($id);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             if (!empty($data)) {
                                 $creditcardDetailsform->setDefault("id", $data[0]['id']);
                                 $creditcardDetailsform->setDefault('user_id', $data[0]['user_id']);
                                 $creditcardDetailsform->setDefault("card_type", $data[0]["card_type"]);
                                 $creditcardDetailsform->setDefault("card_number", $data[0]["card_number"]);
                                 $creditcardDetailsform->setDefault("nameoncard", $data[0]["nameoncard"]);
                                 $expiry_date = sapp_Global::change_date($data[0]["card_expiration"], 'view');
                                 $creditcardDetailsform->setDefault('card_expiration', $expiry_date);
                                 $creditcardDetailsform->setDefault("card_issuedby", $data[0]["card_issued_comp"]);
                                 $creditcardDetailsform->setDefault("card_code", $data[0]["card_code"]);
                             }
                             $this->view->controllername = $objName;
                             $this->view->id = $id;
                             $this->view->employeedata = $employeeData[0];
                             $this->view->form = $creditcardDetailsform;
                             $this->view->data = $data;
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }
 public function editAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $popConfigPermission = array();
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('empcommunicationdetails', $empOrganizationTabs)) {
             $empDeptdata = array();
             $employeeData = array();
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginuserRole = $auth->getStorage()->read()->emprole;
                 $loginuserGroup = $auth->getStorage()->read()->group_id;
             }
             if (sapp_Global::_checkprivileges(COUNTRIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
                 array_push($popConfigPermission, 'country');
             }
             if (sapp_Global::_checkprivileges(STATES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
                 array_push($popConfigPermission, 'state');
             }
             if (sapp_Global::_checkprivileges(CITIES, $loginuserGroup, $loginuserRole, 'add') == 'Yes') {
                 array_push($popConfigPermission, 'city');
             }
             $id = $this->getRequest()->getParam('userid');
             if ($id == '') {
                 $id = $loginUserId;
             }
             $callval = $this->getRequest()->getParam('call');
             if ($callval == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
             }
             //To check previliges for edit
             $myEmployees_model = new Default_Model_Myemployees();
             $getMyTeamIds = $myEmployees_model->getTeamIds($loginUserId);
             $teamIdArr = array();
             if (!empty($getMyTeamIds)) {
                 foreach ($getMyTeamIds as $teamId) {
                     array_push($teamIdArr, $teamId['user_id']);
                 }
             }
             if ($loginuserRole == SUPERADMINROLE || $loginuserGroup == MANAGEMENT_GROUP || $loginuserGroup == HR_GROUP || $loginuserGroup == MANAGER_GROUP && in_array($id, $teamIdArr)) {
                 try {
                     if ($id && is_numeric($id) && $id > 0 && $id != $loginUserId) {
                         $employeeModal = new Default_Model_Employee();
                         $usersModel = new Default_Model_Users();
                         $empdata = $employeeModal->getActiveEmployeeData($id);
                         $employeeData = $usersModel->getUserDetailsByIDandFlag($id);
                         if ($empdata == 'norows') {
                             $this->view->rowexist = "norows";
                             $this->view->empdata = "";
                         } else {
                             $this->view->rowexist = "rows";
                             if (!empty($empdata)) {
                                 $empDept = $empdata[0]['department_id'];
                                 $empcommdetailsform = new Default_Form_empcommunicationdetails();
                                 $empcommdetailsModal = new Default_Model_Empcommunicationdetails();
                                 $usersModel = new Default_Model_Users();
                                 $countriesModel = new Default_Model_Countries();
                                 $statesmodel = new Default_Model_States();
                                 $citiesmodel = new Default_Model_Cities();
                                 $orgInfoModel = new Default_Model_Organisationinfo();
                                 $msgarray = array();
                                 $orgid = 1;
                                 $countryId = '';
                                 $stateId = '';
                                 $cityId = '';
                                 $deptModel = new Default_Model_Departments();
                                 if ($empDept != '' && $empDept != 'NULL') {
                                     $empDeptdata = $deptModel->getEmpdepartmentdetails($empDept);
                                     if (!empty($empDeptdata)) {
                                         $countryId = $empDeptdata[0]['country'];
                                         $stateId = $empDeptdata[0]['state'];
                                         $cityId = $empDeptdata[0]['city'];
                                     }
                                 } else {
                                     $empDeptdata = $orgInfoModel->getOrganisationDetails($orgid);
                                     if (!empty($empDeptdata)) {
                                         $countryId = $empDeptdata[0]['country'];
                                         $stateId = $empDeptdata[0]['state'];
                                         $cityId = $empDeptdata[0]['city'];
                                     }
                                 }
                                 if ($countryId != '') {
                                     $countryData = $countriesModel->getActiveCountryName($countryId);
                                 }
                                 if (!empty($countryData)) {
                                     $empDeptdata[0]['country'] = $countryData[0]['country'];
                                 } else {
                                     $empDeptdata[0]['country'] = '';
                                 }
                                 if ($stateId != '') {
                                     $stateData = $statesmodel->getStateNameData($stateId);
                                 }
                                 if (!empty($stateData)) {
                                     $empDeptdata[0]['state'] = $stateData[0]['state'];
                                 } else {
                                     $empDeptdata[0]['state'] = '';
                                 }
                                 if ($cityId != '') {
                                     $citiesData = $citiesmodel->getCitiesNameData($cityId);
                                 }
                                 if (!empty($citiesData)) {
                                     $empDeptdata[0]['city'] = $citiesData[0]['city'];
                                 } else {
                                     $empDeptdata[0]['city'] = '';
                                 }
                                 $countrieslistArr = $countriesModel->getTotalCountriesList();
                                 if (sizeof($countrieslistArr) > 0) {
                                     $empcommdetailsform->perm_country->addMultiOption('', 'Select Country');
                                     $empcommdetailsform->current_country->addMultiOption('', 'Select Country');
                                     foreach ($countrieslistArr as $countrieslistres) {
                                         $empcommdetailsform->perm_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                                         $empcommdetailsform->current_country->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name']));
                                     }
                                 } else {
                                     $msgarray['perm_country'] = 'Countries are not configured yet.';
                                     $msgarray['current_country'] = 'Countries are not configured yet.';
                                 }
                                 $data = $empcommdetailsModal->getsingleEmpCommDetailsData($id);
                                 if (!empty($data)) {
                                     $perm_country = $data[0]['perm_country'];
                                     if (isset($_POST['perm_country'])) {
                                         $perm_country = $_POST['perm_country'];
                                     }
                                     $perm_state = $data[0]['perm_state'];
                                     if (isset($_POST['perm_state'])) {
                                         $perm_state = $_POST['perm_state'];
                                     }
                                     $perm_city = $data[0]['perm_city'];
                                     if (isset($_POST['perm_city'])) {
                                         $perm_city = $_POST['perm_city'];
                                     }
                                     if ($perm_country != '') {
                                         $statePermlistArr = $statesmodel->getStatesList($perm_country);
                                         if (sizeof($statePermlistArr) > 0) {
                                             $empcommdetailsform->perm_state->addMultiOption('', 'Select State');
                                             foreach ($statePermlistArr as $statelistres) {
                                                 $empcommdetailsform->perm_state->addMultiOption($statelistres['id'], $statelistres['state_name']);
                                             }
                                         }
                                     }
                                     if ($perm_state != '') {
                                         $cityPermlistArr = $citiesmodel->getCitiesList($perm_state);
                                         if (sizeof($cityPermlistArr) > 0) {
                                             $empcommdetailsform->perm_city->addMultiOption('', 'Select City');
                                             foreach ($cityPermlistArr as $cityPermlistres) {
                                                 $empcommdetailsform->perm_city->addMultiOption($cityPermlistres['id'], $cityPermlistres['city_name']);
                                             }
                                         }
                                     }
                                     $current_country = $data[0]['current_country'];
                                     if (isset($_POST['current_country'])) {
                                         $current_country = $_POST['current_country'];
                                     }
                                     $current_state = $data[0]['current_state'];
                                     if (isset($_POST['current_state'])) {
                                         $current_state = $_POST['current_state'];
                                     }
                                     $current_city = $data[0]['current_city'];
                                     if (isset($_POST['current_city'])) {
                                         $current_city = $_POST['current_city'];
                                     }
                                     if ($current_country != '') {
                                         $statecurrlistArr = $statesmodel->getStatesList($current_country);
                                         if (sizeof($statecurrlistArr) > 0) {
                                             $empcommdetailsform->current_state->addMultiOption('', 'Select State');
                                             foreach ($statecurrlistArr as $statecurrlistres) {
                                                 $empcommdetailsform->current_state->addMultiOption($statecurrlistres['id'], $statecurrlistres['state_name']);
                                             }
                                         }
                                     }
                                     if ($current_state != '') {
                                         $cityCurrlistArr = $citiesmodel->getCitiesList($current_state);
                                         if (sizeof($cityCurrlistArr) > 0) {
                                             $empcommdetailsform->current_city->addMultiOption('', 'Select City');
                                             foreach ($cityCurrlistArr as $cityCurrlistres) {
                                                 $empcommdetailsform->current_city->addMultiOption($cityCurrlistres['id'], $cityCurrlistres['city_name']);
                                             }
                                         }
                                     }
                                     $empcommdetailsform->populate($data[0]);
                                     $empcommdetailsform->setDefault('perm_country', $perm_country);
                                     $empcommdetailsform->setDefault('perm_state', $perm_state);
                                     $empcommdetailsform->setDefault('perm_city', $perm_city);
                                     if ($data[0]['current_country'] != '') {
                                         $empcommdetailsform->setDefault('current_country', $current_country);
                                     }
                                     if ($data[0]['current_state'] != '') {
                                         $empcommdetailsform->setDefault('current_state', $current_state);
                                     }
                                     if ($data[0]['current_city'] != '') {
                                         $empcommdetailsform->setDefault('current_city', $current_city);
                                     }
                                 }
                                 $empcommdetailsform->setAttrib('action', BASE_URL . 'empcommunicationdetails/edit/userid/' . $id);
                                 $empcommdetailsform->user_id->setValue($id);
                                 $this->view->employeedata = $employeeData[0];
                                 if (!empty($empDeptdata)) {
                                     $this->view->dataArray = $empDeptdata[0];
                                 } else {
                                     $this->view->dataArray = $empDeptdata;
                                 }
                                 $this->view->form = $empcommdetailsform;
                                 $this->view->data = $data;
                                 $this->view->id = $id;
                                 $this->view->msgarray = $msgarray;
                                 $this->view->popConfigPermission = $popConfigPermission;
                                 $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($empcommdetailsform, $id);
                     $this->view->msgarray = $result;
                 }
             } else {
                 $this->_redirect('error');
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }