Logo ZenEngine Logo SourceForge.net ZenEngine
the lightweight CMS framework

ZenMenuManager

package : ZenEngine/Core
Author : Bruno Desthuilliers
Version : 0.0.5

public class ZenMenuManager

The ZenMenuManager handles access to the menu items :
It allows sequential (first, next etc) traversal of menu, access to next and previous links,finding an item by its key, etc. The menu itself (an associative array) is built by a menuMaker.

Functions

public void ZenMenuManager

Manager's constructor... dont do much except storing the menu.

Parameters :
array $menu : the menu to manage

Return : (void)

public object ZenMenuItem getFirstItem

Return the first menu item

Return : (object ZenMenuItem)

public object ZenMenuItem getNextItem

Return the next menu item

Return : (object ZenMenuItem)

public object ZenMenuItem getLastItem

Return the last menu item

Return : (object ZenMenuItem)

public object ZenMenuItem getPrevItem

Return previous menu item

Return : (object ZenMenuItem)

public mixed findItem

Find an item by it's key
I know sequential traversal of the array may not be best use of an associative array, but it seems that we need this to be properly placed for other menu and links methods, and the array should not grow that big anyway.

Parameters :
string $key : key of the item to retrieve

Return : (mixed) a ZenMenuItem or false

variables

private array $_menu

The menu itself, an associative array of key : ZenMenuItem pairs