Exemple #1
0
 /**
  * creates a sub menu for given page_id (children of that page)
  *
  * $max_level may be:
  *   + absolute maximal level to be shown (i.e. '7')
  *     example: level for $page_id is 5, $max_level is 7 = show 2 levels
  *   + relative level to be shown (i.e. '+2')
  *     example: level for $page_id is 5, $max_level is '+3' = show 3 levels
  *
  * @access public
  * @param  integer $id           - parent page; default: current page
  * @param  mixed   $max_level    - see above; default: 999 (unlimited)
  * @param  boolean $show_current - show current page in the menu; default: false
  * @return string  HTML
  **/
 public static function subMenu($id = NULL, $max_level = 999, $show_current = false, array &$options = array())
 {
     global $page_id;
     if ($id === NULL) {
         $id = $page_id;
     }
     if ($id === 0) {
         $id = CAT_Helper_Page::getRootParent($page_id);
     }
     self::analyzeOptions($options);
     $self = self::getInstance();
     $menu = array();
     $level_diff = self::analyzeLevel($id, $max_level);
     $self->log()->LogDebug(sprintf('levels to show [%d]', $level_diff));
     if ($level_diff == 1) {
         $subpages = CAT_Helper_Page::getPagesByParent($id);
     } else {
         $subpages = CAT_Helper_Page::getSubPages($id);
     }
     foreach ($subpages as $sid) {
         $menu[] = CAT_Helper_Page::properties($sid);
     }
     // use ListBuilder to create the menu
     //return CAT_Helper_ListBuilder::getInstance()->config('__auto_link',true)->tree($menu,$id);
     return self::$list->buildList($menu, array('root_id' => $id));
 }