public function view() { $date = $this->request->date; $channel = '#' . $this->request->channel; $year = date('Y', strtotime($date)); if (!in_array($channel, LogMessages::channels())) { throw new Exception('Unknown channel.'); } $baseUrl = array('library' => 'li3_bot', 'controller' => 'logs'); $breadcrumbs[] = array('title' => 'Channel Logs', 'url' => $baseUrl + array('action' => 'channels')); $breadcrumbs[] = array('title' => $channel, 'url' => null); $breadcrumbs[] = array('title' => $year, 'url' => array('library' => 'li3_bot', 'controller' => 'logs', 'action' => 'index', 'channel' => ltrim($channel, '#')) + compact('year')); $breadcrumbs[] = array('title' => date('m/d', strtotime($date)), 'url' => null); $messages = LogMessages::day($channel, $date); $previous = date('Y-m-d', strtotime($date) - 60 * 60 * 24); $next = date('Y-m-d', strtotime($date) + 60 * 60 * 24); if (!LogMessages::hasDay($channel, $previous)) { $previous = null; } if (!LogMessages::hasDay($channel, $next)) { $next = null; } $rewriters = Libraries::get('li3_bot', 'rewriters'); return compact('channel', 'messages', 'date', 'breadcrumbs', 'previous', 'next', 'rewriters'); }