Add an item to the menu array.
public add ( string $url, string $text, string $icon = '', string $icon_path = null, string $target = '', string $onclick = null, string $class = null ) | ||
$url | string | String containing the value for the hyperlink. |
$text | string | String containing the label for this menu item. |
$icon | string | String containing the filename of the image icon to display for this menu item. |
$icon_path | string | If the icon lives in a non-default directory, where is it? |
$target | string | If the link needs to open in another frame or window, what is its name? |
$onclick | string | Onclick javascript, if desired. |
$class | string | CSS class for the menu item. |
/** * @param Horde_Menu $menu A menu object */ public function menu($menu) { global $conf, $injector; if (empty($this->highlight) && basename($_SERVER['PHP_SELF']) == 'index.php') { $this->highlight = 'sesha-list'; } $menu->add(Horde::url('list.php'), _("_List Stock"), 'sesha-list', null, null, null, $this->highlight == 'sesha-list' ? 'current' : null); /* Search. */ $menu->add(Horde::url('search.php'), _("_Search"), 'sesha-search', null, null, null, $this->highlight == 'sesha-search' ? 'current' : null); if (Sesha::isAdmin(Horde_Perms::READ) || $perms->hasPermission('sesha:addStock', $GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { $menu->add(Horde::url('admin.php'), _("Administration"), 'sesha-admin'); } }
/** * Builds Koward's list of menu items. */ public function getMenu() { $menu = new Horde_Menu(); if ($this->koward->hasAccess('object/listall')) { $menu->add($this->urlFor(array('controller' => 'object', 'action' => 'listall')), _("_Objects"), 'user.png'); } if ($this->koward->hasAccess('object/add', Koward::PERM_EDIT)) { $menu->add($this->urlFor(array('controller' => 'object', 'action' => 'add')), _("_Add"), 'plus.png'); } if ($this->koward->hasAccess('object/search')) { $menu->add($this->urlFor(array('controller' => 'object', 'action' => 'search')), _("_Search"), 'search.png'); } if (!empty($this->koward->conf['koward']['menu']['queries'])) { $menu->add(Horde::url('Queries'), _("_Queries"), 'query.png'); } if (!empty($this->koward->conf['koward']['menu']['test'])) { $menu->add($this->urlFor(array('controller' => 'check', 'action' => 'show')), _("_Test"), 'problem.png'); } if ($GLOBALS['registry']->getAuth()) { $menu->add($this->urlFor(array('controller' => 'index', 'action' => 'logout')), _("_Logout"), 'logout.png'); } return $menu; }
/** */ public function menu(Horde_Menu $menu) { $menu->add(Horde::url('source.php'), _("_Browse"), 'luxor.png'); }