Project

General

Profile

1 1953 darkviper
<?php
2
3
/**
4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
5
 *
6
 * This program is free software: you can redistribute it and/or modify
7
 * it under the terms of the GNU General Public License as published by
8
 * the Free Software Foundation, either version 3 of the License, or
9
 * (at your option) any later version.
10
 *
11
 * This program is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14
 * GNU General Public License for more details.
15
 *
16
 * You should have received a copy of the GNU General Public License
17
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18
 */
19
20
/**
21
 * ParentPageTree.php
22
 *
23
 * @category     WbACP
24
 * @package      WbACP_Pages
25
 * @copyright    Manuela v.d.Decken <manuela@isteam.de>
26
 * @author       Manuela v.d.Decken <manuela@isteam.de>
27
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
28
 * @version      0.0.1
29 1972 Luisehahne
 * @revision     $Revision$
30
 * @link         $HeadURL$
31
 * @lastmodified $Date$
32 1953 darkviper
 * @since        File available since 05.08.2013
33
 * @description  xyz
34
 */
35
36
class a_pages_SmallRawPageTree extends a_pages_PageTree{
37
38
/**
39
 * create a page tree as a well formatted, unordered list
40
 * @param int use page-ID as root of the generated page tree. (default: 0)
41
 * @return string the whoole list
42
 */
43
	protected function _createTree($iTreeRoot = 0)
44
	{
45
		// generate the page lines
46
		$this->_IterateTree($iTreeRoot);
47
		return '';
48
	}
49
/**
50
 * iterate through all nodes which having subnodes
51
 * @param integer start iteration from this parent page ( 0 = root)
52
 * @return string all of the item lines
53
 */
54
	protected function _IterateTree($iParent = 0)
55
	{
56
		$sOutput = '';
57
	// Get page list from database
58
		if(($oPages = $this->_oDb->query($this->_makeSql($iParent))))
59
		{
60
			$this->_queries++;
61
			$iMinPosition = 1;
62
			while($aPage = $oPages->fetchRow(MYSQL_ASSOC))
63
			{ // iterate through the current branch
64
				if($this->_aReg['PAGE_LEVEL_LIMIT'] && ($aPage['level'] > $this->_aReg['PAGE_LEVEL_LIMIT'])) {
65
					return '';
66
				}
67
				$aPage['min_position'] = ($aPage['position'] < $iMinPosition ? $aPage['position'] : $iMinPosition);
68
				$this->_iLineColor = $this->_iPagesTotal++ % 2;
69
				$aPage['iswriteable'] = false;
70
				if( $this->_oApp->ami_group_member($aPage['admin_users']) ||
71
					$this->_oApp->is_group_match($this->_oApp->get_groups_id(), $aPage['admin_groups']))
72
				{
73
					if(($aPage['visibility'] == 'deleted' && $this->_aReg['PAGE_TRASH'] == 'inline') ||
74
					   ($aPage['visibility'] != 'deleted'))
75
					{
76
						$aPage['iswriteable'] = true;
77
						$this->_iPagesWriteable++;
78
					}
79
				} else {
80
					if($aPage['visibility'] == 'private') { continue; }
81
				}
82
			// add this item to the secondary list of parents
83
				$this->_addToParentList($aPage);
84
			// if there are children, iterate through this children now
85
				if((bool)$aPage['children']) {
86
					$this->_IterateTree($aPage['page_id']);
87
				}
88
			}
89
		}
90
		return $sOutput;
91
	}
92
93
94
} // end of class LanguagePageTree