public function getgroupedemployeesAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('getgroupedemployees', 'html')->initContext();
     $employeeIds = '';
     $groupedemployeeIds = '';
     $groupedemployeeList = array();
     $groupid = $this->_request->getParam('groupid');
     $appraisalid = $this->_request->getParam('appraisalid');
     $appraisalinitmodel = new Default_Model_Appraisalgroupemployees();
     $appraisalGroupsModel = new Default_Model_Appraisalgroups();
     if ($groupid && $appraisalid) {
         $appraisaldata = $appraisalinitmodel->getConfigData($appraisalid);
         $appraisaldata = $appraisaldata[0];
         $tablename = 'main_pa_groups_employees_temp';
         /** Start
          * Fetching the employee ids who are being assigned for initialization.
          * Subsequently fetching details of available employee who have not been assigned
          * to any appraisal for display.
          */
         $initializedEmployeeIds = $appraisalinitmodel->getGrouppedEmployeeList($appraisalid, '', $tablename);
         if (!empty($initializedEmployeeIds)) {
             foreach ($initializedEmployeeIds as $list) {
                 $employeeIds .= $list['employee_ids'] . ',';
             }
             $employeeIds = rtrim($employeeIds, ',');
         }
         $employeeList = $appraisalinitmodel->getEmployeeList($appraisaldata, $employeeIds, 1);
         //echo '<pre>';print_r($employeeList);exit;
         /**
          * End
          */
         /** Start
          * Fetching the employee ids of employees who have been assigned to any group.
          * Subsequently fetching the details to display.
          */
         $groupedEmployeeIds = $appraisalinitmodel->getGrouppedEmployeeList($appraisalid, $groupid, $tablename);
         //echo '<pre>';print_r($groupedEmployeeIds);exit;
         if (!empty($groupedEmployeeIds)) {
             foreach ($groupedEmployeeIds as $list) {
                 $groupedemployeeIds .= $list['employee_ids'] . ',';
             }
             $groupedemployeeIds = rtrim($groupedemployeeIds, ',');
             $groupedemployeeList = $appraisalinitmodel->getEmployeeList($appraisaldata, $groupedemployeeIds, 2);
         }
         /**
          * End
          */
         $this->view->employeeList = $employeeList;
         $this->view->groupedemployeeList = $groupedemployeeList;
     }
 }
 public function employeestatusAction()
 {
     $ajaxContext = $this->_helper->getHelper('AjaxContext');
     $ajaxContext->addActionContext('employeestatus', 'html')->initContext();
     $flag = $this->_request->getParam('flag');
     $appraisalid = $this->_request->getParam('appraisalid');
     $department_id = $this->_request->getParam('deptid');
     $businessunit_id = $this->_request->getParam('bunitid');
     $performanceappflag = $this->_request->getParam('perf_app_flag');
     $app_status = $this->_request->getParam('app_status');
     $appqsprivilegesModel = new Default_Model_Appraisalqsmain();
     $appempModel = new Default_Model_Appraisalgroupemployees();
     $appInitModel = new Default_Model_Appraisalinit();
     $empratingsModel = new Default_Model_Appraisalemployeeratings();
     $employeeIds = '';
     $msgarray = array();
     $employeeArr = array();
     $getEmployeeRatingsArr = array();
     $errorMsg = '';
     $budeptArr = array();
     if ($flag == 1) {
         if ($appraisalid) {
             $getEmployeeRatingsArr = $empratingsModel->getEmployeeIds($appraisalid, '', $app_status);
             if (!empty($getEmployeeRatingsArr)) {
                 foreach ($getEmployeeRatingsArr as $ids) {
                     $employeeIds .= $ids['employee_id'] . ',';
                 }
                 $employeeIds = rtrim($employeeIds, ',');
             }
             if ($employeeIds != '') {
                 $employeedetailsArr = $appempModel->getEmployeeList(array(), $employeeIds, 2);
             }
             if (!empty($employeedetailsArr)) {
                 foreach ($employeedetailsArr as $key => $val) {
                     $employeeArr[$val['user_id']] = $val;
                 }
             }
             //$budeptArr = $this->getbudeptname($appraisalid);
             $budeptArr = sapp_Global::getbudeptname($appraisalid);
         }
     } else {
         $checkActiveApp = $appInitModel->checkAppraisalExists($businessunit_id, $department_id, $performanceappflag);
         if (count($checkActiveApp) > 0) {
             $checkActiveApp = $checkActiveApp[0];
             if ($checkActiveApp['enable_step'] == 2 && $checkActiveApp['status'] == 1) {
                 $appraisalid = $checkActiveApp['id'];
                 $getEmployeeRatingsArr = $empratingsModel->getEmployeeIds($checkActiveApp['id'], '', $app_status);
                 if (!empty($getEmployeeRatingsArr)) {
                     foreach ($getEmployeeRatingsArr as $ids) {
                         $employeeIds .= $ids['employee_id'] . ',';
                     }
                     $employeeIds = rtrim($employeeIds, ',');
                 }
                 if ($employeeIds != '') {
                     $employeedetailsArr = $appempModel->getEmployeeList(array(), $employeeIds, 2);
                 }
                 if (!empty($employeedetailsArr)) {
                     foreach ($employeedetailsArr as $key => $val) {
                         $employeeArr[$val['user_id']] = $val;
                     }
                 }
             } else {
                 if ($checkActiveApp['enable_step'] == 1) {
                     $errorMsg = 'Appraisal process is enabled to managers.';
                 }
                 if ($checkActiveApp['status'] == 2) {
                     $errorMsg = 'Appraisal process is closed.';
                 }
             }
             //$budeptArr = $this->getbudeptname($checkActiveApp['id']);
             $budeptArr = sapp_Global::getbudeptname($checkActiveApp['id']);
         } else {
             $errorMsg = 'Appraisal process is not yet configured.';
         }
     }
     $this->view->flag = $flag;
     $this->view->msgarray = $msgarray;
     $this->view->ermsg = $errorMsg;
     $this->view->employeeArr = $employeeArr;
     $this->view->employeeratingsArr = $getEmployeeRatingsArr;
     $this->view->appraisalid = $appraisalid;
     $this->view->budeptArr = $budeptArr;
 }