public function edueditAction() { if (defined('EMPTABCONFIGS')) { $empOrganizationTabs = explode(",", EMPTABCONFIGS); if (in_array('education_details', $empOrganizationTabs)) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $call = $this->_getParam('call'); if ($call == 'ajaxcall') { $this->_helper->layout->disableLayout(); $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid'); } $userid = $this->getRequest()->getParam('userid'); if ($userid == '') { $userid = $loginUserId; } $Uid = $userid ? $userid : $userID; $employeeModal = new Default_Model_Employee(); try { $empdata = $employeeModal->getsingleEmployeeData($Uid); if ($empdata == 'norows') { $this->view->rowexist = "norows"; $this->view->empdata = ""; } else { $this->view->rowexist = "rows"; if (!empty($empdata)) { $educationdetailsModel = new Default_Model_Educationdetails(); $view = Zend_Layout::getMvcInstance()->getView(); $objname = $this->_getParam('objname'); $refresh = $this->_getParam('refresh'); $data = array(); $employeeData = array(); $searchQuery = ''; $searchArray = array(); $tablecontent = ''; if ($refresh == 'refresh') { $sort = 'DESC'; $by = 'e.modifieddate'; $perPage = PERPAGE; $pageNo = 1; $searchData = ''; } else { $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC'; $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'e.modifieddate'; $perPage = $this->_getParam('per_page', PERPAGE); $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) { if ($key == 'from_date' || $key == 'to_date') { $searchQuery .= " " . $key . " like '%" . sapp_Global::change_date($val, 'database') . "%' AND "; } else { $searchQuery .= " " . $key . " like '%" . $val . "%' AND "; } $searchArray[$key] = $val; } $searchQuery = rtrim($searchQuery, " AND"); } /** search from grid - END **/ } $objName = 'educationdetails'; $tableFields = array('action' => 'Action', 'educationlevel' => 'Education Level', 'institution_name' => 'Institution Name', 'course' => 'Course', 'from_date' => 'From', "to_date" => "To", "percentage" => "Percentage"); $tablecontent = $educationdetailsModel->geteducationdetails($sort, $by, $pageNo, $perPage, $searchQuery, $Uid); $educationlevelcodemodel = new Default_Model_Educationlevelcode(); $educationlevelArr = $educationlevelcodemodel->getEducationlevelData(); $level_opt = array(); if (!empty($educationlevelArr)) { foreach ($educationlevelArr as $educationlevelres) { $level_opt[$educationlevelres['id']] = $educationlevelres['educationlevelcode']; } } $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' => TAB_EMP_EDUCATION, 'formgrid' => 'true', 'unitId' => $Uid, 'call' => $call, 'context' => 'myteam', 'search_filters' => array('from_date' => array('type' => 'datepicker'), 'to_date' => array('type' => 'datepicker'), 'educationlevel' => array('type' => 'select', 'filter_data' => array('' => 'All') + $level_opt))); array_push($data, $dataTmp); $this->view->id = $Uid; $this->view->controllername = $objName; $this->view->dataArray = $data; $this->view->employeedata = $empdata[0]; $this->view->call = $call; $this->view->messages = $this->_helper->flashMessenger->getMessages(); } $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'] = ''; $actionflag = 3; if ($id) { $educationDetailsModel = new Default_Model_Educationdetails(); $menumodel = new Default_Model_Menu(); $data = array('isactive' => 0, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $educationDetailsModel->SaveorUpdateEducationDetails($data, $where); if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/employee'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $messages['message'] = 'Employee Education details deleted successfully'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Employee Education details cannot be deleted'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Employee Education details cannot be deleted'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); }