Stud.IP  4.2 Revision
ActionMenu Class Reference
Collaboration diagram for ActionMenu:
Collaboration graph

Public Member Functions

 condition ($state)
 
 conditionAll ($state)
 
 addLink ($link, $label, Icon $icon=null, array $attributes=[])
 
 addButton ($name, $label, Icon $icon=null, array $attributes=[])
 
 addMultiPersonSearch (MultiPersonSearch $mp)
 
 render ()
 
 __toString ()
 

Static Public Member Functions

static get ()
 

Data Fields

const THRESHOLD = 1
 
const TEMPLATE_FILE_SINGLE = 'shared/action-menu-single.php'
 
const TEMPLATE_FILE_MULTIPLE = 'shared/action-menu.php'
 

Protected Member Functions

 checkCondition ()
 

Detailed Description

This class represents the action menu used to group actions.

Author
Jan-Hendrik Willms tleil.nosp@m.ax+s.nosp@m.tudip.nosp@m.@gma.nosp@m.il.co.nosp@m.m GPL2 or any later version
Since
Stud.IP 3.5

Member Function Documentation

◆ __toString()

__toString ( )

Magic method to render the menu as a string.

Returns
String containing the html representation of the action menu
See also
ActionMenu::render()
Here is the call graph for this function:

◆ addButton()

addButton (   $name,
  $label,
Icon  $icon = null,
array  $attributes = [] 
)

Adds a button to the list of actions.

Parameters
String$nameButton name
String$labelTextual representation of the name
mixed$iconOptional icon (as Icon object)
array$attributesOptional attributes to add to the tag
Returns
ActionMenu instance to allow chaining
Here is the call graph for this function:

◆ addLink()

addLink (   $link,
  $label,
Icon  $icon = null,
array  $attributes = [] 
)

Adds a link to the list of actions.

Parameters
String$linkLink target
String$labelTextual representation of the link
mixed$iconOptional icon (as Icon object)
array$attributesOptional attributes to add to the tag
Returns
ActionMenu instance to allow chaining
Here is the call graph for this function:

◆ addMultiPersonSearch()

addMultiPersonSearch ( MultiPersonSearch  $mp)

Adds a MultiPersonSearch object to the list of actions.

Parameters
MultiPersonSearch$mpMultiPersonSearch object
Returns
ActionMenu instance to allow chaining
Here is the call graph for this function:

◆ checkCondition()

checkCondition ( )
protected

Checks the condition. Takes global and local (conditionAll() & condition()) conditions into account.

Returns
bool indicating whether the condition is met or not
Here is the call graph for this function:
Here is the caller graph for this function:

◆ condition()

condition (   $state)

Set condition for the next added item. If condition is false, the item will not be added.

Parameters
bool$stateState of the condition
Returns
ActionMenu instance to allow chaining
Here is the caller graph for this function:

◆ conditionAll()

conditionAll (   $state)

Set condition for all the next added items. If condition is false, no items will be added.

Parameters
bool$stateState of the condition
Returns
ActionMenu instance to allow chaining

◆ get()

static get ( )
static

Returns an instance.

Returns
ActionMenu

◆ render()

render ( )

Renders the action menu. If no item was added, an empty string will be returned. If a single item was added, the item itself will be displayed. Otherwise the whole menu will be rendered.

Returns
String containing the html representation of the action menu
Here is the caller graph for this function:

Field Documentation

◆ TEMPLATE_FILE_MULTIPLE

const TEMPLATE_FILE_MULTIPLE = 'shared/action-menu.php'

◆ TEMPLATE_FILE_SINGLE

const TEMPLATE_FILE_SINGLE = 'shared/action-menu-single.php'

◆ THRESHOLD

const THRESHOLD = 1

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