/** * get a hierarchical array tree of forums * * {@link newbbTree} * * @param int $cat_id category ID * @param int $pid Top forum ID * @param string $permission permission type * @param string $tags variables to fetch * @param integer $depth level of subcategories * @return array associative array of category IDs and sanitized titles */ function &getArrayTree($cat_id = 0, $pid = 0, $permission = "access", $tags = null, $depth = 0) { $pid = intval($pid); $perm_string = $permission; if (!is_array($tags) || count($tags) == 0) { $tags = array("forum_id", "parent_forum", "forum_name", "forum_order", "cat_id"); } $forums_obj =& $this->getByPermission($cat_id, $perm_string, $tags); require_once dirname(__FILE__) . "/tree.php"; $forums_structured = array(); foreach (array_keys($forums_obj) as $key) { $forum_obj =& $forums_obj[$key]; $forums_structured[$forum_obj->getVar("cat_id")][$key] =& $forums_obj[$key]; } foreach (array_keys($forums_structured) as $cid) { $tree = new newbbObjectTree($forums_structured[$cid]); $forum_array[$cid] = $tree->makeArrayTree($pid, $tags, $depth); unset($tree); } return $forum_array; }