|
Moodle
2.2.1
http://www.collinsharper.com
|


Public Member Functions | |
| __construct ($properties) | |
| check_if_active ($strength=URL_MATCH_EXACT) | |
| add ($text, $action=null, $type=self::TYPE_CUSTOM, $shorttext=null, $key=null, pix_icon $icon=null) | |
| add_node (navigation_node $childnode, $beforekey=null) | |
| get_children_key_list () | |
| find ($key, $type) | |
| get ($key, $type=null) | |
| remove () | |
| has_children () | |
| make_active () | |
| make_inactive () | |
| force_open () | |
| add_class ($class) | |
| remove_class ($class) | |
| title ($title) | |
| __wakeup () | |
| contains_active_node () | |
| find_active_node () | |
| search_for_active_node () | |
| get_content ($shorttext=false) | |
| get_title () | |
| get_css_type () | |
| find_expandable (array &$expandable) | |
| find_all_of_type ($type) | |
| trim_if_empty () | |
| get_tabs_array (array $inactive=array(), $return=false) | |
| set_parent (navigation_node $parent) | |
Static Public Member Functions | |
| static | override_active_url (moodle_url $url) |
| static | create ($text, $action=null, $type=self::TYPE_CUSTOM, $shorttext=null, $key=null, pix_icon $icon=null) |
Data Fields | |
| const | NODETYPE_LEAF = 0 |
| const | NODETYPE_BRANCH = 1 |
| const | TYPE_UNKNOWN = null |
| const | TYPE_ROOTNODE = 0 |
| const | TYPE_SYSTEM = 1 |
| const | TYPE_CATEGORY = 10 |
| const | TYPE_COURSE = 20 |
| const | TYPE_SECTION = 30 |
| const | TYPE_ACTIVITY = 40 |
| const | TYPE_RESOURCE = 50 |
| const | TYPE_CUSTOM = 60 |
| const | TYPE_SETTING = 70 |
| const | TYPE_USER = 80 |
| const | TYPE_CONTAINER = 90 |
| $id = null | |
| $key = null | |
| $text = null | |
| $shorttext = null | |
| $title = null | |
| $helpbutton = null | |
| $action = null | |
| $icon = null | |
| $type = self::TYPE_UNKNOWN | |
| $nodetype = self::NODETYPE_LEAF | |
| $collapse = false | |
| $forceopen = false | |
| $classes = array() | |
| $children = array() | |
| $isactive = false | |
| $hidden = false | |
| $display = true | |
| $preceedwithhr = false | |
| $mainnavonly = false | |
| $forcetitle = false | |
| $parent = null | |
| $hideicon = false | |
| $includesectionnum = false | |
Static Public Attributes | |
| static | $autofindactive = true |
Protected Attributes | |
| $namedtypes = array(0=>'system',10=>'category',20=>'course',30=>'structure',40=>'activity',50=>'resource',60=>'custom',70=>'setting', 80=>'user') | |
Static Protected Attributes | |
| static | $fullmeurl = null |
Definition at line 50 of file navigationlib.php.
| __construct | ( | $ | properties | ) |
Constructs a new navigation_node
| array | string | $properties | Either an array of properties or a string to use as the text for the node |
Definition at line 139 of file navigationlib.php.

| __wakeup | ( | ) |
Resets the page specific information on this node if it is being unserialised.
Definition at line 473 of file navigationlib.php.

| add | ( | $ | text, |
| $ | action = null, |
||
| $ | type = self::TYPE_CUSTOM, |
||
| $ | shorttext = null, |
||
| $ | key = null, |
||
| pix_icon $ | icon = null |
||
| ) |
Adds a navigation node as a child of this node.
| string | $text | |
| moodle_url | action_link | $action | |
| int | $type | |
| string | $shorttext | |
| string | int | $key | |
| pix_icon | $icon |
Reimplemented in settings_navigation, and navbar.
Definition at line 288 of file navigationlib.php.


| add_class | ( | $ | class | ) |
Adds a CSS class to this node.
| string | $class |
Definition at line 437 of file navigationlib.php.

| add_node | ( | navigation_node $ | childnode, |
| $ | beforekey = null |
||
| ) |
Adds a navigation node as a child of this one, given a $node object created using the create function.
| navigation_node | $childnode | Node to add |
| int | string | $key | The key of a node to add this before. If not specified, adds at end of list |
Definition at line 304 of file navigationlib.php.


