‪TYPO3CMS  ‪main
TYPO3\CMS\Backend\Tree\View\AbstractTreeView Class Reference
Inheritance diagram for TYPO3\CMS\Backend\Tree\View\AbstractTreeView:
TYPO3\CMS\Backend\Tree\View\PageTreeView TYPO3\CMS\Impexp\View\ExportPageTreeView TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView

Public Member Functions

 __construct ()
 
 init ($clause='', $orderByFields='')
 
 addField ($field, $noCheck=false)
 
 reset ()
 
bool expandNext ($id)
 
int getTree ($uid, $depth=999, $depthData='')
 

Public Attributes

string $orderByFields = ''
 
int $makeHTML = 1
 
array $ids = array( )
 
array $ids_hierarchy = array( )
 
array $orig_ids_hierarchy = array( )
 
array $buffer_idH = array( )
 
array $tree = array( )
 

Protected Member Functions

string PMicon ($row, $a, $c, $nextCount, $isOpen)
 
string PM_ATagWrap ($bMark='', $isOpen=false)
 
string getIcon (array $row)
 
string getTitleStr ($row, $titleLen=30)
 
string getTitleAttrib ($row)
 
int getCount ($uid)
 
mixed getDataInit ($parentId)
 
array bool getDataNext (&$res)
 
 getLanguageService ()
 
 getBackendUser ()
 

Protected Attributes

string $table = 'pages'
 
string $parentField = 'pid'
 
string $clause = ''
 
array $fieldArray
 
string $defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate'
 

Detailed Description

Base class for creating a browsable array/page/folder tree in HTML

This class is a TYPO3 Backend implementation and is not considered part of the Public TYPO3 API.

Definition at line 38 of file AbstractTreeView.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Backend\Tree\View\AbstractTreeView::__construct ( )

Member Function Documentation

◆ addField()

TYPO3\CMS\Backend\Tree\View\AbstractTreeView::addField (   $field,
  $noCheck = false 
)

Adds a fieldname to the internal array ->fieldArray

Parameters
string$field‪Field name to
bool$noCheck‪If set, the fieldname will be set no matter what. Otherwise the field name must either be found as key in $GLOBALS['TCA'][$table]['columns'] or in the list ->defaultList

Definition at line 165 of file AbstractTreeView.php.

References $GLOBALS, TYPO3\CMS\Filelist\Type\fieldArray, and TYPO3\CMS\Core\Utility\GeneralUtility\inList().

◆ expandNext()

bool TYPO3\CMS\Backend\Tree\View\AbstractTreeView::expandNext (   $id)

Returns TRUE/FALSE if the next level for $id should be expanded - based on data in $this->stored[][] and ->expandAll flag. Used in subclasses

Parameters
int$id‪Record id/key
Returns
‪bool
See also
‪\TYPO3\CMS\Backend\Tree\View\PageTreeView::expandNext()

Reimplemented in TYPO3\CMS\Impexp\View\ExportPageTreeView, TYPO3\CMS\Backend\Tree\View\PageTreeView, and TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView.

Definition at line 246 of file AbstractTreeView.php.

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTree().

◆ getBackendUser()

◆ getCount()

int TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getCount (   $uid)
protected

◆ getDataInit()

mixed TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getDataInit (   $parentId)
protected

Getting the tree data: Selecting/Initializing data pointer to items for a certain parent id. For tables: This will make a database query to select all children to "parent" For arrays: This will return key to the ->dataLookup array

Parameters
int$parentId‪parent item id
Returns
‪mixed Data handle (Tables: An sql-resource, arrays: A parentId integer. -1 is returned if there were NO subLevel.)

Definition at line 426 of file AbstractTreeView.php.

References TYPO3\CMS\Filelist\Type\fieldArray, TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBackendUser(), TYPO3\CMS\Core\Database\Connection\PARAM_INT, TYPO3\CMS\Core\Database\Query\QueryHelper\parseOrderBy(), and TYPO3\CMS\Core\Database\Query\QueryHelper\stripLogicalOperatorPrefix().

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTree().

◆ getDataNext()

array bool TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getDataNext ( $res)
protected

Getting the tree data: next entry

Parameters
mixed$res‪Data handle
Returns
‪array|bool item data array OR FALSE if end of elements.
See also
getDataInit()

Definition at line 460 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getBackendUser().

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTree().

◆ getIcon()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getIcon ( array  $row)
protected

Get the icon markup for the row

Parameters
array$row‪The row to get the icon for
Returns
‪string The icon markup, wrapped into a span tag, with the records title as title attribute

Definition at line 263 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTitleAttrib().

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTree().

◆ getLanguageService()

TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getLanguageService ( )
protected

◆ getTitleAttrib()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getTitleAttrib (   $row)
protected

Returns the value for the image "title" attribute

Parameters
array$row‪The input row array (where the key "title" is used for the title)
Returns
‪string The attribute value (is htmlspecialchared() already)

Reimplemented in TYPO3\CMS\Impexp\View\ExportPageTreeView.

Definition at line 291 of file AbstractTreeView.php.

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getIcon().

◆ getTitleStr()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getTitleStr (   $row,
  $titleLen = 30 
)
protected

