Example #1
0
function smartsection_items_tree_show($options)
{
    /*
    	options(
    		[0] => category (-1: current; 0: all)
    		[1] => sort
    		[2] => order
    		[3] => maxlevel (-1: all)
    		[4] => show items
    	);
    */
    include_once XOOPS_ROOT_PATH . "/modules/smartsection/include/common.php";
    $block = array();
    switch ($options[0]) {
        case -1:
            global $xoopsModule;
            $smartModule =& smartsection_getModuleInfo();
            echo $xoopsModule->dirname() . "<br>";
            echo $smartModule->dirname();
            if ($xoopsModule->dirname() == $smartModule->dirname()) {
                if (isset($_GET['categoryid'])) {
                    $cat2show = $_GET['categoryid'];
                } else {
                    if (isset($_GET['itemid'])) {
                        $itemObj = new SmartsectionItem($_GET['itemid']);
                        $cat2show = $itemObj->categoryid();
                    } else {
                        $cat2show = 0;
                    }
                    //itemid
                }
                //categoryid
            }
            //dirname
            break;
        case 0:
            $cat2show = 0;
            break;
        default:
            $cat2show = $options[0];
            break;
    }
    $sort = $options[1];
    //$order = smartsection_getOrderBy($sort);
    $order = $options[2];
    $maxlevel = $options[3];
    $showItems = $options[4];
    $arrayTree = smartsection_tree($cat2show, 0, $sort, $order, $maxlevel, $showItems);
    $block["arrayTree"] = $arrayTree;
    return $block;
}