Stud.IP  5.4
 All Data Structures Namespaces Files Functions Variables Groups
TOCItem Class Reference

Public Member Functions

 __construct ($title)
 
 getTitle ()
 
 setTitle (string $newTitle)
 
 getIcon ()
 
 setIcon (Icon $icon)
 
 getUrl ()
 
 setUrl (string $newUrl, mixed $parameters=null)
 
 getLinkAttributes ()
 
 setLinkAttributes ($attributes)
 
 getParent ()
 
 setParent (TOCItem $newParent)
 
 getChildren ()
 
 setChildren (array $newChildren)
 
 addChild (TOCItem $newChild, $position=null)
 
 removeChild (TOCItem $child)
 
 hasChildren ()
 
 countAllChildren ()
 
 isActive ()
 
 setActive (bool $state)
 
 getActiveItem ()
 
 isRoot ()
 
 getRoot ()
 
 getPath ($separator= '/')
 
 flatten ()
 
 __toString ()
 

Data Fields

 $title = ''
 
 $icon = null
 
 $url = ''
 
 $link_attributes = []
 
 $parent = null
 
 $children = []
 
 $active = false
 

Detailed Description

Class TOCItem A representation of a single entry in a table of contents or breadcrumb. One entry contains all children.

Author
Thomas Hackl hackl.nosp@m.@dat.nosp@m.a-que.nosp@m.st.d.nosp@m.e GPL2 or any later version
Since
Stud.IP 5.0

Constructor & Destructor Documentation

__construct (   $title)

Member Function Documentation

__toString ( )

String representation of this item.

Returns
string
addChild ( TOCItem  $newChild,
  $position = null 
)

Add a new child to this item, optionally at a given position.

Parameters
TOCItem$newChild
null | int$position
Returns
$this
countAllChildren ( )

Count the elements in the hierarchy, starting at (and counting in) current item.

Returns
int
flatten ( )

Generates a flat representation of the current item and all its children and children's children.

Returns
array|TOCItem[]
getActiveItem ( )
getChildren ( )

Gets this item's children as array.

Returns
array
getIcon ( )

Get this item's icon.

Returns
Icon
getLinkAttributes ( )

Gets the additional link attributes.

Returns
array
getParent ( )

Gets this item's parent element.

Returns
null|TOCItem
getPath (   $separator = '/')

Get a string representation of the current hierarchy as breadcrumb-like path.

Parameters
string$separatorwhich separator tu use between elements?
Returns
string
getRoot ( )

Get the root element of the current hierarchy (= the element with no parent)

Returns
bool
getTitle ( )

Get the display title.

Returns
string
getUrl ( )

Get this item's URL, with additional parameters if set.

Returns
string
hasChildren ( )

Does the current item have children?

Returns
bool
isActive ( )

Check if current item is active.

Returns
bool
isRoot ( )

Is the current element the root of its hierarchy?

Returns
bool
removeChild ( TOCItem  $child)

Removes the given child.

Parameters
TOCItem$child
Returns
$this
setActive ( bool  $state)

Set active status of current item.

Parameters
bool$state
Returns
$this
setChildren ( array  $newChildren)

Sets a new array of child elements.

Parameters
array$newChildren
Returns
$this
setIcon ( Icon  $icon)

Set a new icon.

Parameters
Icon$icon
Returns
$this
setLinkAttributes (   $attributes)

Sets new additional link attributes.

Parameters
array$attributes
Returns
$this
setParent ( TOCItem  $newParent)

Sets a new parent element for this item.

Parameters
TOCItem$newParent
Returns
$this
setTitle ( string  $newTitle)

Set a new display title.

Parameters
string$newTitle
Returns
$this
setUrl ( string  $newUrl,
mixed  $parameters = null 
)

Set a new URL, optionally with additional link parameters.

Parameters
string$newUrl
mixed | null$parameters
Returns
$this

Field Documentation

$active = false
$children = []
$icon = null
$link_attributes = []
$parent = null
$title = ''
$url = ''

The documentation for this class was generated from the following file: