Stud.IP  2.0 Revision 48548
 All Data Structures Namespaces Files Functions Variables Pages
Navigation Class Reference
Inheritance diagram for Navigation:
Inheritance graph
Collaboration diagram for Navigation:
Collaboration graph

Public Member Functions

 __construct ($title, $url=NULL, $params=NULL)
 getImage ()
 getTitle ()
 getDescription ()
 getURL ()
 isActive ()
 isEnabled ()
 isVisible ($needs_image=false)
 setActive ($active)
 setEnabled ($enabled)
 setImage ($image, $options=array())
 setTitle ($title)
 setDescription ($description)
 setURL ($url, $params=NULL)
 activeSubNavigation ()
 addSubNavigation ($name, Navigation $navigation)
 insertSubNavigation ($name, Navigation $navigation, $where)
 getSubNavigation ()
 removeSubNavigation ($name)
 getIterator ()

Static Public Member Functions

static activateItem ($path)
static addItem ($path, Navigation $navigation)
static insertItem ($path, Navigation $navigation, $where)
static removeItem ($path)
static getItem ($path)
static hasItem ($path)
static setRootNavigation (Navigation $navigation)

Protected Member Functions

 initSubNavigation ()

Protected Attributes

 $active
 $enabled
 $image
 $params
 $subnav
 $title
 $description
 $url

Detailed Description

This is the navigation base class that maintains the global navigation structure. All navigation objects are stored in a tree and can be accessed by their "path names", just like file names in a normal file system. The "root" of the tree is '/'.

So you can do for example:

$navigation = new Navigation('Home', 'index.php'); $profilenav = new Navigation('Profile', 'profile.php');

$navigation->addSubNavigation('profile', $profilenav);

Navigation::addItem('/home', $navigation); Navigation::activateItem('/home/profile');

Constructor & Destructor Documentation

__construct (   $title,
  $url = NULL,
  $params = NULL 
)

Initialize a new Navigation instance with the given title and URL (optional).

Here is the call graph for this function:

Member Function Documentation

static activateItem (   $path)
static

Mark the navigation item at the given path as active. This is just a shortcut for doing:

Navigation::getItem($path)->setActive(true)

Parameters
string$pathpath of navigation item

Here is the call graph for this function:

Here is the caller graph for this function:

activeSubNavigation ( )

Get the active subnavigation item of this navigation (if there is one). Returns NULL if the subnavigation has no active item.

Here is the caller graph for this function:

static addItem (   $path,
Navigation  $navigation 
)
static

Add a new navigation item at the given path. If there is already an item with this path, the old one is replaced by the new item.

Parameters
string$pathpath of new navigation item
object$navigationnavigation item to add

Here is the call graph for this function:

Here is the caller graph for this function:

addSubNavigation (   $name,
Navigation  $navigation 
)

Add the given item to the subnavigation of this object. This also assigns a name to this subnavigation item. If there is already a subitem with this name, the old one is replaced by the new item.

Parameters
string$namename of new navigation item
object$navigationnavigation item to add

Here is the call graph for this function:

Here is the caller graph for this function:

getDescription ( )

Return the description associated with this navigation item.

Returns
string description of item or NULL (no description set)
getImage ( )

Return the current image attributes associated with this navigation item. Attributes are returned as an array with at least the 'src' key set.

Returns
array image attributes of item or NULL (no image)
static getItem (   $path)
static

Return the navigation item at the given path.

Parameters
string$pathpath of navigation item
Exceptions
InvalidArgumentExceptionif the item cannot be found

Here is the caller graph for this function:

getIterator ( )

IteratorAggregate: Create interator for request parameters.

Here is the call graph for this function:

getSubNavigation ( )

Return the list of subnavigation items of this object.

Here is the call graph for this function:

Here is the caller graph for this function:

getTitle ( )

Return the current title associated with this navigation item.

Returns
string title of item or NULL (no title set)

Here is the caller graph for this function:

getURL ( )

