public function executeEmployeeWorkload(sfWebRequest $request) { $this->form = new ReportWorkloadForm(); if ($request->isMethod('post') || $request->getParameter('employee_id')) { if ($request->isMethod('post')) { $form = $request->getParameter('workload'); $employee_id = $form['employee_id']; } else { $employee_id = $request->getParameter('employee_id'); } $this->employee = EmployeePeer::retrieveByPk($employee_id); $this->forward404Unless($this->employee); $this->current_services_total = 0; $this->future_services_total = 0; $this->current_services = ClientServicePeer::getActiveForEmployee($this->employee->getId()); foreach ($this->current_services as $current_service) { if ($frequency = $current_service->getFrequency()) { $this->current_services_total += $frequency->getWeeklyHours(); } } $this->future_services = ClientServicePeer::getUpcomingForEmployee($this->employee->getId()); foreach ($this->future_services as $future_service) { if ($frequency = $future_service->getFrequency()) { $this->future_services_total += $frequency->getWeeklyHours(); } } $this->setTemplate('employeeWorkloadReport'); } }