Versatile class for drawing dynamically navigation elements according to user preferences.

// Initializes the class
$navigation = new fi_protie_navigation();

// Display only nodes (folders)
$navigation->list_leaves = false;

// Expand the whole site tree instead of the active path
$navigation->follow_all = true;

// Skip 1 level from the beginning of the active path
$navigation->skip_levels = 1;

// Finally draw the navigation
$navigation->draw();

See the attributes of this class for additional customizing options.

package fi.protie.navigation

 Methods

__construct ($id)

Constructor method.

Here we initialize the classes and variables needed through the class.

Parameters

$id

draw ()

Method for drawing the navigation.

get_node_path ()

Traverses through the node path to fetch the location of the current navigation access point.
Static

listen_parameter ($name, $value)

Parameters

$name

$value

set_root_element_id (string $id)

Set the root element id

Parameters

$id

stringroot ul id

_display_element ($item, $indent, $css_classes)

Parameters

$item

$indent

$css_classes

_get_css_classes ($child, $item, $item_counter, $item_count)

Parameters

$child

$item

$item_counter

$item_count

_get_parameter_string ()

_list_child_elements ($id, $indent)

Traverse the child elements starting from the requested node id

Parameters

$id

$indent

_list_child_nodes ($id, $indent)

Traverse the child nodes starting from the requested node id

Parameters

$id

$indent

 Properties

   

boolean $component_name_to_class

Add component name to list item ul class name
 

string $css_active

CSS class for the current, active node or leaf.

There can be only one active element.

 

string $css_first

CSS class for first
 

string $css_first_last

CSS class for first and last together
 

string $css_has_children

CSS class for has children
 

string $css_last

CSS class for last
 

string $css_leaf

CSS class for leaves
 

string $css_list_style

CSS class for styling the lists
 

string $css_node

CSS class for nodes
 

string $css_selected

CSS class for the elements in node path.

All the elements in node path will have this class.

 

boolean $first_and_last_to_class

Add first and last-class names to list item ul class name
 

boolean $follow_all

Switch to determine if navigation should follow all the nodes or only the current
 

boolean $follow_selected

Switch to determine if navigation should follow node path (on true) or stop on the spot.
 

boolean $has_children_to_class

Check if item has children and if so, add children-class to list item ul class name
 

boolean $list_leaves

Switch to determine if navigation should display leaves or pages.
 

integer $list_levels

Restrict the amount of levels listed.
 

boolean $list_nodes

List only the leaf elements or pages
 

boolean $object_status_to_class

Should the object's status be added to list item ul class names Since this forces us to load the entire object, set it to false if you don't need it
 

integer $root_id

ID for the folder to get the navigation
 

integer $root_object_id

ID of the root level list object
 

boolean $show_only_current

Switch to determine if navigation should show only the information of the currently selected node.
 

integer $skip_levels

The amount of lowest level elements to be skipped.
 

boolean $url_name_to_class

Add URL name to list item class name
 

array $_get_params

Registered get -parameters for listening
 

integer $_level

Number of the parsed level
 

boolean $_listen_params

parameter listening enabled
 

\midcom_helper_nav $_nap

MidCOM helper class for navigation subsystem.

Uses class 'midcom.helper.nav'

 

string $_params_cache

Cache for parameters to be listened
 

Array $node_path

Stores the navigation access point history or in other words path to the current point.