boards
[ class tree: boards ] [ index: boards ] [ all elements ]

Source for file list_boards_inc.php

Documentation is available at list_boards_inc.php

  1. <?php
  2. /**
  3.  * $Header$
  4.  * Copyright (c) 2004 bitweaver Messageboards
  5.  * All Rights Reserved. See below for details and a complete list of authors.
  6.  * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details.
  7.  * @package boards
  8.  * @subpackage functions
  9.  */
  10.  
  11. /**
  12.  * required setup
  13.  */
  14. require_once("../kernel/setup_inc.php");
  15. require_onceBOARDS_PKG_PATH.'BitBoardTopic.php' );
  16. require_onceBOARDS_PKG_PATH.'BitBoardPost.php' );
  17. require_onceBOARDS_PKG_PATH.'BitBoard.php' );
  18.  
  19. // Is package installed and enabled
  20. $gBitSystem->verifyPackage'boards' );
  21.  
  22. // Now check permissions to access this page
  23. $gBitSystem->verifyPermission'p_boards_read' );
  24.  
  25. // Get a list of boards
  26. $ns array();
  27. $board_all_cids =array();
  28.  
  29. // @TODO move pigeonholes to its own file library or something
  30. if($gBitSystem->isPackageActive('pigeonholes')) {
  31.     require_once(PIGEONHOLES_PKG_PATH.'Pigeonholes.php');
  32.  
  33.     $p new Pigeonholes();
  34.     $s new LibertyStructure();
  35.  
  36.     $listHash array('load_only_root'=> TRUE);
  37.     $l $p->getList($listHash);
  38.     foreach ($l as $e{
  39.         $d $s->getSubTree$e['structure_id');
  40.         $d_o array();
  41.         foreach ($d as $c{
  42.             $pos_var &$d_o;
  43.             if($c['level']!=0{
  44.                 $pos explode(".",$c['pos']);
  45.                 $pos_var &$d_o;
  46.                 foreach ($pos as $pos_v{
  47.                     if (!isset($pos_var['children'])) {
  48.                         $pos_var['children']=array();
  49.                     }
  50.                     if (!isset($pos_var['children'][$pos_v-1])) {
  51.                         $pos_var['children'][$pos_v-1]=array();
  52.                     }
  53.                     $pos_var &$pos_var['children'][$pos_v-1];
  54.                 }
  55.             }
  56.             if (empty($pos_var['data'])) {
  57.                 $pos_var['children']=array();
  58.                 $pos_var['data']=$c;
  59.                 $mlHash=array();
  60.                 $mlHash['content_id']=$c['content_id'];
  61.                 $mlHash['content_type_guid']=BITBOARD_CONTENT_TYPE_GUID;
  62.                 $pos_var['members']=$p->getMemberList($mlHash);
  63.                 $board_cids =array();
  64.                 foreach ($pos_var['members'as $boardKey{
  65.                     $board_cids[$boardKey['content_id'];
  66.                 }
  67.                 if (count($board_cids)>0{
  68.                     $listHash array('boards'=>$board_cids,'paginationOff'=>'y');
  69.                     $board new BitBoard();
  70.                     $pos_var['members'$board->getList($listHash);
  71.                     $pos_var['pagination']=$listHash['listInfo'];
  72.                     $board_all_cids array_merge($board_all_cids,$board_cids);
  73.                 }
  74.             }
  75.         }
  76.         $ns[]=$d_o;
  77.     }
  78.  
  79. }
  80.  
  81. // get our boards list
  82. $ret =array();
  83. if($gBitSystem->isPackageActive('pigeonholes')) {
  84. //    $ret['data']['title']="Uncategorised Boards";
  85. else {
  86. //    $ret['data']['title']="Board List";
  87. }
  88. $ret['children']=array();
  89. $listHash array('nboards'=>$board_all_cids,'paginationOff'=>'y');
  90. $board new BitBoard();
  91. $ret['members'$board->getList($listHash);
  92. if (count($ret['members']== 1{
  93.     $_REQUEST['b'$ret['members'][0]['board_id'];
  94.     requireBOARDS_PKG_PATH.'view_board_inc.php' );
  95.     die;
  96. elseif (count($ret['members']0{
  97.     $ns[$ret;
  98. }
  99.  
  100. $gBitSmarty->assign_by_ref('ns',$ns);
  101.  
  102. // this might be for getting a count of nested boards - not entirely sure, if you figure it out please clarify this comment.
  103. function countBoards(&$a{
  104.     $s count($a['members']);
  105.     foreach ($a['children'as $k=>$c{
  106.         $n countBoards($a['children'][$k]);
  107.         if ($n == 0{
  108.             unset($a['children'][$k]);
  109.         }
  110.         else {
  111.             $a['children'][$k]['sub_count'$n;
  112.             $s += $n;
  113.         }
  114.     }
  115.     return $s;
  116. }
  117.  
  118. foreach ($ns as $k=> $a{
  119.     $n countBoards($ns[$k]);
  120.     if ($n == 0{
  121.         unset($ns[$k]);
  122.     }
  123.     else {
  124.         $ns[$k]['sub_count'$n;
  125.     }
  126. }
  127.  
  128. //$gBitSmarty->display( 'bitpackage:boards/cat_display.tpl');
  129. $gBitSystem->display'bitpackage:boards/list_boards.tpl'tra'Boards' array'display_mode' => 'display' ));
  130.  
  131. ?>

Documentation generated on Wed, 29 Jul 2015 13:57:02 +0000 by phpDocumentor 1.5.0-lsces