function sidebarMenu() { $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/configs/sidebar.xml', 'sidebar'); $container = new Zend_Navigation(); $container->setPages($config->toArray()); $view = new Zend_View(); echo $view->navigation($container)->menu()->setMaxDepth(1)->render(); }
function navbarMainMenu() { $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/configs/navbar.xml', 'main'); $container = new Zend_Navigation(); $container->setPages($config->toArray()); $view = new Zend_View(); echo $view->navigation($container)->menu()->setUlClass('nav navbar-nav')->setMaxDepth(0)->render(); }
/** * Полностью раскрытое дерево * * @return Zend_View_Helper_Navigation_Menu */ private function getFull() { $menu = $this->_view->navigation()->menu($this->_categories); if (isset($this->_options['showindex']) && $this->_options['showindex'] == 'no') { $menu->setMinDepth(1)->setMaxDepth(null); } else { $menu->setMinDepth(null)->setMaxDepth(null); } return $menu; }
/** * Initialise the navigation system * * (non-PHPdoc) * @see Zend_Controller_Plugin_Abstract::preDispatch() */ public function preDispatch(Zend_Controller_Request_Abstract $request) { // If we are on the error controller, return immediately to prevent // any database errors happening on error page if ($request->controller == "error") { return; } $nav = array(); if ($this->_view->logged_in) { // Always add home link $nav[] = array("label" => "Home", "id" => "home-link", "uri" => "/home"); // If we're in a project, add in the things you can do if ($project_slug = $request->getParam("project")) { $projects = new GD_Model_ProjectsMapper(); $project = $projects->getProjectBySlug($project_slug); if ($project instanceof GD_Model_Project) { $nav[] = array("label" => "History", "id" => "deployments-link", "uri" => "/project/{$project_slug}/history"); $nav[] = array("label" => "Settings", "id" => "settings-link", "uri" => "/project/{$project_slug}/settings"); $nav[] = array("label" => "Deploy", "id" => "deploy-link", "uri" => "/project/{$project_slug}/deploy"); } } else { $nav[] = array("label" => "Profile", "id" => "profile-link", "uri" => "/profile"); // Get the logged in user - if they're an admin, add the admin // menu $user = GD_Auth_Database::GetLoggedInUser(); if ($user->isAdmin()) { $nav[] = array("label" => "Admin", "id" => "admin-link", "uri" => "/admin"); } } } else { $nav[] = array("label" => "Login", "id" => "login-link", "uri" => "/auth/login"); } // Create a Zend_Navigation object from the above array $nav = new Zend_Navigation($nav); $this->_view->navigation($nav); // This finds out if the current URL matches one of the menu items // and sets the active page if it does. $uri = $request->getRequestUri(); $page = $this->_view->navigation()->findOneBy("uri", $uri); if ($page) { $page->setActive(); } }
function navbarRightMenu() { $config = new Zend_Config_Xml(APPLICATION_PATH . '/modules/admin/configs/navbar.xml', 'nav'); $container = new Zend_Navigation(); $container->setPages($config->toArray()); /*$container->addPage( array( 'label' => Zend_Auth::getInstance()->getIdentity()->email, 'title' => 'Dashboard', 'uri' => '/admin/' ));*/ $view = new Zend_View(); echo $view->navigation($container)->menu()->setUlClass('dropdown-menu')->render(); }
public function _initView() { $view = new Zend_View(); $view->doctype('XHTML1_STRICT'); $view->env = APPLICATION_ENV; $config = new Zend_Config_Xml(APPLICATION_PATH . "/configs/menu.xml", "nav"); $nav = new Zend_Navigation($config); $view->navigation($nav); $render = Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer'); $render->setView($view); /* $c = $nav->findAllByController('index'); $a = $nav->findAllByAction("index"); $found = array_intersect($c, $a); */ return $view; }
/////////////////////////////////////////////////////////////////////////////// $view = new Zend_View(); $view->registerHelper(new Menu(), 'menu'); /////////////////////////////////////////////////////////////////////////////// ?> <html> <head> <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" /> <link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap-responsive.css" /> </head> <body> <div class="navbar"> <div class="navbar-inner"> <div class="container"> <?php echo $view->navigation($demoMenu)->menu()->setMinDepth(1)->setMaxDepth(-1)->setRenderParents(false)->setUlClass('nav'); ?> </div> </div> </div> <?php echo $view->navigation($demoMenu)->menu()->setMinDepth(1)->setMaxDepth(1)->setUlClass("nav nav-list")->setRenderParents(false); ?> <script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/jquery.js"></script> <script type="text/javascript" src="http://twitter.github.com/bootstrap/assets/js/bootstrap-dropdown.js"></script> </body> </html>
function navMenu($container) { $view = new Zend_View(); return $view->navigation($container)->menu(); }