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