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 editAction() { $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(); } $languageform = new Default_Form_language(); $languagemodel = new Default_Model_Language(); try { if ($id) { if (is_numeric($id) && $id > 0) { $data = $languagemodel->getLanguageDataByID($id); if (!empty($data)) { $languageform->populate($data[0]); $languageform->submit->setLabel('Update'); $this->view->ermsg = ''; } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = 'norecord'; } } else { $this->view->ermsg = ''; } } catch (Exception $e) { $this->view->ermsg = 'nodata'; } $this->view->form = $languageform; if ($this->getRequest()->getPost()) { if ($languageform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $languagename = $this->_request->getParam('languagename'); $description = $this->_request->getParam('description'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('languagename' => trim($languagename), 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $languagemodel->SaveorUpdateLanguageData($data, $where); if ($Id == 'update') { $tableid = $id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Language updated successfully.")); } else { $tableid = $Id; $this->_helper->getHelper("FlashMessenger")->addMessage(array("success" => "Language added successfully.")); } $menuidArr = $menumodel->getMenuObjID('/language'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->_redirect('language'); } else { $messages = $languageform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } }