Beispiel #1
0
function cate_mode_reload($parent_id, $step = 0, $conn, $table, $depth = 1)
{
    $temp = $conn->GetArray("select * from " . $table . " where parent_id='" . $parent_id . "' order by sort");
    if ($temp) {
        foreach ($temp as $k => $v) {
            $step += 1;
            $avalue = $conn->Execute("UPDATE " . $table . " SET lft=" . $step . ",depth='" . $depth . "' where id='" . $v["id"] . "'");
            $step = cate_mode_reload($v["id"], $step, $conn, $table, $depth + 1);
            $step += 1;
            $avalue = $conn->Execute("UPDATE " . $table . " SET rgt=" . $step . " where id='" . $v["id"] . "'");
        }
    }
    $avalue = $conn->Execute("UPDATE " . $table . " SET rgt=" . ($step + 1) . " where id='" . $parent_id . "'");
    return $step;
}
Beispiel #2
0
$close["copy"] = 1;
$close["sort"] = 0;
//$cpos["access_data"] = array('status','2','1','outputdata');///資料設定
//$cpos["access_data_token"] = true;
if ($_POST) {
    if (($_POST["pic"][0] == '' || $_POST["pic"][0] == NULL) && count($_POST["pic"]) <= 1) {
        $_POST["pic"] = '';
    } elseif (($_POST["pic"][0] == '' || $_POST["pic"][0] == NULL) && count($_POST["pic"]) > 1) {
        unset($_POST["pic"][0]);
    }
}
include_once "category_class.php";
//-分類樹核心 create by Jones
$cpos["list_update_func"] = "cate_mode_reload(" . $mode . ",0,\$conn,'" . $cpos["table"] . "');";
include_once "centerpoes.php";
cate_mode_reload($mode, 0, $conn, $cpos["table"]);
if ($_POST) {
    linkto($_SERVER['REQUEST_URI']);
}
//--尋找分類數層級
if (isset($_GET["parent_id"])) {
    $depth_data = $conn->GetRow("select * from " . $cpos["table"] . " where id='" . quotes($_GET["parent_id"]) . "'");
    $depth = $depth_data["depth"] * 1 + 1;
    $data["one"]["parent_id"] = $depth_data["id"];
} elseif ($data["one"]["depth"]) {
    $depth = $data["one"]["depth"];
} else {
    $depth = '1';
}
//明細
if ($_SESSION["admin_info"]["view"] == "detail") {