Example #1
0
 /**
 * This retrieve the list of categories
 * and the X last post under categories
 */
 private function boardTopLevelCategories()
 {
     if ($this->tags) {
         $this->boardTopLevelLastPosts();
         return;
     }
     $this->board = new Board($this->dao, 'Forums', '.');
     $query = "select id as IdTagCategory,IdName,IdDescription from forums_tags where Type='Category' order by tag_position asc ";
     $scat = $this->dao->query($query);
     if (!$scat) {
         throw new PException('boardTopLevelCategories::Could not retrieve the categories tags!');
     }
     $ListBoard = array();
     $CategoryList = "";
     // for all the tags which are categories
     while ($rowcat = $scat->fetch(PDB::FETCH_OBJ)) {
         if ($CategoryList != "") {
             $CategoryList .= ",";
         }
         $CategoryList .= $rowcat->IdTagCategory;
         // We are going to seek for the X last post which have this tag
         $tt = array();
         array_push($tt, $rowcat);
         $board = new Board($this->dao, 'Forums', '.', null, $tt);
         $rowcat->board = $board;
         $rowcat->threads = $board->LoadThreads($rowcat->IdTagCategory);
         array_push($ListBoard, $rowcat);
     }
     $rowcat->threads = $board->LoadThreads(0, $CategoryList);
     // Load some post without categories
     array_push($ListBoard, $rowcat);
     $this->ListBoards = $ListBoard;
 }