Stud.IP
2.0 Revision 48548
|
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 |
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');
__construct | ( | $title, | |
$url = NULL , |
|||
$params = NULL |
|||
) |
Initialize a new Navigation instance with the given title and URL (optional).
|
static |
Mark the navigation item at the given path as active. This is just a shortcut for doing:
Navigation::getItem($path)->setActive(true)
string | $path | path of navigation item |
activeSubNavigation | ( | ) |
Get the active subnavigation item of this navigation (if there is one). Returns NULL if the subnavigation has no active item.
|
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.
string | $path | path of new navigation item |
object | $navigation | navigation item to add |
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.
string | $name | name of new navigation item |
object | $navigation | navigation item to add |
getDescription | ( | ) |
Return the description associated with this navigation item.
getImage | ( | ) |
Return the current image attributes associated with this navigation item. Attributes are returned as an array with at least the 'src' key set.
|
static |
Return the navigation item at the given path.
string | $path | path of navigation item |
InvalidArgumentException | if the item cannot be found |
getIterator | ( | ) |
IteratorAggregate: Create interator for request parameters.
getSubNavigation | ( | ) |
Return the list of subnavigation items of this object.
getTitle | ( | ) |
Return the current title associated with this navigation item.
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.
Reimplemented in PluginNavigation, and HelpNavigation.
|
static |
Test whether there is a navigation item at the given path.
string | $path | path of navigation item |
|
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.
|
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).
string | $path | path of new navigation item |
object | $navigation | navigation item to add |
string | $where | insert it before this item |
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.
string | $name | name of new navigation item |
object | $navigation | navigation item to add |
string | $where | insert it before this item |
isActive | ( | ) |
Determine whether this navigation item is active.
Reimplemented in ProfileNavigation, StartNavigation, and AutoNavigation.
isEnabled | ( | ) |
Return whether this navigation item is enabled.
isVisible | ( | $needs_image = false | ) |
Return whether this navigation item is visible.
boolean | $needs_image | requires an image |
|
static |
Remove the navigation item at the given path (if there is an item with this path).
string | $path | path of item to remove |
removeSubNavigation | ( | $name | ) |
Remove the given item from the subnavigation of this object (if there is an item with this name).
string | $name | name of item to remove |
setActive | ( | $active | ) |
Set the active status of this item. This can be used to override heuristics used by the class to determine this automatically.
boolean | $active | new active status |
Reimplemented in PluginNavigation.
setDescription | ( | $description | ) |
Set the description of this navigation item.
string | $description | description text |
setEnabled | ( | $enabled | ) |
Set the enabled status of this item. Disabled items are still visible but cannot be clicked.
boolean | $enabled | new enabled status |
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').
string | $image | path to image file |
array | $options | additional image attributes |
|
static |
Set the root of the navigation tree. Must be called before any further items can be added to the tree.
object | $navigation | root navigation item |
setTitle | ( | $title | ) |
Set the title of this navigation item.
string | $title | display title |
setURL | ( | $url, | |
$params = NULL |
|||
) |
Set the URL of this navigation item. Additional URL parameters can be passed using the (optional) second parameter.
string | $title | display title |
array | $params | additional URL parameters |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |