<?php
header('Content-Type: text/html; charset=utf-8');
$path="../../";
include("../../map.php");

if($_GET["ne"]=="addorder"){
	$sqlx=mysqli_query($conn, "select * from kategoriler where ne='wkategori' and Cat_".$_SESSION["lang"]."='".$_GET["selectedList"]."' order by sira asc"); $rsx=mysqli_fetch_assoc($sqlx);
	$sqll = $conn->query("insert into t1(ne,t1,s2,s13,s19,ts1) values ('workflow', '".$_GET["title"]."', '".$rsx["Cat_ID"]."', '1', '".$_SESSION["user_id"]."', now())");
	echo "url:?";

}elseif($_GET["ne"]=="updateorder"){
	$sql2 = mysqli_query($conn, "update t1 set t1='".$_POST["t1"]."', n1='".$_POST["n1"]."' where id=".$_GET["id"]."");
	echo "url:?";

}elseif($_GET["ne"]=="dellorder"){
	$Sql = mysqli_query($conn, "delete from t1 where id=".$_GET["id"]."");

}elseif($_GET["ne"]=="addlist"){
	$sqlx=mysqli_query($conn, "select * from kategoriler where ne='wkategori' order by sira desc"); $rsx=mysqli_fetch_assoc($sqlx);
	$sqli = $conn->query("INSERT INTO kategoriler (ne, Cat_".$_SESSION['lang'].", sira, s9) VALUES ('wkategori', '".$_GET['listName']."', '".($rsx['sira']+1)."', '".$_SESSION['user_id'])."'");
	echo "url:?";

}elseif($_GET["ne"]=="delllist"){
	$Sql = mysqli_query($conn, "delete from kategoriler where Cat_ID=".$_GET["id"]."");
	$Sql = mysqli_query($conn, "delete from t1 where s2=".$_GET["id"]."");

}elseif($_GET["ne"]=="dellallwork"){
	$Sql = mysqli_query($conn, "delete from t1 where ne='workflow'");
	echo "url:?";
}

if($_GET["colID"]<>""){
	$i = 0; $colID=explode('-', $_GET["colID"]);
	foreach ($_POST['box'] as $value) { $i++;
		//echo $value." => ".$i."<br>";
		$sql2 = mysqli_query($conn, "update kategoriler set sira='".$colID[1]."' where Cat_ID=".$value."");
	}
}

if($_GET["boxID"]<>""){
	$i = 0; $boxID=explode('-', $_GET["boxID"]);
	foreach ($_POST['row'] as $value) { $i++;
		//echo $value." => ".$i."<br>";
		$sql2 = mysqli_query($conn, "update t1 set s1='".$i."', s2='".$boxID[1]."'  where id=".$value."");
	}
}
?>