function &_getCategoryObject($category, $clang = false) { if (is_object($category)) { return $category; } elseif (is_int($category)) { return OOCategory::getCategoryById($category, $clang); } elseif (is_array($category)) { $catlist = array(); foreach ($category as $cat) { $catobj = OOCategory::_getCategoryObject($cat, $clang); if (is_object($catobj)) { $catlist[] = $catobj; } else { return null; } } return $catlist; } return null; }
function get() { $s = ''; $s_self = ''; $this->_depth = 0; if ($this->root_category === null) { $root_nodes = OOCategory::getRootCategories($this->ignore_offlines, $this->clang); } else { if (is_int($this->root_category) && $this->root_category === 0) { $root_nodes = OOArticle::getRootArticles($this->ignore_offlines, $this->clang); } else { $root_nodes = array(); $root_category = OOCategory::_getCategoryObject($this->root_category); // Rootkategorien selbst nicht anzeigen, nur deren Kind-Elemente if (is_array($root_category)) { foreach ($root_category as $root_cat) { $this->_appendChilds($root_cat, $root_nodes); $this->_appendArticles($root_cat, $root_nodes); } } else { $this->_appendChilds($root_category, $root_nodes); $this->_appendArticles($root_category, $root_nodes); } } } if (is_array($root_nodes)) { foreach ($root_nodes as $node) { $s_self .= $this->_formatNode($node); } // Parent Tag nur erstellen, wenn auch Childs vorhanden sind if ($s_self != '') { $s .= '<' . $this->main_tag . $this->main_attr . '>'; $s .= $s_self; $s .= '</' . $this->main_tag . '>'; } } return $s; }