예제 #1
0
 /**
  * @param \Render\APIs\APIv1\RenderAPI  $renderApi
  * @param \Render\Unit                  $unit
  * @param \Render\APIs\APIv1\Navigation $navigation
  * @param array                         $navigatorIds
  * @param string                        $pageId
  * @param int                           $level
  *
  * @throws \Exception
  *
  * @return HtmlTagBuilder
  */
 protected function getNavigationMarkupRecursive($renderApi, $unit, $navigation, array &$navigatorIds, $pageId, $level = 1)
 {
     if ($level > $this->getNumberOfTotalLevels()) {
         return null;
     }
     $childrenIds = $navigation->getChildrenIds($pageId);
     $levelEnabled = $renderApi->getFormValue($unit, 'enableLevel' . $level, false) == true;
     $shouldIterateIntoSubLevels = $this->shouldIterateIntoSubLevels($renderApi, $unit, $level);
     $listItemTags = array();
     foreach ($childrenIds as $childrenId) {
         $childPage = $navigation->getPage($childrenId);
         if (!$childPage->showInNavigation()) {
             continue;
         }
         // show children?
         $childPageTag = null;
         if (!$shouldIterateIntoSubLevels || $renderApi->isTemplate() || $this->isItemActive($childrenId, $navigatorIds)) {
             $childPageTag = $this->getNavigationMarkupRecursive($renderApi, $unit, $navigation, $navigatorIds, $childrenId, $level + 1);
         }
         // show current item?
         if ($levelEnabled) {
             $listItemTags[] = $this->getNavItemMarkup($renderApi, $unit, $navigation, $navigatorIds, $childPage, $level, $childPageTag);
         } else {
             $listItemTags[] = $childPageTag;
         }
     }
     if (count($listItemTags) <= 0) {
         return null;
     }
     return new HtmlTagBuilder('ul', array('class' => 'navLevel' . $level), $listItemTags);
 }
예제 #2
0
 /**
  * @param string $pageId
  * @param \Render\APIs\APIv1\Navigation $navigation
  *
  * @return bool
  */
 protected function hasChildPages($pageId, $navigation)
 {
     if (count($navigation->getChildrenIds($pageId)) > 0) {
         return true;
     } else {
         return false;
     }
 }