private function getHours() { $hours_cc = new ConstraintChain(); if (empty($this->_data['week_ending'])) { $this->_data['week_ending'] = date(DATE_FORMAT, strtotime('friday')); } $hours_cc->add(new Constraint('start_time', '<=', fix_date($this->_data['week_ending']))); $hours_cc->add(new Constraint('start_time', '>', date('Y-m-d', strtotime('last monday', strtotime(fix_date($this->_data['week_ending'])))))); if (!isModuleAdmin()) { $hours_cc->add(new Constraint('owner', '=', EGS_USERNAME)); } else { if (!empty($this->_data['username'])) { $hours_cc->add(new Constraint('owner', '=', $this->_data['username'])); } } if (!empty($this->_data['project_id'])) { $hours_cc > add(new Constraint('project_id', '=', $this->_data['project_id'])); //for a single project } $hours = Hour::getForTimesheet($hours_cc); return $hours; }