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

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

Detailed Description

Definition at line 50 of file navigationlib.php.


Constructor & Destructor Documentation

__construct ( properties)

Constructs a new navigation_node

Parameters:
array | string$propertiesEither an array of properties or a string to use as the text for the node

Definition at line 139 of file navigationlib.php.

Here is the call graph for this function:


Member Function Documentation

__wakeup ( )

Resets the page specific information on this node if it is being unserialised.

Definition at line 473 of file navigationlib.php.

Here is the call graph for this function:

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.

Parameters:
string$text
moodle_url | action_link$action
int$type
string$shorttext
string | int$key
pix_icon$icon
Returns:
navigation_node

Reimplemented in settings_navigation, and navbar.

Definition at line 288 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

add_class ( class)

Adds a CSS class to this node.

Parameters:
string$class
Returns:
bool

Definition at line 437 of file navigationlib.php.

Here is the caller graph for this function:

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.

Parameters:
navigation_node$childnodeNode to add
int | string$keyThe key of a node to add this before. If not specified, adds at end of list
Returns:
navigation_node The added node

Definition at line 304 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
int$strengthOne of URL_MATCH_EXACT, URL_MATCH_PARAMS, or URL_MATCH_BASE
Returns:
bool

Definition at line 208 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Checks if this node or any of its children contain the active node.

Recursive.

Returns:
bool

Definition at line 486 of file navigationlib.php.

Here is the caller graph for this function:

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.)

Parameters:
string$text
moodle_url | action_link$action
int$type
string$shorttext
string | int$key
pix_icon$icon
Returns:
navigation_node

Definition at line 252 of file navigationlib.php.

Here is the caller graph for this function:

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.

Parameters:
int | string$keyThe key of the node we are looking for
int$typeOne of navigation_node::TYPE_*
Returns:
navigation_node|false

Reimplemented in global_navigation.

Definition at line 353 of file navigationlib.php.

Finds the active node.

Searches this nodes children plus all of the children for the active node and returns it if found.

Recursive.

Returns:
navigation_node|false

Definition at line 509 of file navigationlib.php.

find_all_of_type ( type)

Finds all nodes of a given type (recursive)

Parameters:
int$typeOn of navigation_node::TYPE_*
Returns:
array

Definition at line 602 of file navigationlib.php.

Here is the caller graph for this function:

find_expandable ( array &$  expandable)

Finds all nodes that are expandable by AJAX

Parameters:
array$expandableAn array by reference to populate with expandable nodes.

Definition at line 585 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the caller graph for this function:

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.

Parameters:
int | string$keyThe key of the node we are looking for
int$typeOne of navigation_node::TYPE_*
Returns:
navigation_node|false

Reimplemented in navbar, and global_navigation.

Definition at line 367 of file navigationlib.php.

Here is the caller graph for this function:

Return a list of all the keys of all the child nodes.

Returns:
array the keys.

Definition at line 338 of file navigationlib.php.

get_content ( shorttext = false)

Gets the content for this node.

Parameters:
bool$shorttextIf true shorttext is used rather than the normal text
Returns:
string

Definition at line 547 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Gets the CSS class to add to this node to describe its type

Returns:
string

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());

Parameters:
array$inactive
bool$return
Returns:
array Array (tabs, selected, inactive, activated, return)

Definition at line 630 of file navigationlib.php.

get_title ( )

Gets the title to use for this node.

Returns:
string

Definition at line 560 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Checks if this node has or could have any children

Returns:
bool Returns true if it has children or could have (by AJAX expansion)

Definition at line 385 of file navigationlib.php.

Here is the caller graph for this function:

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 {

See also:
navigation_node::override_active_url()}? You can use it to specify a different URL to match the active navigation node on rather than having to locate and manually mark a node active.

Definition at line 397 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Here is the call graph for this function:

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.

Parameters:
moodle_url$urlThe url to use for the fullmeurl.

Definition at line 236 of file navigationlib.php.

Here is the caller graph for this function:

remove ( )

Removes this node.

Returns:
bool

Definition at line 376 of file navigationlib.php.

remove_class ( class)

Removes a CSS class from this node.

Parameters:
string$class
Returns:
bool True if the class was successfully removed.

Definition at line 450 of file navigationlib.php.

Here is the caller graph for this function:

Searches all children for the best matching active node

Returns:
navigation_node|false

Definition at line 527 of file navigationlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
navigation_node$parent

Definition at line 660 of file navigationlib.php.

Here is the caller graph for this function:

title ( title)

Sets the title for this node and forces Moodle to utilise it.

Parameters:
string$title

Definition at line 465 of file navigationlib.php.

Here is the caller graph for this function:

Removes this node if it is empty

Definition at line 614 of file navigationlib.php.


Field Documentation

$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.

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.


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