/** * Visit a block and return the resulting GUI component. * * @param object NavBlockSiteComponent $navBlock * @return object Component * @access public * @since 4/3/06 */ public function visitNavBlock(NavBlockSiteComponent $navBlock) { // Traverse our child organizer, and place it in the _missingTargets array // if our target is not available. if ($navBlock->isActive()) { $childOrganizer = $navBlock->getOrganizer(); $childOrganizer->acceptVisitor($this); $nestedMenuOrganizer = $navBlock->getNestedMenuOrganizer(); if (!is_null($nestedMenuOrganizer)) { $nestedMenuOrganizer->acceptVisitor($this); } } return $this->visitSiteComponent($navBlock); }
/** * Visit a block and return the resulting GUI component. * * @param object NavBlockSiteComponent $navBlock * @return ref array * @access public * @since 4/3/06 */ public function visitNavBlock(NavBlockSiteComponent $navBlock) { $authZ = Services::getService("AuthZ"); $idManager = Services::getService("Id"); // Since view AZs cascade up, just check at the node. if (!$authZ->isUserAuthorized($idManager->getId("edu.middlebury.authorization.view"), $idManager->getId($navBlock->getId()))) { return false; } $menuItems = array(); // Create the menu item $title = $navBlock->getTitleMarkup(); if (!$title) { $title = _("Untitled"); } $menuItems[] = new MenuItemLinkWithAdditionalHtml($title, $this->getUrlForComponent($navBlock->getId()), $navBlock->isActive(), 1, null, null, $navBlock->getDescription(), $this->getAdditionalNavHTML($navBlock)); // Traverse our child organizer, and place it in the _missingTargets array // if our target is not available. if ($navBlock->isActive()) { $childOrganizer = $navBlock->getOrganizer(); $childGuiComponent = $childOrganizer->acceptVisitor($this); if (isset($this->_emptyCellContainers[$navBlock->getTargetId()])) { $this->_emptyCellContainers[$navBlock->getTargetId()]->insertAtPlaceholder($this->_emptyCellPlaceholders[$navBlock->getTargetId()], $childGuiComponent, $childOrganizer->getWidth(), '100%', null, TOP); unset($this->_emptyCellContainers[$navBlock->getTargetId()], $this->_emptyCellPlaceholders[$navBlock->getTargetId()]); } else { $this->_missingTargets[$navBlock->getTargetId()] = $childGuiComponent; $this->_missingTargetWidths[$navBlock->getTargetId()] = $childOrganizer->getWidth(); } $nestedMenuOrganizer = $navBlock->getNestedMenuOrganizer(); if (!is_null($nestedMenuOrganizer)) { $this->_menuNestingLevel++; $menuItems[] = $nestedMenuOrganizer->acceptVisitor($this); } else { $this->_menuNestingLevel = 0; } } // return the menu items return $menuItems; }