<?php
	$path="../../"; include("../../map.php");
if($_GET["islem"]=="relations"){
	$fci="i";
	$fcs="m";
	$from="t1";
	$col="v3-col-md-3";
}elseif($_GET["islem"]=="dreklam"){
	$fci="i";
	$fcs="m";
	$from="genel";
	$col="v3-col-md-3";
}elseif($_GET["islem"]=="dform"){
	$fci="q";
	$fcs="w";
	$from="".$_SESSION['lang']."";
	$col="v3-col-md-3";
}elseif($_GET["islem"]=="siparis"){
	$fci="i";
	$fcs="m";
	$from="eticaret";
	$col="v3-col-md-4";
}else{
	$fci="i";
	$fcs="m";
	$from="".$_SESSION['lang']."";
	$col="v3-col-md-3";
}
	$sql=mysqli_query($conn, "select * from ".$from." where id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql);
	$jsi = json_decode($rs["n17"], true);
	$jsl = json_decode($rs["n16"], true);
	$jsm = json_decode($rs["m1"], true);
	$jsa = json_decode($rs["m2"], true);
?>
<?php $sqli=mysqli_query($conn, "select * from genel where ne='inputs' and (t2='All' or t2='".$_SESSION["lang"]."') and n3='".$_GET["ne"]."' and (n2='".$_GET["ne"][0]."Side') and s1=0 order by s10,id asc"); $a=0; while($rsi=mysqli_fetch_assoc($sqli)){$a++; $jso = json_decode($rsi["n17"], true);?>
	<fieldset class="" style="">
		<legend><i class="<?php echo $rsi["n14"]?>"></i> <?php echo $rsi["n1"];?> <span style="font-size:8px; color:#ccc;"> (is<?php echo $a;?>)</span></legend>
		<?php if($rsi["n4"]=="input"){?>
			<input class="form-control <?php echo $rsi["n13"]?>" type="<?php echo $rsi["n5"]?>" name="is<?php echo $a;?>" value="<?php if($jsi["is".$a.""]<>""){echo $jsi["is".$a.""];}else{echo $rsi["n12"];}?>" placeholder="<?php echo $rsi["n11"]?>" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
		<?php }elseif($rsi["n4"]=="textarea"){?>
			<textarea class="form-control <?php echo $rsi["n13"]?>" name="is<?php echo $a;?>" placeholder="<?php echo $rsi["n11"]?>" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>><?php echo $jsi["is".$a.""];?></textarea>
		<?php }elseif($rsi["n4"]=="select"){?>
			<select class="form-control <?php echo $rsi["n13"]?> populate" data-plugin-selecttwo="" name="is<?php echo $a;?>[]" style="" <?php echo $rsi["n8"]?> <?php echo $rsi["n6"]?>>
				<option value="">...</option>
				<?php usort($jso, fn($a, $b) => $a['s10'] <=> $b['s10']); $o=0; foreach($jso as $okey=>$oval){ $o++;?>
				<?php if($rsi["id"]==$oval["s1"]){?>
					<option value="<?php echo $oval["n2"]?>" <?php $q="";foreach($jsi["".$val.""] as $q){?><?php if($q==$oval["n2"]){echo "selected";}} if($jsi["".$val.""][0]=="" and $oval["n3"]=="1"){echo "selected";}?>><?php echo $oval["n1"]?></option>
				<?php }}?>
			</select>
		<?php }elseif($rsi["n4"]=="radio"){?>
			<?php usort($jso, fn($a, $b) => $a['s10'] <=> $b['s10']); $o=0; foreach($jso as $okey=>$oval){ $o++;?>
			<?php if($rsi["id"]==$oval["s1"]){?>
				<div style="float:left; margin-right: 5px;" class="<?php echo $rsi["n13"]?>">
					<label style="float:left; margin-right:5px;"><?php echo $oval["n1"];?>
					<input type="radio" name="<?php echo $val;?>" id="i<?php echo $rsi["id"]?>" value="<?php echo $oval["n2"];?>" <?php echo $rsi["n8"]?> <?php if($jsi["".$val.""]==$oval["n2"] or $oval["n3"]==1){echo "checked";}?>></label>
				</div>
			<?php }}?>
		<?php }elseif($rsi["n4"]=="checkbox"){?>
			<ul class="clist" style="z-index:99999;position:absolute; display:none;" id="cl<?php echo $rsi["id"];?>">
				<?php usort($jso, fn($a, $b) => $a['s10'] <=> $b['s10']); $o=0; foreach($jso as $okey=>$oval){ $o++;?>
				<?php if($rsi["id"]==$oval["s1"]){?>
					<li onclick="cbox('#cl<?php echo $rsi["id"];?>c<?php echo $o;?>')" style="cursor:pointer;"><input type="checkbox" onclick="cbox('#cl<?php echo $rsi["id"];?>c<?php echo $o;?>')" id="cl<?php echo $rsi["id"];?>c<?php echo $o;?>" name="<?php echo $val;?>[]" value="<?php echo $oval["n2"];?>" <?php echo $rsi["n8"]?> <?php foreach($jsi["".$val.""] as $q){if($q==$oval["n2"] or $oval["n3"]==1){echo "checked"; $ql .="".$q.", ";}}?>> <?php echo $oval["n1"];?></li>
				<?php }}?>
			</ul>
			<div style="cursor:pointer;" onclick="toggle('#cl<?php echo $rsi["id"];?>')"><?php if($ql<>""){echo substr($ql,0,-2);}else{echo $sdil[221];} //Lütfen Seçiniz?> <i class="fa fa-angle-down" style="float:right;"></i></div>
		<?php }elseif($rsi["n4"]=="switch"){
			if($rsi["n12"]<>""){$svalue=$rsi["n12"];}else{$svalue=cevir1($rsi["n1"]);}
		?>
			<div class="switch switch-sm switch-success" title="<?php echo $jsi["is".$a.""]?>">
				<input type="checkbox" name="is<?php echo $a;?>" data-plugin-ios-switch="" value="<?php echo $svalue?>" class="switch" <?php if($jsi["is".$a.""]==$svalue){?>Checked<?php }?>>
			</div>
			<?php $ql="";$q="";}?>
			<p style="font-size:10px;"><?php echo $rsi["n9"];?></p>
		</fieldset>
	<?php }?>