public function indexAction() { $auth = Zend_Auth::getInstance(); $loginUserId = 0; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $businessunit_id = $auth->getStorage()->read()->businessunit_id; $department_id = $auth->getStorage()->read()->department_id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $obj_appraisal_history = new Default_Model_Appraisalhistory(); $emp_appraisal_data = array(); $emp_appraisal_data = $obj_appraisal_history->getEmpAppraisalHistory($loginUserId); //get the max rating value $max = 0; foreach ($emp_appraisal_data as $k => $v) { $max = max(array($max, $v['consolidated_rating'])); } $this->view->max_rating = $max > 5 ? 10 : 5; $this->view->emp_appraisal_data = $emp_appraisal_data; $this->view->employee_id = $loginUserId; }
public function saveAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserFullName = $auth->getStorage()->read()->userfullname; $loginuserProfileImg = $auth->getStorage()->read()->profileimg; } try { $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings(); $app_init_model = new Default_Model_Appraisalinit(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $id = $this->_request->getParam('id'); $employee_id = $this->_request->getParam('employee_id'); $initialization_id = $this->_request->getParam('initialization_id'); $config_id = $this->_request->getParam('config_id'); $flag = $this->_request->getParam('flag'); $app_status = $this->_request->getParam('app_status'); $mgr_levels = $this->_request->getParam('mgr_levels'); $ratingsData = $appEmpRatingsModel->getAppRatingsDataByConfgId($config_id, $initialization_id); $ratingValues = array(); foreach ($ratingsData as $rd) { $ratingValues[$rd['id']] = $rd['rating_value']; } $appData = array('modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s")); $emp_rating_arr = $this->_request->getParam('emp_rating'); $emp_comment_arr = $this->_request->getParam('emp_comment'); $emp_response = array(); if (sizeof($emp_rating_arr) > 0 || sizeof($emp_comment_arr) > 0) { foreach ($emp_rating_arr as $qid => $val) { if (isset($emp_rating_arr[$qid])) { $rating_id = array_search($emp_rating_arr[$qid], $ratingValues); } else { $rating_id = ''; } $emp_response[$qid] = array('comment' => $emp_comment_arr[$qid], 'rating_id' => $rating_id); } } $appData['employee_response'] = json_encode($emp_response, true); $curent_level = array_search($app_status, $this->app_status_array); if ($flag == 'submit') { $appData['appraisal_status'] = $curent_level + 1; $history_desc = $this->app_history_disc_array[$curent_level]; $appHistoryData = array('employee_id' => $employee_id, 'pa_initialization_id' => $initialization_id, 'description' => $history_desc, 'desc_emp_id' => $loginUserId, 'desc_emp_name' => $loginuserFullName, 'desc_emp_profileimg' => $loginuserProfileImg, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $appHistoryModel = new Default_Model_Appraisalhistory(); $result2 = $appHistoryModel->SaveorUpdateAppraisalHistoryData($appHistoryData); /* Update employee response column */ $appraisaldata = $app_init_model->getConfigData($initialization_id); if ($appraisaldata[0]['employee_response'] == 1) { $initdata = array('employee_response' => 2, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s")); $initwhere = array('id=?' => $initialization_id); $app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere); } } $menuidArr = $menumodel->getMenuObjID('/appraisalconfig'); $menuID = $menuidArr[0]['id']; //$result = sapp_Global::logManager($menuID,$actionflag,$loginUserId,$tableid); $appWhere = array('id=?' => $id); $result1 = $appEmpRatingsModel->SaveorUpdateAppraisalSkillsData($appData, $appWhere); if ($result1) { $msg = 'saved'; } else { $msg = 'err'; } } catch (Exception $e) { // echo $e->getMessage(); //echo $e->getTrace(); //echo $e->getTraceAsString(); $msg = "Something went wrong, please try again."; } $this->_helper->json(array('msg' => $msg)); }
public function savemngresponseAction() { $post_values = $this->getRequest()->getPost(); $result = array('status' => 'fail', 'msg' => 'Something went wrong, please try again.'); if (count($post_values) > 0) { if (isset($post_values['hid_employee_id']) && $post_values['hid_employee_id'] != '' && isset($post_values['hid_appraisal_id']) && $post_values['hid_appraisal_id'] != '') { //if($post_values['consol_rating'] != '' && $post_values['consol_comments'] != '') //{ $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserFullName = $auth->getStorage()->read()->userfullname; $loginuserEmail = $auth->getStorage()->read()->emailaddress; $loginuserProfileImg = $auth->getStorage()->read()->profileimg; $loginuserEmpId = $auth->getStorage()->read()->employeeId; $loginuserArr = array('loginuserid' => $loginUserId, 'loginuserrole' => $loginuserRole, 'loginusergroup' => $loginuserGroup); } $model = new Default_Model_Appraisalemployeeratings(); $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings(); $consol_rating = isset($post_values['consol_rating']) && trim($post_values['consol_rating']) != 0 ? $post_values['consol_rating'] : NULL; $consol_comments = isset($post_values['consol_comments']) ? $post_values['consol_comments'] : ''; $employee_id = $post_values['hid_employee_id']; $appraisal_id = $post_values['hid_appraisal_id']; $question_rating = isset($post_values['question_rating']) ? $post_values['question_rating'] : ''; $question_comments = isset($post_values['question_comments']) ? $post_values['question_comments'] : ''; $skill_ids = isset($post_values['emp_skills']) ? $post_values['emp_skills'] : ''; $skill_rating = isset($post_values['skill_rating']) ? $post_values['skill_rating'] : ''; $flag = $post_values['hid_btn_flag']; $ratings_ids_arr = $model->getRatingsByInitId($appraisal_id); $mng_response_arr = array(); $skill_response_arr = array(); $response_json = ''; $skill_json = ''; if (!empty($ratings_ids_arr)) { if (!empty($question_comments)) { foreach ($question_comments as $qid => $qc) { // if($qc!='') $mng_response_arr[$qid]['comment'] = isset($qc) && trim($qc) != '' ? $qc : ''; // if($qid!='' && $question_rating[$qid]!='') $mng_response_arr[$qid]['rating'] = isset($ratings_ids_arr[$question_rating[$qid]]) ? $ratings_ids_arr[$question_rating[$qid]] : ''; } } if (!empty($skill_ids)) { foreach ($skill_ids as $key => $sk_id) { $skill_response_arr[$sk_id] = isset($ratings_ids_arr[$skill_rating[$key]]) ? $ratings_ids_arr[$skill_rating[$key]] : 0; } } } if (!empty($mng_response_arr)) { $response_json = json_encode($mng_response_arr); } if (!empty($skill_response_arr)) { $skill_json = json_encode($skill_response_arr); } $save_data = array('manager_response' => $response_json != '' ? $response_json : NULL, 'skill_response' => $skill_json != '' ? $skill_json : NULL, 'line_comment_1' => $consol_comments, 'line_rating_1' => $consol_rating, 'consolidated_rating' => $consol_rating, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($flag != 'draft') { $line_2_mgr = ''; $appEmpQuesPrivData = $appEmpRatingsModel->getAppEmpQuesPrivData($appraisal_id, $employee_id); $line_2_mgr = $appEmpQuesPrivData[0]['line_manager_2']; if (!isset($line_2_mgr) && $line_2_mgr == '') { $save_data['appraisal_status'] = "Completed"; $mail_sub = "Completed"; // using for mail sending scenario. } else { $save_data['appraisal_status'] = "Pending L2 ratings"; $mail_sub = "Submitted to Line 2 Manager."; } $history_desc = $this->app_history_disc_array[2]; $appHistoryData = array('employee_id' => $employee_id, 'pa_initialization_id' => $appraisal_id, 'description' => $history_desc, 'desc_emp_id' => $loginUserId, 'desc_emp_name' => $loginuserFullName, 'desc_emp_profileimg' => $loginuserProfileImg, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $appHistoryModel = new Default_Model_Appraisalhistory(); $result2 = $appHistoryModel->SaveorUpdateAppraisalHistoryData($appHistoryData); //sending mails and Logsmanager action $menumodel = new Default_Model_Menu(); $tableid = ''; $actionflag = 1; $menuidArr = $menumodel->getMenuObjID('/appraisalself'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); /** Start * Sending Mails to employees */ // Sending mail to Employee $employee_id_str = $employee_id; $app_manager_model = new Default_Model_Appraisalmanager(); if ($line_2_mgr != '' && is_numeric($line_2_mgr)) { $employee_id_str = $employee_id . ',' . $line_2_mgr; } $employeeDetailsArr = $app_manager_model->getUserDetailsByEmpID($employee_id_str); $appraisalratingsmodel = new Default_Model_Appraisalratings(); $appraisal_details = $appraisalratingsmodel->getappdata($appraisal_id); if (!empty($appraisal_details)) { $to_year = $appraisal_details['to_year']; } //Preparing Employee array for Bcc $empArr = array(); if (!empty($employeeDetailsArr)) { $empArrList = ''; $empUserIdArr = array(); $toEmailId = ''; $toEmailName = ''; foreach ($employeeDetailsArr as $emp) { array_push($empArr, $emp['emailaddress']); //preparing Bcc array array_push($empUserIdArr, $emp['user_id']); if ($emp['user_id'] == $employee_id) { $toEmailId = $emp['emailaddress']; $toEmailName = $emp['userfullname']; $toEmpId = $emp['employeeId']; array_pop($empArr); } } //pushing loginUserEmail to Bcc array array_push($empArr, $loginuserEmail); $options['subject'] = APPLICATION_NAME . ': Appraisal ' . $mail_sub; $options['header'] = 'Performance Appraisal : ' . $to_year; $options['toEmail'] = $toEmailId; $options['bcc'] = $empArr; $options['toName'] = $toEmailName; $options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Hi,</span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>{$loginuserFullName}({$loginuserEmpId}) has Updated {$toEmailName}({$toEmpId}) appraisal form. </div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login to your <b>" . APPLICATION_NAME . "</b> account and check the details.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> "; $mail_id = sapp_Global::_sendEmail($options); } } $save_where = " pa_initialization_id ='" . $appraisal_id . "' and employee_id = '" . $employee_id . "' and appraisal_status = 'Pending L1 ratings' "; $save_result = $model->SaveorUpdateAppraisalSkillsData($save_data, $save_where); if ($save_result) { $result = array('status' => 'success', 'msg' => 'Employee appraisal process ' . ($flag == 'draft' ? "drafted" : "submitted") . ' successfully'); } //} } } $this->_helper->json($result); }
public function saveAction() { $auth = Zend_Auth::getInstance(); $loginuserFullName = ''; if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserProfileImg = $auth->getStorage()->read()->profileimg; $loginuserEmail = $auth->getStorage()->read()->emailaddress; $loginuserFullName = $auth->getStorage()->read()->userfullname; $loginUserEmpId = $auth->getStorage()->read()->employeeId; } try { $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings(); $app_init_model = new Default_Model_Appraisalinit(); $id = $this->_request->getParam('id'); $employee_id = $this->_request->getParam('employee_id'); $initialization_id = $this->_request->getParam('initialization_id'); $config_id = $this->_request->getParam('config_id'); $flag = $this->_request->getParam('flag'); $app_status = $this->_request->getParam('app_status'); $mgr_levels = $this->_request->getParam('mgr_levels'); $ratingsData = $appEmpRatingsModel->getAppRatingsDataByConfgId($config_id, $initialization_id); $ratingValues = array(); foreach ($ratingsData as $rd) { $ratingValues[$rd['id']] = $rd['rating_value']; } $appData = array('modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s")); $emp_rating_arr = $this->_request->getParam('emp_rating'); $emp_comment_arr = $this->_request->getParam('emp_comment'); $emp_response = array(); if (sizeof($emp_rating_arr) > 0 || sizeof($emp_comment_arr) > 0) { foreach ($emp_rating_arr as $qid => $val) { if (isset($emp_rating_arr[$qid])) { $rating_id = array_search($emp_rating_arr[$qid], $ratingValues); } else { $rating_id = ''; } $emp_response[$qid] = array('comment' => $emp_comment_arr[$qid], 'rating_id' => $rating_id); } } $appData['employee_response'] = json_encode($emp_response, true); $curent_level = array_search($app_status, $this->app_status_array); if ($flag == 'submit') { $appData['appraisal_status'] = $curent_level + 1; $history_desc = $this->app_history_disc_array[$curent_level]; $appHistoryData = array('employee_id' => $employee_id, 'pa_initialization_id' => $initialization_id, 'description' => $history_desc, 'desc_emp_id' => $loginUserId, 'desc_emp_name' => $loginuserFullName, 'desc_emp_profileimg' => $loginuserProfileImg, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $appHistoryModel = new Default_Model_Appraisalhistory(); $result2 = $appHistoryModel->SaveorUpdateAppraisalHistoryData($appHistoryData); /* Update employee response column */ $appraisaldata = $app_init_model->getConfigData($initialization_id); if ($appraisaldata[0]['employee_response'] == 1) { $initdata = array('employee_response' => 2, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s")); $initwhere = array('id=?' => $initialization_id); $app_init_model->SaveorUpdateAppraisalInitData($initdata, $initwhere); } /* * Logs Storing */ $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $actionflag = 1; $menuidArr = $menumodel->getMenuObjID('/appraisalself'); $menuID = $menuidArr[0]['id']; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); /* * Logs storing ends */ /** Start * Sending Mails to employees */ //to get initialization details using appraisal Id for Business Unit,Department,To Year $appraisalratingsmodel = new Default_Model_Appraisalratings(); $appraisal_details = $appraisalratingsmodel->getappdata($initialization_id); if (!empty($appraisal_details)) { $bunit = $appraisal_details['unitname']; $dept = $appraisal_details['deptname']; $to_year = $appraisal_details['to_year']; } $dept_str = $dept == '' ? " " : "and <b>{$dept}</b> department"; $emp_id_str = $loginuserRole == SUPERADMINROLE ? " " : "({$loginUserEmpId})"; $app_manager_model = new Default_Model_Appraisalmanager(); $getLineManager = $app_manager_model->getLineMgr($initialization_id, $loginUserId); if (!empty($getLineManager)) { $line_mgr = $getLineManager['line_manager_1']; $employeeDetailsArr = $app_manager_model->getUserDetailsByEmpID($line_mgr); $employeeDetailsArr = $employeeDetailsArr[0]; // Sending mail to Manager if (!empty($employeeDetailsArr)) { $options['subject'] = APPLICATION_NAME . ': Self Appraisal Submitted'; $options['header'] = "Performance Appraisal : {$to_year}"; $options['toEmail'] = $employeeDetailsArr['emailaddress']; $options['toName'] = $employeeDetailsArr['userfullname']; $options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Dear " . $employeeDetailsArr['userfullname'] . ",</span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'> " . $loginuserFullName . $emp_id_str . " has submitted appraisal form.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login to <b>" . APPLICATION_NAME . "</b> and check the appraisal ratings and comments.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> "; $mail_id = sapp_Global::_sendEmail($options); } } //Sending mail to Employee $options['subject'] = APPLICATION_NAME . ': Performance Appraisal Submitted to Line1 manager'; $options['header'] = "Performance Appraisal : {$to_year}"; $options['toEmail'] = $loginuserEmail; $options['toName'] = $loginuserFullName; $options['message'] = "<div style='padding: 0; text-align: left; font-size:14px; font-family:Arial, Helvetica, sans-serif;'>\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<span style='color:#3b3b3b;'>Dear {$loginuserFullName},</span><br />\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 0 0;color:#3b3b3b;'>Your appraisal form is submitted successfully to your Line1 Manager," . $employeeDetailsArr['userfullname'] . "(" . $employeeDetailsArr['employeeId'] . ") </div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div style='padding:20px 0 10px 0;'>Please <a href=" . BASE_URL . " target='_blank' style='color:#b3512f;'>click here</a> to login to your <b>" . APPLICATION_NAME . "</b> account.</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t</div> "; $mail_id = sapp_Global::_sendEmail($options); } /** * End */ $appWhere = array('id=?' => $id); $result1 = $appEmpRatingsModel->SaveorUpdateAppraisalSkillsData($appData, $appWhere); if ($result1) { $msg = 'saved'; } else { $msg = 'err'; } } catch (Exception $e) { //echo $e->getMessage(); //echo $e->getTrace(); //echo $e->getTraceAsString(); $msg = "Something went wrong, please try again."; } $this->_helper->json(array('msg' => $msg)); }
public function savemngresponseAction() { $post_values = $this->getRequest()->getPost(); $result = array('status' => 'fail', 'msg' => 'Something went wrong, please try again.'); if (count($post_values) > 0) { if (isset($post_values['hid_employee_id']) && $post_values['hid_employee_id'] != '' && isset($post_values['hid_appraisal_id']) && $post_values['hid_appraisal_id'] != '') { //if($post_values['consol_rating'] != '' && $post_values['consol_comments'] != '') //{ $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; $loginuserFullName = $auth->getStorage()->read()->userfullname; $loginuserProfileImg = $auth->getStorage()->read()->profileimg; $loginuserArr = array('loginuserid' => $loginUserId, 'loginuserrole' => $loginuserRole, 'loginusergroup' => $loginuserGroup); } $model = new Default_Model_Appraisalemployeeratings(); $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings(); $consol_rating = isset($post_values['consol_rating']) && trim($post_values['consol_rating']) != 0 ? $post_values['consol_rating'] : NULL; $consol_comments = isset($post_values['consol_comments']) ? $post_values['consol_comments'] : ''; $employee_id = $post_values['hid_employee_id']; $appraisal_id = $post_values['hid_appraisal_id']; $question_rating = isset($post_values['question_rating']) ? $post_values['question_rating'] : ''; $question_comments = isset($post_values['question_comments']) ? $post_values['question_comments'] : ''; $skill_ids = isset($post_values['emp_skills']) ? $post_values['emp_skills'] : ''; $skill_rating = isset($post_values['skill_rating']) ? $post_values['skill_rating'] : ''; $flag = $post_values['hid_btn_flag']; $ratings_ids_arr = $model->getRatingsByInitId($appraisal_id); $mng_response_arr = array(); $skill_response_arr = array(); $response_json = ''; $skill_json = ''; if (!empty($ratings_ids_arr)) { if (!empty($question_comments)) { foreach ($question_comments as $qid => $qc) { // if($qc!='') $mng_response_arr[$qid]['comment'] = isset($qc) && trim($qc) != '' ? $qc : ''; // if($qid!='' && $question_rating[$qid]!='') $mng_response_arr[$qid]['rating'] = isset($ratings_ids_arr[$question_rating[$qid]]) ? $ratings_ids_arr[$question_rating[$qid]] : ''; } } if (!empty($skill_ids)) { foreach ($skill_ids as $key => $sk_id) { $skill_response_arr[$sk_id] = isset($ratings_ids_arr[$skill_rating[$key]]) ? $ratings_ids_arr[$skill_rating[$key]] : 0; } } } if (!empty($mng_response_arr)) { $response_json = json_encode($mng_response_arr); } if (!empty($skill_response_arr)) { $skill_json = json_encode($skill_response_arr); } $save_data = array('manager_response' => $response_json != '' ? $response_json : NULL, 'skill_response' => $skill_json != '' ? $skill_json : NULL, 'line_comment_1' => $consol_comments, 'line_rating_1' => $consol_rating, 'consolidated_rating' => $consol_rating, 'modifiedby' => $loginUserId, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($flag != 'draft') { $appEmpQuesPrivData = $appEmpRatingsModel->getAppEmpQuesPrivData($appraisal_id, $employee_id); if (!isset($appEmpQuesPrivData[0]['line_manager_2']) && $appEmpQuesPrivData[0]['line_manager_2'] == '') { $save_data['appraisal_status'] = "Completed"; } else { $save_data['appraisal_status'] = "Pending L2 ratings"; } $history_desc = $this->app_history_disc_array[2]; $appHistoryData = array('employee_id' => $employee_id, 'pa_initialization_id' => $appraisal_id, 'description' => $history_desc, 'desc_emp_id' => $loginUserId, 'desc_emp_name' => $loginuserFullName, 'desc_emp_profileimg' => $loginuserProfileImg, 'createdby' => $loginUserId, 'createddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $appHistoryModel = new Default_Model_Appraisalhistory(); $result2 = $appHistoryModel->SaveorUpdateAppraisalHistoryData($appHistoryData); } $save_where = " pa_initialization_id ='" . $appraisal_id . "' and employee_id = '" . $employee_id . "' and appraisal_status = 'Pending L1 ratings' "; $save_result = $model->SaveorUpdateAppraisalSkillsData($save_data, $save_where); if ($save_result) { $result = array('status' => 'success', 'msg' => 'Employee appraisal process ' . ($flag == 'draft' ? "drafted" : "submitted") . ' successfully'); } //} } } $this->_helper->json($result); }