public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('workeligibilitydetails', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginUserRole = $auth->getStorage()->read()->emprole; $loginUserGroup = $auth->getStorage()->read()->group_id; } $this->view->WorkeligibilitydoctypesPermission = sapp_Global::_checkprivileges(WORKELIGIBILITYDOCTYPES, $loginUserGroup, $loginUserRole, 'add'); $popConfigPermission = array(); 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'); } $this->view->popConfigPermission = $popConfigPermission; $userid = $this->getRequest()->getParam('userid'); $employeeModal = new Default_Model_Employee(); $workeligibilityform = new Default_Form_Workeligibilitydetails(); $workeligibilityModel = new Default_Model_Workeligibilitydetails(); $msgarray = array(); $emptyFlag = 0; $issuingauthority = ''; //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($userid, $teamIdArr)) { try { if ($userid && is_numeric($userid) && $userid > 0 && $userid != $loginUserId) { $usersModel = new Default_Model_Users(); $empdata = $employeeModal->getActiveEmployeeData($userid); $employeeData = $usersModel->getUserDetailsByIDandFlag($userid); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); $citiesmodel = new Default_Model_Cities(); $workeligibilityDoctypesModal = new Default_Model_Workeligibilitydoctypes(); $workeligibilityDoctypesData = $workeligibilityDoctypesModal->fetchAll('isactive=1', 'documenttype'); $workeligibilityDoctypesDataArr = $workeligibilityDoctypesData->toArray(); if (!empty($workeligibilityDoctypesDataArr)) { foreach ($workeligibilityDoctypesDataArr as $data) { $workeligibilityform->documenttype_id->addMultiOption($data['id'], $data['documenttype']); } } else { $msgarray['documenttype_id'] = 'Work eligibility document types are not configured yet.'; $emptyFlag++; } $countrieslistArr = $countriesModel->getTotalCountriesList(); if (!empty($countrieslistArr)) { $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($userid); //echo "<pre>Work eligibility Data ";print_r($data);echo "</pre>"; die; 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 (!empty($statelistArr)) { $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 (!empty($citylistArr)) { $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->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); } $workeligibilityform->setAttrib('action', BASE_URL . 'workeligibilitydetails/edit/userid/' . $userid); $workeligibilityform->setDefault("user_id", $userid); $this->view->id = $userid; } $this->view->employeedata = $employeeData[0]; $this->view->form = $workeligibilityform; $this->view->empdata = $empdata; $this->view->msgarray = $msgarray; $this->view->emptyFlag = $emptyFlag; $this->view->issuingauthority = $issuingauthority; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } } else { $this->view->rowexist = "norows"; } } catch (Exception $e) { $this->view->rowexist = "norows"; } if ($this->getRequest()->getPost()) { $result = $this->save($workeligibilityform); $result['issuingauthorityflag'] = $_POST['issuingauthflag']; $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function editAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('creditcarddetails', $empOrganizationTabs)) { $employeeData = array(); $empdata = array(); $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'); $auth = Zend_Auth::getInstance(); $creditcardDetailsform = new Default_Form_Creditcarddetails(); $creditcardDetailsModel = new Default_Model_Creditcarddetails(); //TO get the Employee profile information.... $usersModel = new Default_Model_Users(); $employeeModal = new Default_Model_Employee(); //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) { $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)) { $data = $creditcardDetailsModel->getcreditcarddetailsRecord($id); 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"]); } $creditcardDetailsform->setAttrib('action', BASE_URL . 'creditcarddetails/edit/userid/' . $id); $this->view->id = $id; $this->view->form = $creditcardDetailsform; $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"; } if ($this->getRequest()->getPost()) { $result = $this->save($creditcardDetailsform); $this->view->msgarray = $result; } } else { $this->_redirect('error'); } } 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 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'); } }