예제 #1
0
 /**
  ** get individual 
  **/
 public function getselectedappraisaldataAction()
 {
     try {
         $appId = $this->_request->getParam('appId');
         $empId = $this->_request->getParam('empId');
         $empAppraisalData = "";
         $questionsData = "";
         $categoriesData = "";
         $empData = "";
         $ratingsData = "";
         if ($appId && $empId) {
             $empAppraisalModel = new Default_Model_Appraisalemployeeratings();
             $empAppraisals = $empAppraisalModel->getSelectedAppraisalData($appId, $empId);
             $configId = isset($empAppraisals[0]['pa_configured_id']) ? $empAppraisals[0]['pa_configured_id'] : 0;
             // get rating details using configuration id
             $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings();
             $ratingsData = $appEmpRatingsModel->getAppRatingsDataByConfgId($configId, $appId);
             $ratingType = "";
             if (!empty($ratingsData)) {
                 $ratingType = $ratingsData[0]['rating_type'];
             }
             $ratingText = array();
             $ratingTextDisplay = array();
             $ratingValues = array();
             foreach ($ratingsData as $rd) {
                 $ratingText[] = $rd['rating_text'];
                 $ratingTextDisplay[$rd['id']] = $rd['rating_text'];
                 $ratingValues[$rd['id']] = $rd['rating_value'];
             }
             //$empAppraisalData = $empAppraisalModel->getEmpQuestionsData($appId,$empId);
             if (!empty($empAppraisals)) {
                 if (!empty($empAppraisals[0]['employee_response'])) {
                     $empResponse = json_decode($empAppraisals[0]['employee_response']);
                     $empResponseArray = get_object_vars($empResponse);
                     $strQuestionIds = implode(",", array_keys($empResponseArray));
                     $questionsData = $empAppraisalModel->getQuestionsData($strQuestionIds);
                     $tmpRatingIdsObject = array_values($empResponseArray);
                     $tmpRatingIdsArr = array();
                     foreach ($tmpRatingIdsObject as $ratingArr) {
                         $tmpRatings = get_object_vars($ratingArr);
                         $tmpRatingIdsArr[] = $tmpRatings['rating_id'];
                     }
                     if (!empty($empAppraisals[0]['manager_response'])) {
                         $managerResponse = json_decode($empAppraisals[0]['manager_response']);
                         $managerResponseArray = get_object_vars($managerResponse);
                         $managerRatingIdsObject = array_values($managerResponseArray);
                         foreach ($managerRatingIdsObject as $ratingArr) {
                             $tmpRatings = get_object_vars($ratingArr);
                             $tmpRatingIdsArr[] = $tmpRatings['rating'];
                         }
                     }
                     $tmpRatingIdsStr = !empty($tmpRatingIdsArr) ? implode(",", $tmpRatingIdsArr) : "";
                     if (!empty($tmpRatingIdsStr)) {
                         $ratingsData = $empAppraisalModel->getRatingsData($tmpRatingIdsStr);
                     }
                     if (!empty($ratingsData)) {
                         $r = 0;
                         foreach ($ratingsData as $rdata) {
                             $ratingsData[$rdata['id']] = $rdata;
                             unset($ratingsData[$r]);
                             $r++;
                         }
                     }
                 }
                 $strCategories = $empAppraisals[0]['category_id'];
                 $categoriesData = $empAppraisalModel->getCategories($strCategories);
                 /** for getting line managers name, business unit, department details
                 					**
                 					$strEmpId = $empId.',';
                 
                 					if(!empty($empAppraisals[0]['line_manager_1']))
                 					{
                 							$strEmpId .= $empAppraisals[0]['line_manager_1'];
                 							$strEmpId .= ',';
                 					}
                 					if(!empty($empAppraisals[0]['line_manager_2']))
                 					{
                 						$strEmpId .= $empAppraisals[0]['line_manager_2'];
                 						$strEmpId .= ',';
                 					}
                 					if(!empty($empAppraisals[0]['line_manager_3']))
                 					{
                 						$strEmpId .= $empAppraisals[0]['line_manager_3'];
                 						$strEmpId .= ',';
                 					}
                 					if(!empty($empAppraisals[0]['line_manager_4']))
                 					{
                 						$strEmpId .= $empAppraisals[0]['line_manager_4'];
                 						$strEmpId .= ',';
                 					}
                 					if(!empty($empAppraisals[0]['line_manager_5']))
                 					{
                 						$strEmpId .= $empAppraisals[0]['line_manager_5'];
                 						$strEmpId .= ',';
                 					}
                 					
                 					$strEmpId = trim($strEmpId,",");
                 					$empData = $empAppraisalModel->getEmployeeData($strEmpId);
                 					**/
             }
         }
         $this->view->selectedAppraisals = $empAppraisals;
         $this->view->categoriesData = $categoriesData;
         $this->view->empData = $empData;
         $this->view->questionsData = $questionsData;
         $this->view->ratingsData = $ratingsData;
         $this->view->ratingType = $ratingType;
         $this->view->ratingTextDisplay = $ratingTextDisplay;
         $this->view->ratingText = json_encode($ratingText);
         $this->view->ratingValues = $ratingValues;
     } catch (Exception $e) {
         print_r($e);
     }
 }
 /**
  ** get individual 
  **/
 public function getselectedappraisaldataAction()
 {
     try {
         $appId = $this->_request->getParam('appId');
         $empId = $this->_request->getParam('empId');
         $period = $this->_request->getParam('period');
         $empAppraisalData = "";
         $questionsData = "";
         $categoriesData = "";
         $empData = "";
         $ratingsData = "";
         $empAppraisals = array();
         $ratingType = "";
         $ratingText = array();
         $ratingTextDisplay = array();
         $ratingValues = array();
         if ($appId && $empId && $period) {
             $empAppraisalModel = new Default_Model_Appraisalemployeeratings();
             $empAppraisals = $empAppraisalModel->getSelectedAppraisalData($appId, $empId, $period);
             $configId = isset($empAppraisals[0]['pa_configured_id']) ? $empAppraisals[0]['pa_configured_id'] : 0;
             // get rating details using configuration id
             $appEmpRatingsModel = new Default_Model_Appraisalemployeeratings();
             $ratingsData = $appEmpRatingsModel->getAppRatingsDataByConfgId($configId, $appId);
             if (!empty($ratingsData)) {
                 $ratingType = $ratingsData[0]['rating_type'];
             }
             foreach ($ratingsData as $rd) {
                 $ratingText[] = $rd['rating_text'];
                 $ratingTextDisplay[$rd['id']] = $rd['rating_text'];
                 $ratingValues[$rd['id']] = $rd['rating_value'];
             }
             if (!empty($empAppraisals)) {
                 if (!empty($empAppraisals[0]['employee_response'])) {
                     $empResponse = json_decode($empAppraisals[0]['employee_response']);
                     $empResponseArray = get_object_vars($empResponse);
                     $strQuestionIds = implode(",", array_keys($empResponseArray));
                     $questionsData = $empAppraisalModel->getQuestionsData($strQuestionIds);
                     $tmpRatingIdsObject = array_values($empResponseArray);
                     $tmpRatingIdsArr = array();
                     foreach ($tmpRatingIdsObject as $ratingArr) {
                         $tmpRatings = get_object_vars($ratingArr);
                         $tmpRatingIdsArr[] = $tmpRatings['rating_id'];
                     }
                     if (!empty($empAppraisals[0]['manager_response'])) {
                         $managerResponse = json_decode($empAppraisals[0]['manager_response']);
                         $managerResponseArray = get_object_vars($managerResponse);
                         $managerRatingIdsObject = array_values($managerResponseArray);
                         foreach ($managerRatingIdsObject as $ratingArr) {
                             $tmpRatings = get_object_vars($ratingArr);
                             $tmpRatingIdsArr[] = $tmpRatings['rating'];
                         }
                     }
                     $tmpRatingIdsStr = !empty($tmpRatingIdsArr) ? implode(",", $tmpRatingIdsArr) : "";
                     if (!empty($tmpRatingIdsStr)) {
                         $ratingsData = $empAppraisalModel->getRatingsData($tmpRatingIdsStr);
                     }
                     if (!empty($ratingsData)) {
                         $r = 0;
                         foreach ($ratingsData as $rdata) {
                             $ratingsData[$rdata['id']] = $rdata;
                             unset($ratingsData[$r]);
                             $r++;
                         }
                     }
                 }
                 $strCategories = $empAppraisals[0]['category_id'];
                 $categoriesData = $empAppraisalModel->getCategories($strCategories);
             }
         }
         $appSkillsModel = new Default_Model_Appraisalskills();
         $skills = array();
         $skills = $appSkillsModel->getAppraisalSkillsData();
         $skills_arr = array();
         foreach ($skills as $skill) {
             $skills_arr[$skill['id']] = $skill;
         }
         $this->view->skills_arr = $skills_arr;
         $this->view->selectedAppraisals = $empAppraisals;
         $this->view->categoriesData = $categoriesData;
         $this->view->empData = $empData;
         $this->view->questionsData = $questionsData;
         $this->view->ratingsData = $ratingsData;
         $this->view->ratingType = $ratingType;
         $this->view->ratingTextDisplay = $ratingTextDisplay;
         $this->view->ratingText = json_encode($ratingText);
         $this->view->ratingValues = $ratingValues;
         $this->view->appraisalId = $appId;
     } catch (Exception $e) {
         print_r($e);
     }
 }