Elgg  Version 1.9
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ElggMenuBuilder Class Reference

Public Member Functions

 __construct (array $menu)
 ElggMenuBuilder constructor. More...
 
 getMenu ($sort_by= 'text')
 Get a prepared menu array. More...
 
 getSelected ()
 Get the selected menu item. More...
 

Static Public Member Functions

static compareByText ($a, $b)
 Compare two menu items by their display text. More...
 
static compareByName ($a, $b)
 Compare two menu items by their identifiers. More...
 
static compareByPriority ($a, $b)
 Compare two menu items by their priority. More...
 
static compareByWeight ($a, $b)
 Compare two menu items by their priority. More...
 

Protected Member Functions

 selectFromContext ()
 Select menu items for the current context. More...
 
 setupSections ()
 Group the menu items into sections. More...
 
 setupTrees ()
 Create trees for each menu section. More...
 
 findSelected ()
 Find the menu item that is currently selected. More...
 
 sort ($sort_by)
 Sort the menu sections and trees. More...
 

Protected Attributes

 $menu = array()
 
 $selected = null
 

Detailed Description

Examples:
/root/Elgg/engine/lib/views.php.

Definition at line 9 of file ElggMenuBuilder.php.

Constructor & Destructor Documentation

ElggMenuBuilder::__construct ( array  $menu)

ElggMenuBuilder constructor.

Parameters
ElggMenuItem[]$menu Array of ElggMenuItem objects

Definition at line 23 of file ElggMenuBuilder.php.

Member Function Documentation

static ElggMenuBuilder::compareByName (   $a,
  $b 
)
static

Compare two menu items by their identifiers.

Parameters
ElggMenuItem$aMenu item
ElggMenuItem$bMenu item
Returns
bool

Definition at line 262 of file ElggMenuBuilder.php.

static ElggMenuBuilder::compareByPriority (   $a,
  $b 
)
static

Compare two menu items by their priority.

Parameters
ElggMenuItem$aMenu item
ElggMenuItem$bMenu item
Returns
bool
Since
1.9.0

Definition at line 281 of file ElggMenuBuilder.php.

static ElggMenuBuilder::compareByText (   $a,
  $b 
)
static

Compare two menu items by their display text.

Parameters
ElggMenuItem$aMenu item
ElggMenuItem$bMenu item
Returns
bool

Definition at line 244 of file ElggMenuBuilder.php.

static ElggMenuBuilder::compareByWeight (   $a,
  $b 
)
static

Compare two menu items by their priority.

Parameters
ElggMenuItem$aMenu item
ElggMenuItem$bMenu item
Returns
bool

Definition at line 299 of file ElggMenuBuilder.php.

ElggMenuBuilder::findSelected ( )
protected

Find the menu item that is currently selected.

Returns
ElggMenuItem

Definition at line 156 of file ElggMenuBuilder.php.

ElggMenuBuilder::getMenu (   $sort_by = 'text')

Get a prepared menu array.

Parameters
mixed$sort_byMethod to sort the menu by.
See also
ElggMenuBuilder::sort()
Returns
array

Definition at line 33 of file ElggMenuBuilder.php.

ElggMenuBuilder::getSelected ( )

Get the selected menu item.

Returns
ElggMenuItem

Definition at line 53 of file ElggMenuBuilder.php.

ElggMenuBuilder::selectFromContext ( )
protected

Select menu items for the current context.

Returns
void

Definition at line 62 of file ElggMenuBuilder.php.

ElggMenuBuilder::setupSections ( )
protected

Group the menu items into sections.

Returns
void

Definition at line 88 of file ElggMenuBuilder.php.

ElggMenuBuilder::setupTrees ( )
protected

Create trees for each menu section.

Definition at line 105 of file ElggMenuBuilder.php.

ElggMenuBuilder::sort (   $sort_by)
protected

Sort the menu sections and trees.

Parameters
mixed$sort_bySort type as string or php callback
Returns
void

Definition at line 184 of file ElggMenuBuilder.php.

Member Data Documentation

ElggMenuBuilder::$menu = array()
protected

Definition at line 14 of file ElggMenuBuilder.php.

ElggMenuBuilder::$selected = null
protected

Definition at line 16 of file ElggMenuBuilder.php.


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