| check_if_active | ( | $ | strength = URL_MATCH_EXACT | ) |
Checks if this node is the active node.
This is determined by comparing the action for the node against the defined URL for the page. A match will see this node marked as active.
| int | $strength | One of URL_MATCH_EXACT, URL_MATCH_PARAMS, or URL_MATCH_BASE |
Definition at line 208 of file navigationlib.php.


Checks if this node or any of its children contain the active node.
Recursive.
Definition at line 486 of file navigationlib.php.

| static create | ( | $ | text, |
| $ | action = null, |
||
| $ | type = self::TYPE_CUSTOM, |
||
| $ | shorttext = null, |
||
| $ | key = null, |
||
| pix_icon $ | icon = null |
||
| ) | [static] |
Creates a navigation node, ready to add it as a child using add_node function. (The created node needs to be added before you can use it.)
| string | $text | |
| moodle_url | action_link | $action | |
| int | $type | |
| string | $shorttext | |
| string | int | $key | |
| pix_icon | $icon |
Definition at line 252 of file navigationlib.php.

| find | ( | $ | key, |
| $ | type | ||
| ) |
Searches for a node of the given type with the given key.
This searches this node plus all of its children, and their children.... If you know the node you are looking for is a child of this node then please use the get method instead.
| int | string | $key | The key of the node we are looking for |
| int | $type | One of navigation_node::TYPE_* |
Reimplemented in global_navigation.
Definition at line 353 of file navigationlib.php.
| find_active_node | ( | ) |
Finds the active node.
Searches this nodes children plus all of the children for the active node and returns it if found.
Recursive.
Definition at line 509 of file navigationlib.php.
| find_all_of_type | ( | $ | type | ) |
Finds all nodes of a given type (recursive)
| int | $type | On of navigation_node::TYPE_* |
Definition at line 602 of file navigationlib.php.

| find_expandable | ( | array &$ | expandable | ) |
Finds all nodes that are expandable by AJAX
| array | $expandable | An array by reference to populate with expandable nodes. |
Definition at line 585 of file navigationlib.php.


| force_open | ( | ) |
Forces this node to be open and at the same time forces open all parents until the root node.
Recursive.
Definition at line 424 of file navigationlib.php.

| get | ( | $ | key, |
| $ | type = null |
||
| ) |
Get ths child of this node that has the given key + (optional) type.
If you are looking for a node and want to search all children + thier children then please use the find method instead.
| int | string | $key | The key of the node we are looking for |
| int | $type | One of navigation_node::TYPE_* |
Reimplemented in navbar, and global_navigation.
Definition at line 367 of file navigationlib.php.

Return a list of all the keys of all the child nodes.
Definition at line 338 of file navigationlib.php.
| get_content | ( | $ | shorttext = false | ) |
Gets the content for this node.
| bool | $shorttext | If true shorttext is used rather than the normal text |
Definition at line 547 of file navigationlib.php.


| get_css_type | ( | ) |
Gets the CSS class to add to this node to describe its type
Definition at line 573 of file navigationlib.php.
| get_tabs_array | ( | array $ | inactive = array(), |
| $ | return = false |
||
| ) |
Creates a tab representation of this nodes children that can be used with print_tabs to produce the tabs on a page.
call_user_func_array('print_tabs', $node->get_tabs_array());
| array | $inactive | |
| bool | $return |
Definition at line 630 of file navigationlib.php.
| get_title | ( | ) |
Gets the title to use for this node.
Definition at line 560 of file navigationlib.php.


| has_children | ( | ) |
Checks if this node has or could have any children
Definition at line 385 of file navigationlib.php.

