public function setReportCriteriaInfoInRequest($formValues)
 {
     $employeeService = new EmployeeService();
     $jobService = new JobService();
     $empStatusService = new EmploymentStatusService();
     $companyStructureService = new CompanyStructureService();
     if (isset($formValues["employee"])) {
         $empNumber = $formValues["employee"];
         $employee = $employeeService->getEmployee($empNumber);
         $empName = $employee->getFirstAndLastNames();
         $this->getRequest()->setParameter('empName', $empName);
     }
     if (isset($formValues["employment_status"]) && $formValues["employment_status"] != 0) {
         $estatCode = $formValues["employment_status"];
         $estat = $empStatusService->getEmploymentStatusById($estatCode);
         $estatName = $estat->getName();
         $this->getRequest()->setParameter("empStatusName", $estatName);
     }
     if (isset($formValues["job_title"]) && $formValues["job_title"] != 0) {
         $jobTitCode = $formValues["job_title"];
         $jobTitle = $jobService->readJobTitle($jobTitCode);
         $jobTitName = $jobTitle->getJobTitName();
         $this->getRequest()->setParameter("jobTitName", $jobTitName);
     }
     if (isset($formValues["sub_unit"]) && $formValues["job_title"] != 0) {
         $value = $formValues["sub_unit"];
         $id = $value;
         $subunit = $companyStructureService->getSubunitById($id);
         $subUnitName = $subunit->getName();
         $this->getRequest()->setParameter("subUnit", $subUnitName);
     }
     $this->getRequest()->setParameter('attendanceDateRangeFrom', $formValues["attendance_date_range"]["from"]);
     $this->getRequest()->setParameter('attendanceDateRangeTo', $formValues["attendance_date_range"]["to"]);
 }
Example #2
0
 /**
  * Get employee statuses for given jobTitle
  *
  * @param sfWebRequest $request
  * @return JSON formatted JobSpec object
  */
 public function executeGetEmpStatusesJson(sfWebRequest $request)
 {
     $this->setLayout(false);
     sfConfig::set('sf_web_debug', false);
     sfConfig::set('sf_debug', false);
     $empStatuses = array();
     if ($this->getRequest()->isXmlHttpRequest()) {
         $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8');
     }
     $jobId = $request->getParameter('job');
     if (!empty($jobId)) {
         $jobService = new JobService();
         $empStatuses = $jobService->getEmployeeStatusForJob($jobId, true);
     }
     return $this->renderText(json_encode($empStatuses));
 }