public function view() {
extract(Message::aliases());
$date = $this->request->date;
$channel = $this->request->channel;
$baseUrl = array('library' => 'li3_bot', 'controller' => 'logs');
$breadcrumbs[] = array(
'title' => $t('Channels'),
'url' => $baseUrl + array('action' => 'index')
);
$breadcrumbs[] = array(
'title' => "#{$channel}",
'url' => $baseUrl + array('action' => 'index') + compact('channel')
);
$breadcrumbs[] = array(
'title' => $date,
'url' => null
);
$channels = Log::find('all');
$log = Log::read($channel, $date);
$previous = date('Y-m-d', strtotime($date) - (60 * 60 * 24));
$next = date('Y-m-d', strtotime($date) + (60 * 60 * 24));
if (!Log::exists($channel, $previous)) {
$previous = null;
}
if (!Log::exists($channel, $next)) {
$next = null;
}
return compact('channels', 'channel', 'log', 'date', 'breadcrumbs', 'previous', 'next');
}