Returns the title for the input record. If blank, a "no title" label (localized) will be returned. Do NOT htmlspecialchar the string from this function - has already been done.

Parameters
array$row‪The input row array (where the key "title" is used for the title)
int$titleLen‪Title length (30)
Returns
‪string The title.

Reimplemented in TYPO3\CMS\Backend\Tree\View\PageTreeView.

Definition at line 279 of file AbstractTreeView.php.

References TYPO3\CMS\Core\Utility\GeneralUtility\fixed_lgd_cs(), and TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getLanguageService().

Referenced by TYPO3\CMS\Impexp\View\ExportPageTreeView\printTree().

◆ getTree()

int TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getTree (   $uid,
  $depth = 999,
  $depthData = '' 
)

◆ init()

TYPO3\CMS\Backend\Tree\View\AbstractTreeView::init (   $clause = '',
  $orderByFields = '' 
)

Initialize the tree class. Needs to be overwritten

Parameters
string$clause‪Record WHERE clause
string$orderByFields‪Record ORDER BY field

Reimplemented in TYPO3\CMS\Impexp\View\ExportPageTreeView, and TYPO3\CMS\Backend\Tree\View\PageTreeView.

Definition at line 148 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$clause, and TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$orderByFields.

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\__construct().

◆ PM_ATagWrap()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::PM_ATagWrap (   $bMark = '',
  $isOpen = false 
)
protected

Wrap the plus/minus icon in a link

Parameters
string$bMark‪If set, the link will have an anchor point (=$bMark) and a name attribute (=$bMark)
bool$isOpen
Returns
‪string Link-wrapped input string

Definition at line 214 of file AbstractTreeView.php.

References TYPO3\CMS\Core\Imaging\IconProvider\AbstractSvgIconProvider\MARKUP_IDENTIFIER_INLINE.

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\PMicon().

◆ PMicon()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::PMicon (   $row,
  $a,
  $c,
  $nextCount,
  $isOpen 
)
protected

Generate the plus/minus icon for the browsable tree.

Parameters
array$row‪Record for the entry
int$a‪The current entry number
int$c‪The total number of entries. If equal to $a, a "bottom" element is returned.
int$nextCount‪The number of sub-elements to the current element.
bool$isOpen‪The element was expanded to render subelements if this flag is set.
Returns
‪string Image tag with the plus/minus icon.
See also
‪\TYPO3\CMS\Backend\Tree\View\PageTreeView::PMicon()

Reimplemented in TYPO3\CMS\Impexp\View\ExportPageTreeView, and TYPO3\CMS\Backend\Tree\View\PageTreeView.

Definition at line 199 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\PM_ATagWrap().

Referenced by TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTree().

◆ reset()

TYPO3\CMS\Backend\Tree\View\AbstractTreeView::reset ( )

Resets the tree, recs, ids, ids_hierarchy and orig_ids_hierarchy internal variables. Use it if you need it.

Definition at line 175 of file AbstractTreeView.php.

Referenced by TYPO3\CMS\Impexp\View\ExportPageTreeView\buildTree().

Member Data Documentation

◆ $buffer_idH

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$buffer_idH = array( )

◆ $clause

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$clause = ''
protected

WHERE clause used for selecting records for the tree. Is set by function init.

See also
init()

Definition at line 56 of file AbstractTreeView.php.

Referenced by TYPO3\CMS\Backend\Tree\View\PageTreeView\init(), TYPO3\CMS\Impexp\View\ExportPageTreeView\init(), and TYPO3\CMS\Backend\Tree\View\AbstractTreeView\init().

◆ $defaultList

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate'
protected

List of other fields which are ALLOWED to set (here, based on the "pages" table!)

See also
addField()

Definition at line 96 of file AbstractTreeView.php.

◆ $fieldArray

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$fieldArray
protected
Initial value:
= [
'uid',
'pid',
'title',
'is_siteroot',
'doktype',
'nav_title',
'mount_pid',
'php_tree_stop',
't3ver_state',
'hidden',
'starttime',
'endtime',
'fe_group',
'module',
'extendToSubpages',
'nav_hide',
't3ver_wsid',
]

Default set of fields selected from the tree table. Make SURE that these fields names listed herein are actually possible to select from $this->table (if that variable is set to a TCA table name)

See also
addField()

Definition at line 71 of file AbstractTreeView.php.

◆ $ids

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$ids = array( )

Definition at line 111 of file AbstractTreeView.php.

◆ $ids_hierarchy

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$ids_hierarchy = array( )

Definition at line 116 of file AbstractTreeView.php.

◆ $makeHTML

int TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$makeHTML = 1

If 1, HTML code is also accumulated in ->tree array during rendering of the tree

Definition at line 102 of file AbstractTreeView.php.

◆ $orderByFields

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$orderByFields = ''

◆ $orig_ids_hierarchy

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$orig_ids_hierarchy = array( )

Definition at line 121 of file AbstractTreeView.php.

◆ $parentField

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$parentField = 'pid'
protected

Defines the field of $table which is the parent id field (like pid for table pages).

Definition at line 49 of file AbstractTreeView.php.

◆ $table

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$table = 'pages'
protected

Database table to get the tree data from. Leave blank if data comes from an array.

Definition at line 44 of file AbstractTreeView.php.

◆ $tree

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$tree = array( )