Esempio n. 1
0
function HandleExpand()
{
    global $db;
    if ($_REQUEST["treeId"] == "TreeCategories") {
        $res =& $db->query(CMD_SEL_ITEMS, array($_REQUEST["nodeId"]));
        if (PEAR::isError($res)) {
            printErr($res);
            exit;
        }
        $items = array();
        while ($row =& $res->fetchRow(DB_FETCHMODE_OBJECT)) {
            $customAttrs = array("categId" => $row->category_id);
            $items[] = array("nodeId" => $row->id, "name" => $row->art . " - " . $row->name, "state" => "item", "tp" => NODE_SITE_ITEM, "image" => getImageState($row), "customAttrs" => $customAttrs);
        }
        printTree($items, false);
    } else {
        if ($_REQUEST["treeId"] == "TreeOurSite") {
            $res =& $db->query(CMD_SEL_SUBCATEGORIES, array($_REQUEST["nodeId"]));
            if (PEAR::isError($res)) {
                printError($res);
                exit;
            }
            $categories = array();
            while ($row =& $res->fetchRow(DB_FETCHMODE_OBJECT)) {
                $catCount = getItemsCount($row->id);
                $state = null;
                if ($catCount > 0) {
                    $state = "collapsed";
                }
                $imgState = $row->viewmode == true ? "pics/ourcategoryHidden.png" : "pics/ourcategory.png";
                $categories[] = array("nodeId" => $row->id, "name" => $row->name, "state" => $state, "image" => $imgState);
            }
            addMovedItems($categories, $_REQUEST["nodeId"]);
            printTree($categories, false);
        }
    }
}
Esempio n. 2
0
<script src="scripts/glm-ajax.js"></script>
<script src="scripts/Tree/Tree.js"></script>
<script src="scripts/jquery.js"></script>
<script src="scripts/interface.js"></script>
</head>
<body onselectstart="return false;">
<span id="OurSite">Каталог сувениров:</span>
<?php 
$res =& $db->query(CMD_SEL_SUBCATEGORIES, array(0));
if (PEAR::isError($res)) {
    print $res->getMessage();
    exit;
}
$categories = array();
while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
    $catCount = getItemsCount($row->id);
    $state = null;
    if ($catCount > 0) {
        $state = "collapsed";
    }
    $imgState = $row->viewmode == true ? "pics/ourcategoryHidden.png" : "pics/ourcategory.png";
    $categories[] = array("nodeId" => $row->id, "name" => $row->name, "state" => $state, "image" => $imgState);
}
printTree($categories, true, true, "TreeOurSite");
?>

<script>

var ourSiteObj = document.getElementById("OurSite");

var getSrcNodesParam = function (nodes) {