blob: 9f8f455692be727def12f5248dfd91dcb98ab9c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
<?php
// $Header: /cvsroot/bitweaver/_bit_boards/Attic/board.php,v 1.8 2006/09/23 03:47:27 spiderr Exp $
// Copyright (c) 2004 bitweaver Messageboards
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
// Initialization
require_once("../bit_setup_inc.php");
require_once( BITBOARDS_PKG_PATH.'BitBoardTopic.php' );
require_once( BITBOARDS_PKG_PATH.'BitBoardPost.php' );
require_once( BITBOARDS_PKG_PATH.'BitBoard.php' );
// Is package installed and enabled
$gBitSystem->verifyPackage( 'bitboards' );
// Now check permissions to access this page
$gBitSystem->verifyPermission( 'p_bitboards_read' );
$ns = array();
$board_all_cids =array();
if($gBitSystem->isPackageActive('pigeonholes')) {
require_once(PIGEONHOLES_PKG_PATH.'Pigeonholes.php');
$p = new Pigeonholes();
$s = new LibertyStructure();
$listHash = array('load_only_root'=> TRUE);
$l = $p->getList($listHash);
foreach ($l as $e) {
$d = $s->getSubTree( $e['structure_id'] );
$d_o = array();
foreach ($d as $c) {
$pos_var = &$d_o;
if($c['level']!=0) {
$pos = explode(".",$c['pos']);
$pos_var = &$d_o;
foreach ($pos as $pos_v) {
if (!isset($pos_var['children'])) {
$pos_var['children']=array();
}
if (!isset($pos_var['children'][$pos_v-1])) {
$pos_var['children'][$pos_v-1]=array();
}
$pos_var = &$pos_var['children'][$pos_v-1];
}
}
if (empty($pos_var['data'])) {
$pos_var['children']=array();
$pos_var['data']=$c;
$mlHash=array();
$mlHash['content_id']=$c['content_id'];
$mlHash['content_type_guid']=BITBOARD_CONTENT_TYPE_GUID;
$pos_var['members']=$p->getMemberList($mlHash);
$board_cids =array();
foreach ($pos_var['members'] as $boardKey) {
$board_cids[] = $boardKey['content_id'];
}
if (count($board_cids)>0) {
$blHash = array('boards'=>$board_cids,'paginationOff'=>'y');
$b = new BitBoard();
$pos_var['members'] = $b->getList($blHash);
$pos_var['pagination']=$blHash['listInfo'];
$board_all_cids = array_merge($board_all_cids,$board_cids);
}
}
}
$ns[]=$d_o;
}
}
$rest =array();
if($gBitSystem->isPackageActive('pigeonholes')) {
// $rest['data']['title']="Uncategoried Boards";
} else {
// $rest['data']['title']="Board List";
}
$rest['children']=array();
$blHash = array('nboards'=>$board_all_cids,'paginationOff'=>'y');
$b = new BitBoard();
$rest['members'] = $b->getList($blHash);
if (count($rest['members'])>0) {
$ns[] = $rest;
}
$gBitSmarty->assign_by_ref('ns',$ns);
function countBoards(&$a) {
$s = 0;
if (count($a['children'])==0) {
return 1;
}
foreach ($a['children'] as $c) {
$s += countBoards($c);
}
$a['sub_count']= $s;
return $s;
}
foreach ($ns as $k=> $a) {
$ns[$k]['sub_count']= countBoards($ns[$k]);
}
//$gBitSmarty->display( 'bitpackage:bitboards/cat_display.tpl');
$gBitSystem->display( 'bitpackage:bitboards/list_boards.tpl', tra( 'Boards' ) );
?>
|