/** * Retrieved list of objects base on a given parameters - dynamic method: list_PaForum() * * * Generated with the DalClassGenerator created by: * Zoran Hron <*****@*****.**> * * @param conditionalStatement = null * @param orderby = null * @param sort = null * @param limit = 0 * @param fetchmode = DB_FETCHMODE_OBJECT * @result array of objects: PaForum **/ public function list_PaForum($conditionalStatement = null, $orderby = null, $sort = null, $limit = 0, $fetchmode = DB_FETCHMODE_OBJECT) { $this->initialize($conditionalStatement, $orderby, $sort); // build MySQL query $sql = "SELECT * FROM { pa_forum } "; if ($conditionalStatement) { $sql .= "WHERE {$conditionalStatement}"; } if ($orderby) { $sql .= " ORDER BY {$orderby}"; } if ($sort) { $sql .= " {$sort}"; } if ($limit) { $sql .= " LIMIT {$limit}"; } $sql .= ";"; // execute query $res = Dal::query($sql); $objects = array(); // data found? if ($res->numRows() > 0) { // retrieve data objects while ($row = $res->fetchRow($fetchmode)) { if ($fetchmode == DB_FETCHMODE_OBJECT) { $obj = new PaForum(); $obj->populateFromObject($row); $objects[] = $obj; } else { $objects[] = $row; } } } return $objects; }
private function setForum($forum_id, $request_data, $render = true) { $threads = array(); $current_page = !empty($request_data['page']) ? $request_data['page'] : 0; $forum = PaForum::getPaForum($forum_id); if ($forum) { $this->forum = $forum; $this->current_page = $current_page; $threads = array(); $board = $forum->getBoard(); $this->setupBoard($board); $this->user_status = $this->checkUser($request_data); $threads_pagging = $this->board_settings['threads_per_page']; $forum->statistics = $forum->getForumStatistics($threads_pagging, $current_page); if (!empty($forum->statistics['threads'])) { $threads = $forum->statistics['threads']; } } if ($render && $this->forum) { $this->set_inner_template('cnmodule_content_forum_threads.php'); $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'forum' => $forum, 'threads' => $threads, 'current_page' => $current_page, 'forums_url' => $this->forums_url, 'theme_url' => $this->theme_url, 'user_status' => $this->user_status, 'message' => $this->message, 'description' => $this->forum->get_description(), 'board' => $this->board, 'board_settings' => $this->board_settings)); } }
public function getBoard() { $this->forum = PaForum::getPaForum($this->forum_id); $this->board = $this->forum->getBoard(); return $this->board; }
public function getForums() { $forums = array(); $conditionalStatement = "category_id = {$this->id} AND is_active = 1"; $orderby = "created_at"; $sort = "DESC"; $forums = PaForum::listPaForum($conditionalStatement, $orderby, $sort); return $forums; }