private function getBoardsInfo()
 {
     $boards_info = array();
     $this->nid = isset($this->shared_data['network_id']) ? $this->shared_data['network_id'] : PA::$network_info->network_id;
     $boards = PaForumBoard::listPaForumBoard("network_id = {$this->nid} AND is_active = 1", 'type', 'ASC', 10);
     if (count($boards) > 0) {
         for ($i = 0; $i < count($boards); $i++) {
             $title = $boards[$i]->get_title();
             $type = $boards[$i]->get_type();
             $boards_info[$i]['title'] = strlen($title) <= self::max_title_length ? $title : substr($title, 0, self::max_title_length + 3) . '...';
             $boards_info[$i]['type'] = $type;
             $net_id = $boards[$i]->get_network_id();
             if (Network::is_mother_network($net_id)) {
                 $address = 'www';
             } else {
                 $network = Network::get_by_id((int) $net_id);
                 $address = $network->address;
             }
             $url = "http://{$address}." . PA::$domain_suffix . PA_ROUTE_FORUMS . "/network_id=" . $net_id;
             switch ($type) {
                 case PaForumBoard::network_board:
                     break;
                 case PaForumBoard::group_board:
                     $url .= "&gid=" . $boards[$i]->get_owner_id();
                     break;
                 case PaForumBoard::personal_board:
                     $url .= "&user_id=" . $boards[$i]->get_owner_id();
                     break;
             }
             $boards_info[$i]['url'] = $url;
         }
     }
     return $boards_info;
 }
 private function getDefaultBoard($request_data)
 {
     $board = null;
     $this->parent_id = PA::$network_info->network_id;
     $this->nid = PA::$network_info->network_id;
     $this->forums_url = PA::$url . "/forums/network_id={$this->nid}";
     $this->board_type = PaForumBoard::network_board;
     $boards = PaForumBoard::listPaForumBoard("owner_id = {$this->parent_id} AND network_id = {$this->nid} AND type = '{$this->board_type}' AND is_active = 1");
     if (count($boards) > 0) {
         $board = $boards[0];
     }
     return $board;
 }
 /**
  * Delete an existing record - dynamic method: delete_PaForumsUsers()
  *
  *
  * Generated with the DalClassGenerator created by: 
  * Zoran Hron <*****@*****.**> 
  *
  * @param user_id
  * @result void
  **/
 public function delete_PaForumsUsers($user_id)
 {
     PaForumBoard::delete_UserBoards($user_id);
     PaForumThread::delete_ThreadsForUser($user_id);
     PaForumPost::delete_PostsForUser($user_id);
     // sql query
     $sql = "UPDATE { pa_forums_users } SET is_active = 0 WHERE user_id = ?;";
     $params = array($user_id);
     // performs deletion of data
     $res = Dal::query($sql, $params);
 }
 /**
  * Retrieved list of objects base on a given parameters - dynamic method: list_PaForumBoard()
  *
  *
  * 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: PaForumBoard
  **/
 public function list_PaForumBoard($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_board } ";
     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 PaForumBoard();
                 $obj->populateFromObject($row);
                 $objects[] = $obj;
             } else {
                 $objects[] = $row;
             }
         }
     }
     return $objects;
 }
 private function buildBoard(PaForumBoard $board)
 {
     $bstat = $board->getBoardStatistics();
     $categories = $bstat['categories'];
     $this->set_inner_template('cnmodule_content_forum_main.php');
     $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'categories' => $categories, 'forums_url' => $this->forums_url, 'theme_url' => $this->theme_url, 'user_status' => $this->user_status, 'message' => $this->message, 'description' => $board->get_description(), 'board_settings' => $this->board_settings, 'board' => $board));
 }
 public function getBoard()
 {
     $this->board = PaForumBoard::getPaForumBoard($this->board_id);
     return $this->board;
 }