public function executeIndex(sfWebRequest $request) { $staffs = Staff::fetchAllIds(); $tl = new TimeLog(); foreach ($staffs as $staff) { $time_log = $tl->getLastByStaffId($staff['id']); if ($time_log) { $time_logs[] = $time_log; } } $this->time_logs = $time_logs; }
/** * Executes index action * * @param sfRequest $request A request object */ public function executeIndex(sfWebRequest $request) { $total = null; $params = array(); if ($request->isMethod(sfRequest::POST)) { $tl = new TimeLog(); $params = array('staff_id' => $request->getParameter('staff_id'), 'from' => $request->getParameter('from'), 'until' => $request->getParameter('until')); $from_date = $params['from']; $until_date = $params['until']; $from = $this->convertParamToDatetime($from_date); $until = $this->convertParamToDatetime($until_date); $result = $tl->getByStaffIdBetween($params['staff_id'], $from, $until); } @($this->total = $result['total']); @($this->records = $result['list']); $this->form = new TimeQueryForm(array(), array('params' => $params)); }
public static function addToProject($client, $project_id, $comment, $hours, $other_data = null) { TimeLog::add($client, $project_id, $hours, $comment, true); }
public function getTotalTime() { $tl = new TimeLog(); return $tl->getTotalByStaffId($this->id); }