/** * * @param <type> $request * @return <type> */ public function execute($request) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); sfConfig::set('sf_debug', false); if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); } $workShiftId = $request->getParameter('id'); $service = new WorkShiftService(); $workShift = $service->getWorkShiftById($workShiftId); return $this->renderText(json_encode($workShift->toArray())); }
/** * * @param <type> $request * @return <type> */ public function execute($request) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); sfConfig::set('sf_debug', false); if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); } $workShiftId = $request->getParameter('id'); $service = new WorkShiftService(); $workShift = $service->getWorkShiftById($workShiftId); $workShiftFields = array('id' => $workShift->getId(), 'name' => $workShift->getName(), 'hoursPerDay' => $workShift->getHoursPerDay(), 'start_time' => date('H:i', strtotime($workShift->getStartTime())), 'end_time' => date('H:i', strtotime($workShift->getEndTime()))); return $this->renderText(json_encode($workShiftFields)); }
/** * * @param <type> $request * @return <type> */ public function execute($request) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); sfConfig::set('sf_debug', false); if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); } $workShiftId = $request->getParameter('id'); $service = new WorkShiftService(); $workShiftList = $service->getWorkShiftEmployeeListById($workShiftId); $list = array(); foreach ($workShiftList as $workShift) { $list[] = array('empNo' => $workShift->getEmpNumber(), 'empName' => $workShift->getEmployee()->getFullName()); } return $this->renderText(json_encode($list)); }
/** * * @param <type> $request * @return <type> */ public function execute($request) { $this->setLayout(false); sfConfig::set('sf_web_debug', false); sfConfig::set('sf_debug', false); if ($this->getRequest()->isXmlHttpRequest()) { $this->getResponse()->setHttpHeader('Content-Type', 'application/json; charset=utf-8'); } $workShiftId = $request->getParameter('id'); $service = new WorkShiftService(); $employeeNameList = $service->getWorkShiftEmployeeNameListById($workShiftId); $list = array(); foreach ($employeeNameList as $employee) { $empNumber = $employee['empNumber']; $name = trim(trim($employee['firstName'] . ' ' . $employee['middleName'], ' ') . ' ' . $employee['lastName']); $list[] = array('empNo' => $empNumber, 'empName' => $name); } return $this->renderText(json_encode($list)); }