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

Public Member Functions

 __construct ()
 
 init ($clause='', $orderByFields='')
 
 addField ($field, $noCheck=false)
 
 reset ()
 
string PMicon ($row, $a, $c, $nextCount, $isOpen)
 
string PM_ATagWrap ($bMark='', $isOpen=false)
 
string addTagAttributes ($icon, $attr)
 
bool expandNext ($id)
 
string getRootIcon ($rec)
 
string getIcon ($row)
 
string getTitleStr ($row, $titleLen=30)
 
string getTitleAttrib ($row)
 
int getTree ($uid, $depth=999, $depthData='')
 
int getCount ($uid)
 
array getRootRecord ()
 
mixed getDataInit ($parentId)
 
int getDataCount (&$res)
 
array bool getDataNext (&$res)
 
 getDataFree (&$res)
 

Public Attributes

string $thisScript = ''
 
string $title = 'no title'
 
TYPO3 CMS Core Authentication BackendUserAuthentication string $BE_USER = ''
 
string $table = 'pages'
 
string $parentField = 'pid'
 
string $clause = ''
 
string $orderByFields = ''
 
array $fieldArray
 
string $defaultList = 'uid,pid,tstamp,sorting,deleted,perms_userid,perms_groupid,perms_user,perms_group,perms_everybody,crdate,cruser_id'
 
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

 determineScriptUrl ()
 
string getThisScript ()
 
LanguageService getLanguageService ()
 
BackendUserAuthentication getBackendUser ()
 

Detailed Description

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

Definition at line 36 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 209 of file AbstractTreeView.php.

References $GLOBALS.

◆ addTagAttributes()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::addTagAttributes (   $icon,
  $attr 
)

Adds attributes to image tag.

Parameters
string$icon‪Icon image tag
string$attr‪Attributes to add, eg. ' border="0"'
Returns
‪string Image tag, modified with $attr attributes added.

Definition at line 275 of file AbstractTreeView.php.

◆ determineScriptUrl()

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

Sets the script url depending on being a module or script request

Definition at line 165 of file AbstractTreeView.php.

References $GLOBALS.

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

◆ 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\NewRecordPageTreeView, and TYPO3\CMS\Backend\Tree\View\PageTreeView.

Definition at line 295 of file AbstractTreeView.php.

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

◆ getBackendUser()

◆ getCount()

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

Returns the number of records having the parent id, $uid

Parameters
int$uid‪Id to count subitems for
Returns
‪int

Definition at line 465 of file AbstractTreeView.php.

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

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

◆ getDataCount()

int TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getDataCount ( $res)

Getting the tree data: Counting elements in resource

Parameters
mixed$res‪Data handle
Returns
‪int number of items
See also
getDataInit()

Definition at line 542 of file AbstractTreeView.php.

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

◆ getDataFree()

TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getDataFree ( $res)

Getting the tree data: frees data handle

Parameters
mixed$res‪Data handle

Definition at line 573 of file AbstractTreeView.php.

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

◆ getDataInit()

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

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 508 of file AbstractTreeView.php.

References 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)

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 556 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 (   $row)

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 323 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title, TYPO3\CMS\Backend\Tree\View\AbstractTreeView\getTitleAttrib(), and TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

Referenced by TYPO3\CMS\Info\Controller\TranslationStatusController\renderL10nTable().

◆ getLanguageService()

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

◆ getRootIcon()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getRootIcon (   $rec)

Returns the root icon for a tree/mountpoint (defaults to the globe)

Parameters
array$rec‪Record for root.
Returns
‪string Icon image tag.

Definition at line 311 of file AbstractTreeView.php.

References TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL.

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

◆ getRootRecord()

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getRootRecord ( )

Returns root record for uid (<=0)

Returns
‪array Array with title/uid keys with values of $this->title/0 (zero)

Definition at line 493 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title.

◆ getThisScript()

string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::getThisScript ( )
protected

◆ getTitleAttrib()

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

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, and TYPO3\CMS\Backend\Tree\View\BrowseTreeView.

Definition at line 362 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 
)

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, and TYPO3\CMS\Backend\Tree\View\BrowseTreeView.

Definition at line 350 of file AbstractTreeView.php.

References TYPO3\CMS\Backend\Tree\View\AbstractTreeView\$title, 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, TYPO3\CMS\Backend\Tree\View\BrowseTreeView, and TYPO3\CMS\Backend\Tree\View\PageTreeView.

Definition at line 190 of file AbstractTreeView.php.

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

◆ PM_ATagWrap()

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

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

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

Definition at line 260 of file AbstractTreeView.php.

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

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

◆ PMicon()

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

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 244 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 219 of file AbstractTreeView.php.

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

Member Data Documentation

◆ $BE_USER

TYPO3 CMS Core Authentication BackendUserAuthentication string TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$BE_USER = ''

Needs to be initialized with $GLOBALS['BE_USER'] Done by default in init()

Definition at line 55 of file AbstractTreeView.php.

◆ $buffer_idH

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

◆ $clause

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

◆ $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,cruser_id'

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

See also
addField()

Definition at line 115 of file AbstractTreeView.php.

◆ $fieldArray

array TYPO3\CMS\Backend\Tree\View\AbstractTreeView::$fieldArray
Initial value:
= array(
'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 90 of file AbstractTreeView.php.

◆ $ids

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

Definition at line 130 of file AbstractTreeView.php.

◆ $ids_hierarchy

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

Definition at line 135 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 121 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 140 of file AbstractTreeView.php.

◆ $parentField

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

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

Definition at line 68 of file AbstractTreeView.php.

◆ $table

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

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

Definition at line 62 of file AbstractTreeView.php.

◆ $thisScript

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

Definition at line 43 of file AbstractTreeView.php.

◆ $title

◆ $tree

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