/**
*/
protected function _content()
{
/* Return empty if we don't have a thread set. */
if (empty($this->_params['thread_id'])) {
return '';
}
/* Set up the message object. */
list($forum_id, $message_id) = explode('.', $this->_params['thread_id']);
$messages = $GLOBALS['injector']->getInstance('Agora_Factory_Driver')->create('agora', $forum_id);
/* Check if valid thread, otherwise show forum list. */
if ($messages instanceof PEAR_Error || empty($messages)) {
throw new Horde_Exception(_("Unable to fetch selected thread."));
}
/* Get the sorting. */
$sort_by = Agora::getSortBy('threads');
$sort_dir = Agora::getSortDir('threads');
$view_bodies = $GLOBALS['prefs']->getValue('thread_view_bodies');
/* Get the message array and the sorted thread list. */
$threads_list = $messages->getThreads($messages->getThreadRoot($message_id), true, $sort_by, $sort_dir, $view_bodies, Horde::selfUrl());
/* Set up the column headers. */
$col_headers = array(array('message_thread' => _("Thread"), 'message_subject' => _("Subject")), 'message_author' => _("Posted by"), 'message_timestamp' => _("Date"));
$col_headers = Agora::formatColumnHeaders($col_headers, $sort_by, $sort_dir, 'threads');
/* Set up the template tags. */
$view = new Agora_View();
$view->col_headers = $col_headers;
$view->threads_list = $threads_list;
$view->threads_list_header = _("Thread List");
$view->thread_view_bodies = $view_bodies;
return $view->render('block/thread');
}