Example #1
0
function calendar_tree($catid)
{
    global $set, $db, $apx, $user;
    static $saved;
    $catid = (int) $catid;
    $catid = (int) $catid;
    if (!$catid) {
        return array();
    }
    if (!$set['calendar']['subcats']) {
        return array($catid);
    }
    if (isset($saved[$catid])) {
        return $saved[$catid];
    }
    $cattree = array();
    require_once BASEDIR . 'lib/class.recursivetree.php';
    $tree = new RecursiveTree(PRE . '_calendar_cat', 'id');
    $cattree = $tree->getChildrenIds($catid);
    $cattree[] = $catid;
    $saved[$catid] = $cattree;
    return $cattree;
}
Example #2
0
function news_tree($catid)
{
    global $set, $db, $apx, $user;
    static $saved;
    $catid = (int) $catid;
    $catid = (int) $catid;
    if (!$catid) {
        return array();
    }
    if (!$set['news']['subcats']) {
        return array($catid);
    }
    if (isset($saved[$catid])) {
        return $saved[$catid];
    }
    require_once BASEDIR . 'lib/class.recursivetree.php';
    $tree = new RecursiveTree(PRE . '_news_cat', 'id');
    $data = $tree->getTree(array('title', 'open'));
    $cattree = $tree->getChildrenIds($catid);
    $cattree[] = $catid;
    $saved[$catid] = $cattree;
    return $cattree;
}