Return the current URL associated with this navigation item. If not URL is set but there are subnavigation items, the URL of the first visible subnavigation item is returned.

Returns
string url of item or NULL (no URL set)

Reimplemented in PluginNavigation, and HelpNavigation.

Here is the call graph for this function:

Here is the caller graph for this function:

static hasItem (   $path)
static

Test whether there is a navigation item at the given path.

Parameters
string$pathpath of navigation item

Here is the call graph for this function:

Here is the caller graph for this function:

initSubNavigation ( )
protected

Initialize the subnavigation of this item. This method is called once before the first item is added or removed.

Reimplemented in ProfileNavigation, StartNavigation, CourseNavigation, MessagingNavigation, CommunityNavigation, BrowseNavigation, CalendarNavigation, StudipNavigation, SearchNavigation, ToolsNavigation, AdminNavigation, and LoginNavigation.

Here is the caller graph for this function:

static insertItem (   $path,
Navigation  $navigation,
  $where 
)
static

Add a new navigation item at the given path. The new item is inserted immediately before the item with the name given by $where (at the same level in the tree).

Parameters
string$pathpath of new navigation item
object$navigationnavigation item to add
string$whereinsert it before this item

Here is the call graph for this function:

Here is the caller graph for this function:

insertSubNavigation (   $name,
Navigation  $navigation,
  $where 
)

Add the given item to the subnavigation of this object. The new item is inserted immediately before the item with the name given by $where (if there is one, it is appended to the end otherwise). This also assigns a name to this subnavigation item.

Parameters
string$namename of new navigation item
object$navigationnavigation item to add
string$whereinsert it before this item

Here is the call graph for this function:

isActive ( )

Determine whether this navigation item is active.

Reimplemented in ProfileNavigation, StartNavigation, and AutoNavigation.

Here is the call graph for this function:

isEnabled ( )

Return whether this navigation item is enabled.

isVisible (   $needs_image = false)

Return whether this navigation item is visible.

Parameters
boolean$needs_imagerequires an image

Here is the call graph for this function:

static removeItem (   $path)
static

Remove the navigation item at the given path (if there is an item with this path).

Parameters
string$pathpath of item to remove

Here is the call graph for this function:

Here is the caller graph for this function:

removeSubNavigation (   $name)

Remove the given item from the subnavigation of this object (if there is an item with this name).

Parameters
string$namename of item to remove

Here is the call graph for this function:

Here is the caller graph for this function:

setActive (   $active)

Set the active status of this item. This can be used to override heuristics used by the class to determine this automatically.

Parameters
boolean$activenew active status

Reimplemented in PluginNavigation.

Here is the caller graph for this function:

setDescription (   $description)

Set the description of this navigation item.

Parameters
string$descriptiondescription text
setEnabled (   $enabled)

Set the enabled status of this item. Disabled items are still visible but cannot be clicked.

Parameters
boolean$enablednew enabled status

Here is the caller graph for this function:

setImage (   $image,
  $options = array() 
)

Set the image of this navigation item. Additional HTML attributes can be passed using the $options parameter (like 'title', 'style' or 'onclick').

Parameters
string$imagepath to image file
array$optionsadditional image attributes

Here is the call graph for this function:

Here is the caller graph for this function:

static setRootNavigation ( Navigation  $navigation)
static

Set the root of the navigation tree. Must be called before any further items can be added to the tree.

Parameters
object$navigationroot navigation item
setTitle (   $title)

Set the title of this navigation item.

Parameters
string$titledisplay title

Here is the caller graph for this function:

setURL (   $url,
  $params = NULL 
)

Set the URL of this navigation item. Additional URL parameters can be passed using the (optional) second parameter.

Parameters
string$titledisplay title
array$paramsadditional URL parameters

Here is the caller graph for this function:

Field Documentation

$active
protected
$description
protected
$enabled
protected
$image
protected
$params
protected
$subnav
protected
$title
protected
$url
protected

The documentation for this class was generated from the following file: