예제 #1
0
function deptListTree($PARENT_ID)
{
    global $connection;
    global $LOGIN_USER_ID;
    global $LOGIN_DEPT_ID;
    global $LOGIN_USER_PRIV;
    global $PRIV_NO_FLAG;
    global $PARA_URL;
    global $PARA_TARGET;
    global $PARA_ID;
    global $PARA_VALUE;
    global $showButton;
    $query = "SELECT * from department where DEPT_PARENT='" . $PARENT_ID . "' order by DEPT_NO";
    $cursor1 = exequery($connection, $query);
    while ($ROW = mysql_fetch_array($cursor1)) {
        $DEPT_ID1 = $ROW['DEPT_ID'];
        $DEPT_NAME1 = $ROW['DEPT_NAME'];
        $DEPT_NAME1 = htmlspecialchars($DEPT_NAME1);
        $DEPT_NAME1 = str_replace("\"", """, $DEPT_NAME1);
        $DEPT_NAME1 = stripslashes($DEPT_NAME1);
        $CHILD_COUNT = 0;
        $query = "SELECT 1 from department where DEPT_PARENT='" . $DEPT_ID1 . "'";
        $cursor2 = exequery($connection, $query);
        if ($ROW1 = mysql_fetch_array($cursor2)) {
            ++$CHILD_COUNT;
        }
        if ($PRIV_NO_FLAG) {
            $DEPT_PRIV1 = is_dept_priv($DEPT_ID1);
        } else {
            $DEPT_PRIV1 = 1;
        }
        if ($DEPT_PRIV1 == 1) {
            $XML_TEXT_DEPT .= "<TreeNode id=\"" . $DEPT_ID1 . "\" text=\"[{$DEPT_NAME1}]\" ";
        } else {
            $XML_TEXT_DEPT .= "<TreeNode id=\"" . $DEPT_ID1 . "\" text=\"{$DEPT_NAME1}\" ";
        }
        if ($showButton) {
            $XML_TEXT_DEPT .= "onclick=\"click_node('" . $DEPT_ID1 . "',this.checked,'{$PARA_ID}','" . str_replace(".", "&amp;", $PARA_VALUE) . "');\" ";
        }
        if ($PARA_URL != "" && $DEPT_PRIV1 == 1) {
            if ($PARA_ID == "") {
                $URL = "{$PARA_URL}?DEPT_ID={$DEPT_ID1}";
            } else {
                $URL = "{$PARA_URL}?DEPT_ID={$DEPT_ID1}&amp;{$PARA_ID}=" . str_replace(".", "&amp;", $PARA_VALUE);
            }
            $XML_TEXT_DEPT .= "href=\"" . $URL . "\" target=\"{$PARA_TARGET}\"";
        } else {
            $XML_TEXT_DEPT .= "href=\"javascript:;\" target=\"_self\"";
        }
        $XML_TEXT_DEPT .= " img_src=\"../../../Framework/images/endnode.gif\" title=\"" . $DEPT_NAME1 . "\"";
        if (0 < $CHILD_COUNT) {
            $XML_TEXT_DEPT .= " Xml=\"tree.php?DEPT_ID=" . $DEPT_ID1 . "&amp;PARA_URL={$PARA_URL}&amp;PARA_TARGET={$PARA_TARGET}&amp;PRIV_NO_FLAG={$PRIV_NO_FLAG}&amp;PARA_ID={$PARA_ID}&amp;PARA_VALUE={$PARA_VALUE}&amp;showButton={$showButton}\"";
        }
        $XML_TEXT_DEPT .= "/>\n";
    }
    return $XML_TEXT_DEPT;
}
예제 #2
0
function dept_tree_list($DEPT_ID, $PRIV_OP)
{
    global $DEEP_COUNT;
    global $connection;
    $query = "SELECT * from producttype where parentid='" . $DEPT_ID . "'";
    if ($_GET['MODULE_ID'] != "") {
        $query .= " and rowid<>'" . $_GET['MODULE_ID'] . "'";
    }
    //只能选择目录
    if ($_GET['MANAGE_FLAG'] == "1") {
        $query .= " and rowid not in (select distinct producttype from product)";
    }
    $query .= "order by rowid";
    //print $query;exit;
    $cursor = exequery($connection, $query);
    $OPTION_TEXT = "";
    $DEEP_COUNT1 = $DEEP_COUNT;
    $DEEP_COUNT .= "  ";
    while ($ROW = mysql_fetch_array($cursor)) {
        ++$COUNT;
        $DEPT_ID = $ROW['ROWID'];
        $DEPT_NAME = $ROW['name'];
        $DEPT_PARENT = $ROW['parentid'];
        $DEPT_NAME = str_replace("<", "&lt", $DEPT_NAME);
        $DEPT_NAME = str_replace(">", "&gt", $DEPT_NAME);
        $DEPT_NAME = stripslashes($DEPT_NAME);
        if ($PRIV_OP == 1) {
            $DEPT_PRIV = is_dept_priv($DEPT_ID);
        } else {
            $DEPT_PRIV = 1;
        }
        $image = "<img src='../../../Framework/images/endnode.gif'>";
        $onclick = "onclick=javascript:click_dept('" . $DEPT_ID . "') style=cursor:pointer";
        //判断是否下面有产品
        $query1 = "SELECT * from product where producttype='" . $DEPT_ID . "'";
        $cursor1 = exequery($connection, $query1);
        $ROW1 = mysql_fetch_array($cursor1);
        if (sizeof($ROW1) > 1) {
            $image = "<img width=16 height=16 src='../../../Framework/images/ts.gif'>";
        } else {
            $title = "title='此目录为空'";
        }
        //只能选择终端节点
        if ($_GET['MANAGE_FLAG'] == "2") {
            $query1 = "SELECT * from producttype where parentid='" . $DEPT_ID . "'";
            $cursor1 = exequery($connection, $query1);
            $ROW1 = mysql_fetch_array($cursor1);
            if (sizeof($ROW1) > 1) {
                $onclick = "";
                $title = "";
            }
        }
        $OPTION_TEXT_CHILD = dept_tree_list($DEPT_ID, $PRIV_OP);
        if ($DEPT_PRIV == 1) {
            $OPTION_TEXT .= "     <tr class=TableData>       <td class='menulines' id='" . $DEPT_ID . "' title='" . $DEPT_NAME . "' " . $onclick . " " . $title . ">" . $DEEP_COUNT1 . $image . " " . $DEPT_NAME . "</td>     </tr>";
        }
        if ($OPTION_TEXT_CHILD != "") {
            $OPTION_TEXT .= $OPTION_TEXT_CHILD;
        }
    }
    $DEEP_COUNT = $DEEP_COUNT1;
    return $OPTION_TEXT;
}