Return the rendered representation of the menu items.
public render ( ) : Horde_View_Sidebar | ||
Результат | Horde_View_Sidebar | Sidebar view of menu elements. |
function getMenu($returnType = 'object') { global $registry; $menu = new Horde_Menu(); $menu->addArray(array('url' => Horde::url('summary.php'), 'text' => _("Summary"), 'icon' => 'fax.png')); $menu->addArray(array('url' => Horde::url('folder.php'), 'text' => _("Folders"), 'icon' => 'folder.png')); $menu->addArray(array('url' => Horde::url('compose.php'), 'text' => _("Compose"), 'icon' => 'compose.png')); if ($returnType == 'object') { return $menu; } else { return $menu->render(); } }
/** * Returns the sidebar for the current application. * * @param string $app The application to generate the menu for. Defaults * to the current app. * * @return Horve_View_Sidebar The sidebar. */ public static function sidebar($app = null) { global $registry; if (empty($app)) { $app = $registry->getApp(); } $menu = new Horde_Menu(); $registry->callAppMethod($app, 'menu', array('args' => array($menu))); $sidebar = $menu->render(); $registry->callAppMethod($app, 'sidebar', array('args' => array($sidebar))); return $sidebar; }