public function day($tool_id, $date) { if (empty($date)) { Event::run('system.404'); } $date = explode('-', $date); # strictly need the formated date, else throw page not found. if (3 != count($date)) { Event::run('system.404'); } list($year, $month, $day) = $date; valid::year($year); valid::month($month); valid::day($day); $events = ORM::factory('calendar_item')->where(array('fk_site' => $this->site_id, 'calendar_id' => $tool_id, 'year' => $year, 'month' => $month, 'day' => $day))->find_all(); $primary = new View('public_calendar/small/day'); $primary->events = $events; $primary->date = "{$year} {$month} {$day}"; $primary->logged_in = $this->client->can_edit($this->site_id) ? TRUE : FALSE; return $primary; }