Elgg  Version 2.2
 All Classes Namespaces Files Functions Variables Pages
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)
 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 HTML tags are stripped before comparison. 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

Definition at line 9 of file ElggMenuBuilder.php.

Constructor & Destructor Documentation

ElggMenuBuilder::__construct ( array  $menu)

constructor

Parameters
\ElggMenuItem[]$menu Array of 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 287 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 306 of file ElggMenuBuilder.php.

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

Compare two menu items by their display text HTML tags are stripped before comparison.

Parameters
\ElggMenuItem$aMenu item
\ElggMenuItem$bMenu item
Returns
bool

Definition at line 269 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 324 of file ElggMenuBuilder.php.

ElggMenuBuilder::findSelected ( )
protected

Find the menu item that is currently selected.

Returns

Definition at line 180 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
::sort()
Returns
array

Definition at line 33 of file ElggMenuBuilder.php.

ElggMenuBuilder::getSelected ( )

Get the selected menu item.

Returns

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 208 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: