/** * Returns the list as a string * @param array $data * @return string */ public function get($sql, mysql_connection $db = null) { if (!isset($db)) { if (function_exists('db')) { $db = db(); } else { throw new Exception('No Database given.'); } } $pagination = new data_pagination($this->link, $this->pagesize, $this->prefix); $res = $pagination->query($sql); $pagination = $pagination->get(); $content = $pagination . $this . $this->header() . '<tbody>'; foreach ($res as $row) { $content .= $this->row($row); } return $content . '</tbody></table>' . $pagination; }
public function showThread(forum_thread $thread) { /** @var rights_container $rights */ $rights = iv::get('rights'); $user = iv::get('user'); $board = $thread->loadBoard(); $flags = $rights->flags('forum', $board->id); if (!$board->public_read && !$rights->has('forum', $board->id)) { throw new Exception('Sie haben keinen Zugriff auf dieses Forum!'); } $thread->markRead(); $pagination = new data_pagination(new html_link(PAGE_SELF . '&thread=' . $thread->id), 25, 'thread_'); $this->context['postings'] = $pagination->query("SELECT p.*, u.name as user_name, u.id as user_id, u.email as user_email\n\t\t\tFROM forum_post p LEFT JOIN user_data u ON u.id = p.create_by\n\t\t\tWHERE p.thread = %d ORDER BY id", $thread->id)->assocs(); $this->context['author'] = db()->user_data->row($thread->create_by)->assoc(); $this->context['breadcrumb'] = $board->breadcrumb(); $this->context['thread'] = $thread; $this->context['reply'] = $user && (!$thread->closed || $flags['moderate']) && ($board->public_reply || $flags['reply']); $this->context['moderate'] = $flags['moderate']; $this->context['user'] = $user; $this->context['pagination'] = $pagination->get(); template('forum/thread')->display($this->context); }