* Updated my email address from "kasper@typo3.com" (which is closed and will stay...
[Packages/TYPO3.CMS.git] / t3lib / class.t3lib_browsetree.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2004 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Generate a page-tree, browsable.
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 November/2003 by Kasper Skaarhoj
32 *
33 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
34 * @coauthor René Fritz <r.fritz@colorcube.de>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 74: class t3lib_browseTree extends t3lib_treeView
42 * 83: function init($clause='')
43 * 107: function getTitleAttrib($row)
44 * 119: function wrapIcon($icon,$row)
45 *
46 * TOTAL FUNCTIONS: 3
47 * (This index is automatically created/updated by the extension "extdeveval")
48 *
49 */
50
51 require_once (PATH_t3lib.'class.t3lib_treeview.php');
52
53
54
55
56
57
58
59
60
61
62
63
64
65 /**
66 * Extension class for the t3lib_treeView class, specially made for browsing pages
67 *
68 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
69 * @coauthor René Fritz <r.fritz@colorcube.de>
70 * @see t3lib_treeView, t3lib_pageTree
71 * @package TYPO3
72 * @subpackage t3lib
73 */
74 class t3lib_browseTree extends t3lib_treeView {
75
76 /**
77 * Initialize, setting what is necessary for browsing pages.
78 * Using the current user.
79 *
80 * @param string Additional clause for selecting pages.
81 * @return void
82 */
83 function init($clause='') {
84 // This is very important for making trees of pages: Filtering out deleted pages, pages with no access to and sorting them correctly:
85 parent::init(' AND '.$GLOBALS['BE_USER']->getPagePermsClause(1).' '.$clause, 'sorting');
86
87 $this->table = 'pages';
88 $this->setTreeName('browsePages');
89 $this->domIdPrefix = 'pages';
90 $this->iconName = '';
91 $this->title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
92 $this->MOUNTS = $GLOBALS['WEBMOUNTS'];
93
94 $this->fieldArray = array_merge($this->fieldArray,array('doktype','php_tree_stop','t3ver_id'));
95 if (t3lib_extMgm::isLoaded('cms')) {
96 $this->fieldArray = array_merge($this->fieldArray,array('hidden','starttime','endtime','fe_group','module','extendToSubpages'));
97 }
98 }
99
100 /**
101 * Creates title attribute content for pages.
102 * Uses API function in t3lib_BEfunc which will retrieve lots of useful information for pages.
103 *
104 * @param array The table row.
105 * @return string
106 */
107 function getTitleAttrib($row) {
108 return t3lib_BEfunc::titleAttribForPages($row,'1=1 '.$this->clause,0);
109 }
110
111 /**
112 * Wrapping the image tag, $icon, for the row, $row (except for mount points)
113 *
114 * @param string The image tag for the icon
115 * @param array The row for the current element
116 * @return string The processed icon input value.
117 * @access private
118 */
119 function wrapIcon($icon,$row) {
120 // Add title attribute to input icon tag
121 $theIcon = $this->addTagAttributes($icon,($this->titleAttrib ? $this->titleAttrib.'="'.$this->getTitleAttrib($row).'"' : ''));
122
123 // Wrap icon in click-menu link.
124 if (!$this->ext_IconMode) {
125 $theIcon = $GLOBALS['TBE_TEMPLATE']->wrapClickMenuOnIcon($theIcon,$this->treeName,$this->getId($row),0);
126 } elseif (!strcmp($this->ext_IconMode,'titlelink')) {
127 $aOnClick = 'return jumpTo(\''.$this->getJumpToParam($row).'\',this,\''.$this->domIdPrefix.$this->getId($row).'_'.$this->bank.'\');';
128 $theIcon='<a href="#" onclick="'.htmlspecialchars($aOnClick).'">'.$theIcon.'</a>';
129 }
130 return $theIcon;
131 }
132 }
133
134 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php']) {
135 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_browsetree.php']);
136 }
137 ?>