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);
        }
    }
}
Example #2
0
    echo gettext('City:');
    ?>
 </label><?php 
    echo getImageCity();
    ?>
</div><?php 
}
?>
						<?php 
if (getImageState()) {
    ?>
<div><label><?php 
    echo gettext('State:');
    ?>
 </label><?php 
    echo getImageState();
    ?>
</div><?php 
}
?>
						<?php 
if (getImageCountry()) {
    ?>
<div><label><?php 
    echo gettext('Country:');
    ?>
 </label><?php 
    echo getImageCountry();
    ?>
</div><?php 
}
Example #3
0
/**
 * Добавление скопированных подкатегорий и элементов
 * для учета при показе дерева
 */
function addMovedItems(&$categories, $parentId)
{
    global $db;
    // Добавить скопированые категории из site_categories
    $res =& $db->query(CMD_SEL_MOVED_SITECATEGORIES, array($parentId));
    if (PEAR::isError($res)) {
        printError($res);
        exit;
    }
    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
        $customAttrs = array("siteId" => $row->site_id);
        $categories[] = array("nodeId" => $row->id, "name" => $row->name, "state" => "item", "tp" => NODE_SITE_CATEGORY, "image" => "pics/category.png", "customAttrs" => $customAttrs);
    }
    // Добавить скопированые элементы из items
    $res =& $db->query(CMD_SEL_MOVED_ITEMS, array($parentId));
    if (PEAR::isError($res)) {
        printError($res);
        exit;
    }
    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
        // Получить измененые данные - если есть
        $rowChanged =& $db->getRow(CMD_SEL_CHANGED_ROW, array($row->id), DB_FETCHMODE_OBJECT);
        if (!isset($rowChanged)) {
            $name = "&nbsp;" . $row->art . " - " . $row->name;
            $imgState = $row->viewmode;
        } else {
            $name = "&nbsp;" . $rowChanged->art . " - " . $rowChanged->name;
            $imgState = $rowChanged->viewmode;
        }
        $imgState = $imgState == true ? "pics/itemHidden.png" : getImageState($row);
        $customAttrs = array("categId" => $row->category_id);
        $categories[] = array("nodeId" => $row->id, "name" => $name, "state" => "item", "tp" => NODE_SITE_ITEM, "image" => $imgState, "customAttrs" => $customAttrs);
    }
    // Добавить новые элементы из our_items
    $res =& $db->query(CMD_SEL_NEW_ITEMS, array($parentId));
    if (PEAR::isError($res)) {
        printError($res);
        exit;
    }
    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
        $imgState = $row->viewmode == true ? "pics/itemHidden.png" : getImageState($row, true);
        $categories[] = array("nodeId" => $row->id, "name" => "&nbsp;" . $row->art . " - " . $row->name, "state" => "item", "tp" => NODE_SITE_OURITEM, "image" => $imgState);
    }
}