public function perviewAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('emppersonaldetails', $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'); if ($id == '') { $id = $loginUserId; } $callval = $this->getRequest()->getParam('call'); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'emppersonaldetails'; $emppersonaldetailsform = new Default_Form_emppersonaldetails(); $employeeModal = new Default_Model_Employee(); $emppersonaldetailsform->removeElement("submit"); $elements = $emppersonaldetailsform->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) { $empdata = $employeeModal->getsingleEmployeeData($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(); $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(); if ($loginUserGroup == MANAGER_GROUP || $loginUserRole == SUPERADMINROLE) { $identitydocumentsModel = new Default_Model_Identitydocuments(); $identityDocumentArr = $identitydocumentsModel->getIdentitydocumnetsrecord(); } $data = $empperdetailsModal->getsingleEmpPerDetailsData($id); if (!empty($identityDocumentArr)) { $this->view->identitydocument = $identityDocumentArr; } else { $this->view->identitydocument = ''; } if (!empty($data)) { if (isset($data[0]['genderid']) && $data[0]['genderid'] != '') { $genderlistArr = $genderModel->getGenderDataByID($data[0]['genderid']); if (sizeof($genderlistArr) > 0) { $emppersonaldetailsform->genderid->addMultiOption($genderlistArr[0]['id'], $genderlistArr[0]['gendername']); } } if (isset($data[0]['maritalstatusid']) && $data[0]['maritalstatusid'] != '') { $maritalstatuslistArr = $maritalstatusmodel->getsingleMaritalstatusData($data[0]['maritalstatusid']); if ($maritalstatuslistArr != 'norows') { $emppersonaldetailsform->maritalstatusid->addMultiOption($maritalstatuslistArr[0]['id'], $maritalstatuslistArr[0]['maritalstatusname']); } } if (isset($data[0]['nationalityid']) && $data[0]['nationalityid'] != '') { $nationalitylistArr = $nationalitymodel->getNationalityDataByID($data[0]['nationalityid']); if (sizeof($nationalitylistArr) > 0) { $emppersonaldetailsform->nationalityid->addMultiOption($nationalitylistArr[0]['id'], $nationalitylistArr[0]['nationalitycode']); } } if (isset($data[0]['ethniccodeid']) && $data[0]['ethniccodeid'] != '') { $singleethniccodeArr = $ethniccodemodel->getsingleEthnicCodeData($data[0]['ethniccodeid']); if ($singleethniccodeArr != 'norows') { $emppersonaldetailsform->ethniccodeid->addMultiOption($singleethniccodeArr[0]['id'], $singleethniccodeArr[0]['ethnicname']); } } if (isset($data[0]['racecodeid']) && $data[0]['racecodeid'] != '') { $singleracecodeArr = $racecodemodel->getsingleRaceCodeData($data[0]['racecodeid']); if ($singleracecodeArr != 'norows') { $emppersonaldetailsform->racecodeid->addMultiOption($singleracecodeArr[0]['id'], $singleracecodeArr[0]['racename']); } } if (isset($data[0]['languageid']) && $data[0]['languageid'] != '') { $singlelanguageArr = $languagemodel->getLanguageDataByID($data[0]['languageid']); if (!empty($singlelanguageArr)) { $emppersonaldetailsform->languageid->addMultiOption($singlelanguageArr[0]['id'], $singlelanguageArr[0]['languagename']); } } $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); } */ $documentsArr = array(); if ($data[0]['identity_documents'] != '') { $documentsArr = get_object_vars(json_decode($data[0]['identity_documents'])); } $this->view->documentsArr = $documentsArr; } $this->view->controllername = $objName; $this->view->data = $data; $this->view->id = $id; $this->view->form = $emppersonaldetailsform; $this->view->employeedata = $empdata[0]; } $this->view->empdata = $empdata; } } } catch (Exception $e) { $this->view->rowexist = "norows"; } } else { $this->_redirect('error'); } } else { $this->_redirect('error'); } }
public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $messages['msgtype'] = ''; $messages['flagtype'] = ''; $gendername = ''; $actionflag = 3; if ($id) { $gendermodel = new Default_Model_Gender(); $menumodel = new Default_Model_Menu(); $genderdata = $gendermodel->getGenderDataByID($id); if (!empty($genderdata)) { $gendername = $genderdata[0]['gendername']; } $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $gendermodel->SaveorUpdateGenderData($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/gender'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $configmail = sapp_Global::send_configuration_mail('Gender', $gendername); $messages['message'] = 'Gender deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Gender cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Gender cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }