Moodle  2.2.1
http://www.collinsharper.com
custom_menu Class Reference
Inheritance diagram for custom_menu:
Collaboration diagram for custom_menu:

Public Member Functions

 __construct ($definition= '', $currentlanguage=null)
 override_children (array $children)

Static Public Member Functions

static convert_text_to_menu_nodes ($text, $language=null)
static sort_custom_menu_items (custom_menu_item $itema, custom_menu_item $itemb)

Protected Attributes

 $currentlanguage = null

Detailed Description

Custom menu class

This class is used to operate a custom menu that can be rendered for the page. The custom menu is built using $CFG->custommenuitems and is a structured collection of custom_menu_item nodes that can be rendered by the core renderer.

To configure the custom menu: Settings: Administration > Appearance > Themes > Theme settings

Since:
Moodle 2.0

Definition at line 2416 of file outputcomponents.php.


Constructor & Destructor Documentation

__construct ( definition = '',
currentlanguage = null 
)

Creates the custom menu

Parameters:
string$definitionthe menu items definition in syntax required by convert_text_to_menu_nodes()
string$languagethe current language code, null disables multilang support

Definition at line 2427 of file outputcomponents.php.

Here is the call graph for this function:


Member Function Documentation

static convert_text_to_menu_nodes ( text,
language = null 
) [static]

Converts a string into a structured array of custom_menu_items which can then be added to a custom menu.

Structure: text|url|title|langs The number of hyphens at the start determines the depth of the item. The languages are optional, comma separated list of languages the line is for.

Example structure: First level first item|http://www.moodle.com/ -Second level first item|http://www.moodle.com/partners/ -Second level second item|http://www.moodle.com/hq/ --Third level first item|http://www.moodle.com/jobs/ -Second level third item|http://www.moodle.com/development/ First level second item|http://www.moodle.com/feedback/ First level third item English only|http://moodle.com|English only item|en German only|http://moodle.de|Deutsch|de,de_du,de_kids

Parameters:
string$textthe menu items definition
string$languagethe language code, null disables multilang support
Returns:
array

Definition at line 2475 of file outputcomponents.php.

override_children ( array children)

Overrides the children of this custom menu. Useful when getting children from $CFG->custommenuitems

Definition at line 2440 of file outputcomponents.php.

Here is the caller graph for this function:

static sort_custom_menu_items ( custom_menu_item itema,
custom_menu_item itemb 
) [static]

Sorts two custom menu items

This function is designed to be used with the usort method usort($this->children, array('custom_menu','sort_custom_menu_items'));

Parameters:
custom_menu_item$itema
custom_menu_item$itemb
Returns:
int

Definition at line 2561 of file outputcomponents.php.

Here is the call graph for this function:


Field Documentation

$currentlanguage = null [protected]

Definition at line 2419 of file outputcomponents.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations