/** * Renders a overview page for the given MenuEntry object * * @access public * @param \Zepi\Turbo\Framework $framework * @param \Zepi\Web\General\Entity\MenuEntry $menuEntry * @return string */ public function render(Framework $framework, MenuEntry $menuEntry) { // If the MenuEntry hasn't any children we return an empty string. if (!$menuEntry->hasChildren()) { return ''; } $templatesManager = $framework->getInstance('\\Zepi\\Web\\General\\Manager\\TemplatesManager'); $htmlString = ''; $emptyChilds = array(); foreach ($menuEntry->getChildren() as $child) { if (!$child->hasChildren()) { $emptyChilds[] = $child; } else { $htmlString .= $templatesManager->renderTemplate('\\Zepi\\Web\\UserInterface\\Templates\\OverviewPageSection', array('menuEntry' => $child)); } } $htmlString = $templatesManager->renderTemplate('\\Zepi\\Web\\UserInterface\\Templates\\OverviewPageItems', array('children' => $emptyChilds)) . $htmlString; return $htmlString; }
/** * Loops trough the navigation tree for the given menu entry * and gets all entries for the breadcrumb navigation * * @param \Zepi\Web\General\Entity\MenuEntry $entry * @return array */ protected function processBreadcrumbEntries(MenuEntry $entry) { $entries = array($entry); if ($entry->hasParent()) { $parentEntries = $this->processBreadcrumbEntries($entry->getParent()); foreach ($parentEntries as $parentEntry) { $entries[] = $parentEntry; } } return $entries; }
/** * Sorts two menu entries * * @access public * @param Zepi\Web\General\Entity\MenuEntry $a * @param Zepi\Web\General\Entity\MenuEntry $b * @return integer */ public function sortMenuEntries($a, $b) { if ($a->getName() > $b->getName()) { return 1; } else { if ($a->getName() < $b->getName()) { return -1; } else { return 0; } } }