| make_active | ( | ) |
Marks this node as active and forces it open.
Important: If you are here because you need to mark a node active to get the navigation to do what you want have you looked at {
Definition at line 397 of file navigationlib.php.


| make_inactive | ( | ) |
Marks a node as inactive and recusised back to the base of the tree doing the same to all parents.
Definition at line 410 of file navigationlib.php.

| static override_active_url | ( | moodle_url $ | url | ) | [static] |
This sets the URL that the URL of new nodes get compared to when locating the active node.
The active node is the node that matches the URL set here. By default this is either $PAGE->url or if that hasn't been set $FULLME.
| moodle_url | $url | The url to use for the fullmeurl. |
Definition at line 236 of file navigationlib.php.

| remove | ( | ) |
| remove_class | ( | $ | class | ) |
Removes a CSS class from this node.
| string | $class |
Definition at line 450 of file navigationlib.php.

Searches all children for the best matching active node
Definition at line 527 of file navigationlib.php.


| set_parent | ( | navigation_node $ | parent | ) |
Sets the parent for this node and if this node is active ensures that the tree is properly adjusted as well.
| navigation_node | $parent |
Definition at line 660 of file navigationlib.php.

| title | ( | $ | title | ) |
Sets the title for this node and forces Moodle to utilise it.
| string | $title |
Definition at line 465 of file navigationlib.php.

| trim_if_empty | ( | ) |
Removes this node if it is empty
Definition at line 614 of file navigationlib.php.
| $action = null |
Definition at line 93 of file navigationlib.php.
$autofindactive = true [static] |
Definition at line 129 of file navigationlib.php.
| $children = array() |
Reimplemented in navbar.
Definition at line 107 of file navigationlib.php.
| $classes = array() |
Definition at line 105 of file navigationlib.php.
| $collapse = false |
Definition at line 101 of file navigationlib.php.
Definition at line 113 of file navigationlib.php.
| $forceopen = false |
Definition at line 103 of file navigationlib.php.
| $forcetitle = false |
Definition at line 119 of file navigationlib.php.
$fullmeurl = null [static, protected] |
Definition at line 127 of file navigationlib.php.
| $helpbutton = null |
Definition at line 91 of file navigationlib.php.
| $hidden = false |
Definition at line 111 of file navigationlib.php.
| $hideicon = false |
Definition at line 123 of file navigationlib.php.
| $icon = null |
Definition at line 95 of file navigationlib.php.
| $id = null |
Definition at line 81 of file navigationlib.php.
| $includesectionnum = false |
Definition at line 131 of file navigationlib.php.
| $isactive = false |
Definition at line 109 of file navigationlib.php.
| $key = null |
Definition at line 83 of file navigationlib.php.
| $mainnavonly = false |
Definition at line 117 of file navigationlib.php.
$namedtypes = array(0=>'system',10=>'category',20=>'course',30=>'structure',40=>'activity',50=>'resource',60=>'custom',70=>'setting', 80=>'user') [protected] |
Definition at line 125 of file navigationlib.php.
| $nodetype = self::NODETYPE_LEAF |
Definition at line 99 of file navigationlib.php.
| $parent = null |
Definition at line 121 of file navigationlib.php.
| $preceedwithhr = false |
Definition at line 115 of file navigationlib.php.
| $shorttext = null |
Definition at line 87 of file navigationlib.php.
| $text = null |
Definition at line 85 of file navigationlib.php.
| $title = null |
Definition at line 89 of file navigationlib.php.
| $type = self::TYPE_UNKNOWN |
Definition at line 97 of file navigationlib.php.
| const NODETYPE_BRANCH = 1 |
Definition at line 54 of file navigationlib.php.
| const NODETYPE_LEAF = 0 |
Definition at line 52 of file navigationlib.php.
| const TYPE_ACTIVITY = 40 |
Definition at line 68 of file navigationlib.php.
| const TYPE_CATEGORY = 10 |
Definition at line 62 of file navigationlib.php.
| const TYPE_CONTAINER = 90 |
Definition at line 78 of file navigationlib.php.
| const TYPE_COURSE = 20 |
Definition at line 64 of file navigationlib.php.
| const TYPE_CUSTOM = 60 |
Definition at line 72 of file navigationlib.php.
| const TYPE_RESOURCE = 50 |
Definition at line 70 of file navigationlib.php.
| const TYPE_ROOTNODE = 0 |
Definition at line 58 of file navigationlib.php.
| const TYPE_SECTION = 30 |
Definition at line 66 of file navigationlib.php.
| const TYPE_SETTING = 70 |
Definition at line 74 of file navigationlib.php.
| const TYPE_SYSTEM = 1 |
Definition at line 60 of file navigationlib.php.
| const TYPE_UNKNOWN = null |
Definition at line 56 of file navigationlib.php.
| const TYPE_USER = 80 |
Definition at line 76 of file navigationlib.php.