/** * Get Employee List As Json * This function should be available in EmployeeService, not here * Due to backward compatibility temporarily its made available. referencing places need to be pointed to employee service * and this should be removed */ public function getEmployeeListAsJson() { try { $employeeService = new EmployeeService(); return $employeeService->getEmployeeListAsJson(); } catch (Exception $e) { throw new AdminServiceException($e->getMessage()); } }
public function getEmployeeListAsJson() { $employeeService = new EmployeeService(); return $employeeService->getEmployeeListAsJson(); }
/** * Handles showing review search form and * listing searched reviews. */ public function executeViewReview(sfWebRequest $request) { $performanceReviewService = $this->getPerformanceReviewService(); /* Job title list */ $this->jobList = $this->getJobTitleService()->getJobTitleList("", "", false); /* Employee list */ if ($this->loggedAdmin) { $employeeService = new EmployeeService(); $this->empJson = $employeeService->getEmployeeListAsJson(); } elseif ($this->loggedReviewer) { $this->empJson = $performanceReviewService->getRevieweeListAsJson($this->loggedEmpId, true); } /* Showing Performance Review Search form * ====================================== */ $this->form = new ViewReviewForm(array(), array('empJson' => $this->empJson), true); /* Subdivision list */ $compStructure = new CompanyStructureService(); $treeObject = $compStructure->getSubunitTreeObject(); $this->tree = $treeObject->fetchTree(); /* Checking whether a newly invoked search form */ $newSearch = false; if ($request->getParameter('mode') == 'new') { $newSearch = true; } /* Preserving search clues */ $hdnEmpId = $request->getParameter("hdnEmpId"); if (isset($hdnEmpId) && !$newSearch) { // If the user has performed a new search $this->clues = $this->getReviewSearchClues($request); } else { if ($this->getUser()->hasAttribute('prSearchClues') && !$newSearch) { $this->clues = $this->getUser()->getAttribute('prSearchClues'); } if ($this->getUser()->hasFlash('prClues') && !$newSearch) { $this->clues = $this->getUser()->getFlash('prClues'); } } /* Processing reviews * ================== */ if ($request->isMethod('post')) { $page = 1; $this->clues['pageNo'] = 1; } elseif ($request->getParameter('page')) { $page = $request->getParameter('page'); $this->clues['pageNo'] = $page; } elseif ($this->clues['pageNo']) { $page = $this->clues['pageNo']; } /* Preserving search clues */ if (!isset($this->clues)) { $this->clues = $this->getReviewSearchClues($request); } $this->getUser()->setAttribute('prSearchClues', $this->clues); /* Checking whether wrong seacrch criteria */ if (!$this->_isCorrectEmployee($this->clues['empId'], $this->clues['empName']) || !$this->_isCorrectEmployee($this->clues['reviewerId'], $this->clues['reviewerName'])) { $this->templateMessage = array('WARNING', __(TopLevelMessages::NO_RECORDS_FOUND)); return; } /* Setting logged in user type */ if (!$this->loggedAdmin && $this->loggedReviewer) { $this->clues['loggedReviewerId'] = $this->loggedEmpId; } elseif (!$this->loggedAdmin && !$this->loggedReviewer) { $this->clues['loggedEmpId'] = $this->loggedEmpId; } /* Pagination */ if (!isset($page)) { $page = 1; } $this->pager = new SimplePager('PerformanceReview', sfConfig::get('app_items_per_page')); $this->pager->setPage($page); $this->pager->setNumResults($performanceReviewService->countReviews($this->clues)); $this->pager->init(); /* Fetching reviews */ $offset = $this->pager->getOffset(); $offset = empty($offset) ? 0 : $offset; $limit = $this->pager->getMaxPerPage(); $this->reviews = $performanceReviewService->searchPerformanceReview($this->clues, $offset, $limit); /* Setting template message */ if ($this->getUser()->hasFlash('templateMessage')) { $this->templateMessage = $this->getUser()->getFlash('templateMessage'); } elseif (count($this->reviews) == 0) { $this->templateMessage = array('WARNING', __(TopLevelMessages::NO_RECORDS_FOUND)); } }