Project

General

Profile

1 1839 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 1846 darkviper
 * PageTree generator
21 1839 darkviper
 *
22
 * @category     WbACP
23
 * @package      WbACP_Pages
24 1846 darkviper
 * @author       Werner v.d.Decken <wkl@isteam.de>
25
 * @copyright    Werner v.d.Decken <wkl@isteam.de>
26 1839 darkviper
 * @license      http://www.gnu.org/licenses/gpl.html   GPL License
27
 * @version      1.0.0
28
 * @revision     $Revision$
29
 * @link         $HeadURL$
30
 * @lastmodified $Date$
31
 * @since        file added on 2012-12-21
32
 */
33
34
class a_pages_PageTree
35
{
36
/** @var object instance of the application object */
37 1953 darkviper
	protected $_oApp     = null;
38 1839 darkviper
/** @var object instance of the database object */
39 1953 darkviper
	protected $_oDb      = null;
40 1973 darkviper
/** @var object instance holds several values from the application global scope */
41
	protected $_oReg     = null;
42
/** @var object instance holds all of the translations */
43
	protected $_oTrans   = null;
44 1839 darkviper
/** @var string full HTML formattet list of pages */
45 1953 darkviper
	protected $_sOutput         = '';
46 1839 darkviper
/** @var integer number of all reachable pages */
47 1953 darkviper
	protected $_iPagesTotal     = 0;
48 1839 darkviper
/** @var integer number of all writeable pages */
49 1953 darkviper
	protected $_iPagesWriteable = 0;
50 1839 darkviper
/** @var integer index for toggle background color of the list */
51 1953 darkviper
	protected $_iLineColor      = 0;
52 1839 darkviper
/** @var array entries to build a select list for parents */
53 1953 darkviper
	protected $_aParentList     = array();
54 1839 darkviper
/** @var integer count all executed database requests passing all iterations. */
55 1953 darkviper
	protected $_queries = 0;
56 1839 darkviper
/**
57
 * constructor used to import some application constants and objects
58
 */
59
	public function __construct()
60
	{
61
		// import global vars and objects
62 1973 darkviper
		$this->_oApp   = $GLOBALS['admin'];
63
		$this->_oDb    = WbDatabase::getInstance();
64
		$this->_oReg   = WbAdaptor::getInstance();
65
		$this->_oTrans = Translate::getInstance();
66 1839 darkviper
	}
67
/**
68
 * parse the page tree and return
69 1846 darkviper
 * @param int use page-ID as root of the generated page tree. (default: 0)
70 1839 darkviper
 * @return type
71
 */
72 1846 darkviper
	public function parseTree($iTreeRoot = 0) {
73
		return $this->_createTree($iTreeRoot);
74 1839 darkviper
	}
75
/**
76
 *  parse the page tree and print it out
77 1846 darkviper
 * @param int use page-ID as root of the generated page tree. (default: 0)
78 1839 darkviper
 */
79 1846 darkviper
	public function displayTree($iTreeRoot = 0) {
80
		echo $this->parseTree($iTreeRoot);
81 1839 darkviper
	}
82
/**
83
 * total number of found pages which are visible for actual user
84
 * @return integer
85
 */
86
	public function getTotalPages() {
87
		return $this->_iPagesTotal;
88
	}
89
/**
90
 * number of found pages which are writable for actual user
91
 * @return integer
92
 */
93
	public function getWriteablePages() {
94
		return $this->_iPagesWriteable;
95
	}
96
/**
97
 * a list with all possible parent pages
98
 * @return array
99
 */
100 1953 darkviper
	public function getParentList($iTreeRoot = 0) {
101 1839 darkviper
		if(!$this->_sOutput) {
102 1953 darkviper
			$this->parseTree($iTreeRoot);
103 1839 darkviper
		}
104
		return $this->_aParentList;
105
	}
106
/**
107
 * create a page tree as a well formatted, unordered list
108 1846 darkviper
 * @param int use page-ID as root of the generated page tree. (default: 0)
109 1839 darkviper
 * @return string the whoole list
110
 */
111 1953 darkviper
	protected function _createTree($iTreeRoot = 0)
112 1839 darkviper
	{
113
		// compose the complete list
114
		$sOutput = ''
115
		// build the head
116 1846 darkviper
		      . $this->_Tabs(0 , true).'<div class="jsadmin pages_list">'.PHP_EOL
117 1839 darkviper
		      . $this->_Tabs(1).'<table>'.PHP_EOL
118
		      . $this->_Tabs(1).'<tbody>'.PHP_EOL
119
		      . $this->_Tabs(1).'<tr class="pages_list_header">'.PHP_EOL
120 1867 Luisehahne
		      . $this->_Tabs(1).'<th style="width:20px;">'.PHP_EOL.'</th>'.PHP_EOL
121 1973 darkviper
		      . $this->_Tabs(1).'<th class="list_menu_title">'.$this->_oTrans->TEXT_VISIBILITY.
122
		                        ' / '.$this->_oTrans->TEXT_MENU_TITLE.':</th>'.PHP_EOL
123
		      . $this->_Tabs(0).'<th class="list_page_title">'.$this->_oTrans->TEXT_PAGE_TITLE.
124 1839 darkviper
		                        '</th>'.PHP_EOL
125 1867 Luisehahne
		      . $this->_Tabs(0).'<th class="list_page_id">PID</th>'.PHP_EOL
126 1973 darkviper
		      . $this->_Tabs(0).'<th class="header_list_actions">'.$this->_oTrans->TEXT_ACTIONS.
127 1839 darkviper
		                        ':</th>'.PHP_EOL
128
		      . $this->_Tabs(0).'<th class="list_page_id">&nbsp;</th>'.PHP_EOL
129
		      . $this->_Tabs(-1).'</tr>'.PHP_EOL
130
		      . $this->_Tabs(-1).'</tbody>'.PHP_EOL
131
		      . $this->_Tabs(-1).'</table>'.PHP_EOL
132
		// generate the page lines
133 1846 darkviper
		      . $this->_IterateTree($iTreeRoot)
134 1839 darkviper
		// build the footer
135
		      . $this->_Tabs(-1).'</div>'.PHP_EOL;
136
		;
137
		$this->_sOutput = $sOutput;
138
		return $sOutput;
139
	}
140
/**
141
 * Create a string of multiple TABs to prettify the HTML-output
142
 * ingrease the number of TABs with a positive and degrease with an negative Value.
143
 * '0' means: do not change the value. Or set an absolute number using $bRelative=false
144
 * @staticvar int $iTabLevel
145
 * @param integer $iTabsDiv number of TABs to add/sub
146
 * @param bool $bRelative false if should be set to absolute value
147
 * @return string
148
 */
149 1953 darkviper
	protected function _Tabs($iTabsDiv = 0, $bRelative = true)
150 1839 darkviper
	{
151
		static $iTabLevel = 0;
152
		$iTabLevel = ($bRelative ? $iTabLevel + $iTabsDiv : $iTabsDiv);
153
		$iTabLevel += ($iTabLevel < 0 ? 0 - $iTabLevel : $iTabsDiv);
154
		return str_repeat("\t", $iTabLevel);
155
	}
156
/**
157
 * compose the needed SQL statement
158 1973 darkviper
 * @param  integer $iParentKey
159 1839 darkviper
 * @return string SQL statement
160
 */
161 1953 darkviper
	protected function _makeSql($iParentKey = 0)
162 1839 darkviper
	{
163 1973 darkviper
		$iParentKey = intval($iParentKey);
164 1953 darkviper
		$sql  = 'SELECT ( SELECT COUNT(*) '
165 1973 darkviper
		      .          'FROM `'.$this->_oDb->TablePrefix.'pages` `x` '
166 1953 darkviper
		      .          'WHERE x.`parent`=p.`page_id`'
167
		      .        ') `children`, '
168
		      .        's.`module`, MAX(s.`publ_start` + s.`publ_end`) published, p.`link`, '
169 1973 darkviper
		      .        '(SELECT MAX(`position`) FROM `'.$this->_oDb->TablePrefix.'pages` '
170 1953 darkviper
		      .        'WHERE `parent`='.$iParentKey.') max_position, '
171
		      .        '0 min_position, '
172
		      .        'p.`position`, '
173
		      .        'p.`page_id`, p.`parent`, p.`level`, p.`language`, p.`admin_groups`, '
174
		      .        'p.`admin_users`, p.`viewing_groups`, p.`viewing_users`, p.`visibility`, '
175 1999 darkviper
		      .        'p.`menu_title`, p.`page_title`, p.`page_trail`, '
176 2021 darkviper
		      .        'GROUP_CONCAT(CAST(CONCAT(s.`section_id`, \' - \', s.`module`) AS CHAR) ORDER BY s.`position` SEPARATOR \'\n\') `section_list` '
177 1973 darkviper
		      . 'FROM `'.$this->_oDb->TablePrefix.'pages` p '
178
		      .    'INNER JOIN `'.$this->_oDb->TablePrefix.'sections` s '
179 1999 darkviper
		      .    'ON p.`page_id`=s.`page_id` '
180
		      . 'WHERE `parent`='.$iParentKey.' '
181
		      .    (($this->_oReg->PageTrash != 'inline') ? 'AND `visibility`!=\'deleted\' ' : '')
182
		      . 'GROUP BY p.`page_id` '
183 1953 darkviper
		      . 'ORDER BY p.`position` ASC';
184 1839 darkviper
		return $sql;
185
	}
186
/**
187
 * iterate through all nodes which having subnodes
188 1846 darkviper
 * @param integer start iteration from this parent page ( 0 = root)
189 1839 darkviper
 * @return string all of the item lines
190
 */
191 1953 darkviper
	protected function _IterateTree($iParent = 0)
192 1839 darkviper
	{
193
		$sOutput = '';
194
		// Get page list from database
195
		if(($oPages = $this->_oDb->query($this->_makeSql($iParent))))
196
		{
197
			$this->_queries++;
198
			// output block-header
199
			$sOutput .= $this->_Tabs(0).'<ul id="p'.$iParent.'" class="page_list"';
200
			if(!$iParent) {
201
				$sOutput .= ' style="display: block;"';
202
			}else {
203
			// show block depending from Cookies
204
				if (isset ($_COOKIE['p'.$iParent]) && $_COOKIE['p'.$iParent] == '1') {
205
					$sOutput .= ' style="display: block;"';
206
				}
207
			}
208
			$sOutput .= '>'.PHP_EOL;
209
			$iMinPosition = 1;
210
			while($aPage = $oPages->fetchRow(MYSQL_ASSOC))
211
			{ // iterate through the current branch
212 1973 darkviper
				if($this->_oReg->PageLevelLimit && ($aPage['level'] > $this->_oReg->PageLevelLimit)) {
213 1846 darkviper
					return '';
214
				}
215 1839 darkviper
				$aPage['min_position'] = ($aPage['position'] < $iMinPosition ? $aPage['position'] : $iMinPosition);
216
				$this->_iLineColor = $this->_iPagesTotal++ % 2;
217
				$aPage['iswriteable'] = false;
218
				if( $this->_oApp->ami_group_member($aPage['admin_users']) ||
219
					$this->_oApp->is_group_match($this->_oApp->get_groups_id(), $aPage['admin_groups']))
220
				{
221 1973 darkviper
					if(($aPage['visibility'] == 'deleted' && $this->_oReg->PageTrash == 'inline') ||
222 1839 darkviper
					   ($aPage['visibility'] != 'deleted'))
223
					{
224
						$aPage['iswriteable'] = true;
225
						$this->_iPagesWriteable++;
226
					}
227
				} else {
228
					if($aPage['visibility'] == 'private') { continue; }
229
				}
230
				// add this item to the secondary list of parents
231
				$this->_addToParentList($aPage);
232
				$sOutput .= $this->_createListItem($aPage);
233
			}
234
			$sOutput .= $this->_Tabs(-1).'</ul>'.PHP_EOL;
235
		}
236
		return $sOutput;
237
	}
238
/**
239
 * formating the given page object for output
240
 * @param type $aPage
241
 * @return string
242
 */
243 1953 darkviper
	protected function _createListItem($aPage)
244 1839 darkviper
	{
245
	// output the current item
246
	// --- HEADER ------------------------------------------------------------------------
247
		$sOutput  = $this->_Tabs(0).'<li class="p'.$aPage['parent'].'">'.PHP_EOL
248
		          . $this->_Tabs(1).'<table class="pages_view">'.PHP_EOL
249
		          . $this->_Tabs(1).'<tbody>'.PHP_EOL
250
		          . $this->_Tabs(1).'<tr class="row_'.$this->_iLineColor.'">'.PHP_EOL;
251
	// --- TAB 1 --- (expand/collapse) ---------------------------------------------------
252
		$sOutput .= $this->_Tabs(1).'<td valign="middle" width="20" style="padding-left: '
253
		          . (int)($aPage['level']*20).'px;">';
254
		if((bool)$aPage['children']) {
255
			$sOutput .= '<a href="javascript:toggle_visibility(\'p'.$aPage['page_id'].'\');" '
256 1973 darkviper
			          . 'title="'.$this->_oTrans->TEXT_EXPAND.'/'.$this->_oTrans->TEXT_COLLAPSE.'">'
257 1979 darkviper
			          . '<span><img src="'.$this->_oReg->ThemeRel.'images/'
258 1839 darkviper
			          . ( ((isset($_COOKIE['p'.$aPage['page_id']])
259
						  && $_COOKIE['p'.$aPage['page_id']] == '1') ? 'minus' : 'plus')
260
						)
261
			          . '_16.png" onclick="toggle_plus_minus(\''.$aPage['page_id'].'\');" '
262
			          . 'name="plus_minus_'.$aPage['page_id'].'" alt="+" /></span></a>';
263
		}else {
264
			$sOutput .= '&nbsp;';
265
		}
266
		$sOutput .= '</td>'.PHP_EOL;
267
	// --- TAB 2 --- (menu title) --------------------------------------------------------
268
		$sOutput .= $this->_Tabs(0).'<td class="list_menu_title">';
269
		if($this->_oApp->get_permission('pages_modify') && $aPage['iswriteable']) {
270 1979 darkviper
			$sOutput .= '<a href="'.$this->_oReg->AcpRel.'pages/modify.php?page_id='
271 1973 darkviper
			          . $aPage['page_id'].'" title="'.$this->_oTrans->TEXT_MODIFY.'">';
272 1839 darkviper
		}
273 1979 darkviper
		$sIcon = $this->_oReg->ThemeRel.'images/'.$aPage['visibility'].'_16.png';
274
		if(!is_readable(rtrim($this->_oReg->DocumentRoot, '/').$sIcon)) {
275
			$sIcon = $this->_oReg->ThemeRel.'images/public_16.png';
276 1846 darkviper
		}
277 1973 darkviper
		$sOutput .= '<img src="'.$sIcon.'" alt="'.$this->_oTrans->TEXT_VISIBILITY.': '
278
				  . $this->_oTrans->{'TEXT_'.strtoupper($aPage['visibility'])}  .'" class="page_list_rights" />';
279 1839 darkviper
		if($this->_oApp->get_permission('pages_modify') && $aPage['iswriteable']) {
280
			$sOutput .= '<span class="modify_link">'.$aPage['menu_title'].'</span></a>';
281
		}else {
282
			$sOutput .=  '<span class="bold grey">'.$aPage['menu_title'].'</span>';
283
		}
284
		$sOutput .= '</td>'.PHP_EOL;
285
	// --- TAB 3 --- (page title) --------------------------------------------------------
286
		$sOutput .= $this->_Tabs(0).'<td class="list_page_title">'.$aPage['page_title'].'</td>'.PHP_EOL;
287
	// --- TAB 4 --- (page ID) -----------------------------------------------------------
288
		$sOutput .= $this->_Tabs(0).'<td class="list_page_id right">'.$aPage['page_id'].'</td>'.PHP_EOL;
289
	// --- TAB 5 --- (show this page in new window) --------------------------------------
290
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
291
		if($aPage['visibility'] != 'deleted' && $aPage['visibility'] != 'none') {
292 1973 darkviper
			$sPageLink = $this->_oReg->AppRel.preg_replace(
293
			                                 '/^'.preg_quote($this->_oReg->AppUrl, '/').'/siU',
294 1839 darkviper
			                                 '',
295
			                                 $this->_oApp->page_link($aPage['link'])
296
			                                );
297 1973 darkviper
			$sOutput .= '<a href="'.$sPageLink.'" target="_blank" title="'.$this->_oTrans->TEXT_VIEW
298 1979 darkviper
			          . '"><img src="'.$this->_oReg->ThemeRel.'images/view_16.png" alt="'
299 1973 darkviper
			          . $this->_oTrans->TEXT_VIEW.'" /></a>';
300 1839 darkviper
		}else {
301 1979 darkviper
			$sOutput .= '<img src="'.$this->_oReg->ThemeRel.'images/blank_16.gif" alt=" " />';
302 1839 darkviper
		}
303
		$sOutput .= '</td>'.PHP_EOL;
304
305
	// --- TAB 6 --- (edit settings) -----------------------------------------------------
306
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
307
		if($aPage['visibility'] != 'deleted') {
308
			if($this->_oApp->get_permission('pages_settings') && $aPage['iswriteable']) {
309 1979 darkviper
				$sOutput .= '<a href="'.$this->_oReg->AcpRel.'pages/settings.php?page_id='
310 1973 darkviper
				          . $aPage['page_id'].'" title="'.$this->_oTrans->TEXT_SETTINGS.'">'
311 1979 darkviper
				          . '<img src="'.$this->_oReg->ThemeRel.'images/modify_16.png" alt="'
312 1973 darkviper
				          . $this->_oTrans->TEXT_SETTINGS.'" /></a>';
313 1839 darkviper
			}
314
		}else {
315 1979 darkviper
			$sOutput .= '<a href="'.$this->_oReg->AcpRel.'pages/restore.php?page_id='.$aPage['page_id'].'" '
316 1973 darkviper
			          . 'title="'.$this->_oTrans->TEXT_RESTORE.'"><img src="'.$this->_oReg->ThemeRel
317 1979 darkviper
			          . 'images/restore_16.png" alt="'.$this->_oTrans->TEXT_RESTORE.'" /></a>';
318 1839 darkviper
		}
319
		$sOutput .= '</td>'.PHP_EOL;
320
321
	// --- TAB 7 --- (edit sections) -----------------------------------------------------
322
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
323 1973 darkviper
		if( $this->_oReg->ManageSections && $this->_oApp->get_permission('pages_add') && $aPage['iswriteable'] ) {
324 1839 darkviper
			$file = $this->_oApp->page_is_active($aPage) ? "clock_16.png" : "clock_red_16.png";
325
			$file = ($aPage['published'] && $aPage['module'] != 'menu_link') ? $file : 'noclock_16.png';
326 1979 darkviper
			$sOutput .= '<a href="'.$this->_oReg->AcpRel.'pages/sections.php?page_id='
327 1999 darkviper
			          . $aPage['page_id'].'" title="'.$this->_oTrans->HEADING_MANAGE_SECTIONS."\n".$aPage['section_list'].'">'
328 1979 darkviper
			          . '<img src="'.$this->_oReg->ThemeRel.'images/'.$file.'" alt="'
329 1999 darkviper
			          . $this->_oTrans->HEADING_MANAGE_SECTIONS."\n".$aPage['section_list'].'" /></a>';
330 1839 darkviper
		}else {
331 1979 darkviper
			$sOutput .= '<img src="'.$this->_oReg->ThemeRel.'images/blank_16.gif" alt=" " />';
332 1839 darkviper
		}
333
		$sOutput .= '</td>'.PHP_EOL;
334
335
	// --- TAB 8 --- (move up) -----------------------------------------------------------
336
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
337
		if($aPage['position'] > $aPage['min_position']) {
338
			if($aPage['visibility'] != 'deleted') {
339
				if($this->_oApp->get_permission('pages_settings') && $aPage['iswriteable']) {
340 1979 darkviper
					$sOutput .= '<a href="'.$this->_oReg->AcpRel.'pages/move_up.php?page_id='
341 1973 darkviper
					          . $aPage['page_id'].'" title="'.$this->_oTrans->TEXT_MOVE_UP
342 1979 darkviper
					          . '"><img src="'.$this->_oReg->ThemeRel.'images/up_16.png" alt="'
343 1973 darkviper
					          . $this->_oTrans->TEXT_MOVE_UP.'" /></a>';
344 1839 darkviper
				}
345
			}
346
		}
347
		$sOutput .= '</td>'.PHP_EOL;
348
349
	// --- TAB 9 --- (move down) ---------------------------------------------------------
350
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
351
		if($aPage['position'] < $aPage['max_position']) {
352
			if($aPage['visibility'] != 'deleted') {
353
				if($this->_oApp->get_permission('pages_settings') && $aPage['iswriteable']) {
354 1979 darkviper
					$sOutput .= '<a href="'.$this->_oReg->AcpRel.'pages/move_down.php?page_id='
355 1973 darkviper
					          . $aPage['page_id'].'" title="'.$this->_oTrans->TEXT_MOVE_DOWN
356 1979 darkviper
					          . '"><img src="'.$this->_oReg->ThemeRel.'images/down_16.png" alt="'
357 1973 darkviper
					          . $this->_oTrans->TEXT_MOVE_DOWN.'" /></a>';
358 1839 darkviper
				}
359
			}
360
		}
361
		$sOutput .= '</td>'.PHP_EOL;
362
363
	// --- TAB 10 --- (delete page) ------------------------------------------------------
364
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
365
		if($this->_oApp->get_permission('pages_delete') && $aPage['iswriteable']) {
366
			$sOutput .= '<a href="javascript:confirm_link(pages_delete_confirm+\'?\',\''
367 1979 darkviper
			          . $this->_oReg->AcpRel.'pages/delete.php?page_id='
368 1839 darkviper
			          . $this->_oApp->getIDKEY($aPage['page_id']).'\');" title="'
369 1973 darkviper
			          . $this->_oTrans->TEXT_DELETE.'"><img src="'.$this->_oReg->ThemeRel
370 1979 darkviper
			          . 'images/delete_16.png" alt="'.$this->_oTrans->TEXT_DELETE.'" /></a>';
371 1839 darkviper
		}else {
372 1979 darkviper
			$sOutput .= '<img src="'.$this->_oReg->ThemeRel.'images/blank_16.gif" alt=" " />';
373 1839 darkviper
		}
374
		$sOutput .= '</td>'.PHP_EOL;
375
376
	// --- TAB 11 --- (add child page) ---------------------------------------------------
377
		$sOutput .= $this->_Tabs(0).'<td class="list_actions">';
378
		if(
379
			$this->_oApp->get_permission('pages_add')
380
			&& $aPage['iswriteable']
381
			&& ($aPage['visibility'] != 'deleted')
382 1973 darkviper
			&& $aPage['level'] < ($this->_oReg->PageLevelLimit - 1)
383 1839 darkviper
		  )
384
		{
385
			$sOutput .= '<a href="javascript:add_child_page(\''.$aPage['page_id'].'\');" '
386 1973 darkviper
			          . 'title="'.$this->_oTrans->HEADING_ADD_CHILD_PAGE.'"><img src="'
387 1979 darkviper
			          . $this->_oReg->ThemeRel.'images/siteadd.png" name="addpage_'.$aPage['page_id']
388 1973 darkviper
			          . '" alt="'.$this->_oTrans->HEADING_ADD_CHILD_PAGE.'" /></a>';
389 1839 darkviper
		}else {
390
			$sOutput .= '&nbsp;';
391
		}
392
		$sOutput .= '</td>'.PHP_EOL;
393
	// --- TAB 12 --- (show language) ----------------------------------------------------
394
		$sOutput .= $this->_Tabs(0).'<td class="list_page_id center">'.$aPage['language'].'</td>'.PHP_EOL;
395
	// --- FOOTER ------------------------------------------------------------------------
396
		$sOutput .= $this->_Tabs(-1).'</tr>'.PHP_EOL
397
		          . $this->_Tabs(-1).'</tbody>'.PHP_EOL
398
		          . $this->_Tabs(-1).'</table>'.PHP_EOL;
399
	// if there children, iterate through this children now
400
		if((bool)$aPage['children']) {
401
			$sOutput .= $this->_IterateTree($aPage['page_id']);
402
		}
403
		$sOutput .= $this->_Tabs(-1).'</li>'.PHP_EOL;
404
		return $sOutput;
405
	} // end of method _createListItem
406
/**
407
 * build a list of possible parent pages
408
 * @param array $aPage
409
 */
410 1953 darkviper
	protected function _addToParentList(array $aPage)
411 1839 darkviper
	{
412 1973 darkviper
		if( ($aPage['level'] < ($this->_oReg->PageLevelLimit - 1))
413 1839 darkviper
			&& $aPage['iswriteable']
414
			&& ($aPage['visibility'] != 'deleted')
415
			&& $this->_oApp->get_permission('pages_add') )
416
		{
417 1953 darkviper
			$aPage['disabled'] = ($aPage['iswriteable'] ? 0 : 1);
418
			$this->_aParentList[] = $aPage;
419 1839 darkviper
		}
420
	}
421
422
} // end of class PageTree