This file is part of the Achievo ATK distribution.
Detailed copyright and licensing information can be found in the doc/COPYRIGHT and doc/LICENSE files which should be included in the distribution.
Peter Verhave <firstname.lastname@example.org>
This file contains several utility functions for building the application menu.
|Version:||$Revision: 3679 $ $Id: atkmenutools.inc 3679 2006-05-22 00:02:30Z guido $|
|Copyright:||(c)2000-2004 Ibuildings.nl BV|
|Todo:||The global menu functions should be moved to a class (atkMenu?)|
|License:||ATK Open Source License|
Create a new menu item
Both main menu items, separators, submenus or submenu items can be created, depending on the parameters passed.Parameters:
|String||$name:||The menuitem name. The name that is displayed in the userinterface can be influenced by putting "menu_something" in the language files, where 'something' is equal to the $name parameter. If "-" is specified as name, the item is a separator. In this case, the $url parameter should be empty.|
|String||$url:||The url to load in the main application area when the menuitem is clicked. If set to "", the menu is treated as a submenu (or a separator if $name equals "-"). The dispatch_url() method is a useful function to pass as this parameter.|
|String||$parent:||The parent menu. If omitted or set to "main", the item is added to the main menu.|
|mixed||$enable:||This parameter supports the following options: 1: menuitem is always enabled 0: menuitem is always disabled (this is useful when you want to use a function call to determine when a menuitem should be enabled. If the function returns 1 or 0, it can directly be passed to this method in the $enable parameter. array: when an array is passed, it should have the following format: array("node","action","node","action",...) When an array is passed, the menu checks user privileges. If the user has any of the node/action privileges, the menuitem is enabled. Otherwise, it's disabled.|
|int||$order:||The order in which the menuitem appears. If omitted, the items appear in the order in which they are added to the menu, with steps of 100. So, if you have a menu with default ordering and you want to place a new menuitem at the third position, pass 250 for $order.|
|$module||$module:||The name of the module that added this menuitem. It is usually not necessary to pass this parameter, but is present for backwardscompatibility reasons.|
Creates multiple (sub)menu items and/or submenu(s) at once.Parameters:
|array||$menu:||Array with menu/submenu items, in the following format: array($parent=>array(0=> array("url"=>$url, "name"=>$name)))|