<?php
	$sql=mysqli_query($conn, "select * from ".$_SESSION['lang']." where id=".$_GET["id"].""); $rs=mysqli_fetch_assoc($sql);
	$jstn = json_decode($rs["n1"], true);
	$jssi = json_decode($rs["n2"], true);
?>
<div class="inner-wrapper">
	<!-- start: sidebar -->
	<aside id="sidebar-left" class="sidebar-left">
		
		<div class="sidebar-header">
			<div class="sidebar-title">
				Menu
			</div>
			<div class="sidebar-toggle hidden-xs" data-toggle-class="sidebar-left-collapsed" data-target="html" data-fire-event="sidebar-left-toggle">
				<i class="fa fa-bars" aria-label="Toggle sidebar"></i>
			</div>
		</div>
		
		<?php include('menu.php');?>
	</aside>
	<!-- end: sidebar -->
	<section role="main" class="content-body card-margin">
		<header class="page-header">
			<h2><?php echo $sdil[32]; //Anket?> <?php echo $sdil[119]; //Yönetimi?></h2>
			<div class="right-wrapper text-right">
				<ol class="breadcrumbs">
					<li>
						<a href=".">
							<i class="fa fa-home"></i>
						</a>
					</li>
					<li><span><?php echo $sdil[32]; //Anket?> <?php echo $sdil[119]; //Yönetimi?></span></li>
				</ol>
				<a class="sidebar-right-toggle" data-open="sidebar-right"><i class="fa fa-chevron-left"></i></a>
			</div>
		</header>
		<!-- start: page -->
		<div class="row">
			<div class="col">
				<section class="card">
					<header class="card-header" style="text-align: start">
						<div class="card-actions" id="v-<?php echo $_GET['islem'];?>">
							<a class="mb-1 mt-1 mr-1 btn btn-default" href="#" title="">#</a>
<!--
							<a href="#" class="card-action card-action-toggle" data-card-toggle=""></a>
							<a href="#" class="card-action card-action-dismiss" data-card-dismiss=""></a>
						-->
					</div>
					<h2 class="card-title"><?php echo $sdil[32]; //Anket?> <?php echo $sdil[119]; //Yönetimi?></h2>
					<p class="card-subtitle">...</p>
				</header>
				<form class="form" id="asave" name="rall" method="post" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&id=<?php echo $_GET["id"];?>&durum=kaydet">
					<?php include("modules/public/control_bar.php")?>
					<?php if($_GET["durum"]=="ok"){?>
						<?php echo saveok();?>
						<div class="alert alert-success">
							<?php echo $sdil[212]; //islem Basariyla Gerçeklestirilmistir !?>
						</div>
					<?php }elseif($_GET["durum"]=="err"){?>
						<div class="alert alert-danger">
							<?php echo $sdil[9]; //Hata Oluştu !?>
						</div>
					<?php }else{?>
						<div class="alert alert-warning">
							<?php echo $sdil[120]; //İlk Satır İsim Soyisim Olmalıdır.?>
						</div>
					<?php }?>
					<div class="v8-columns">
						<div class="v8-col200pxL-left">
							<ul class="v8-side-tabs v8-js-tabs v8-same-height">
								<li><a href="#tab-bilgi"><i class="fa fa-file"></i><span> <?php echo $sdil[32]; //Anket?> <?php echo $sdil[207]; //Bilgileri?></span></a></li>
								<li><a href="#tab-icerik"><i class="fa fa-list-ul"></i><span> <?php echo $sdil[32]; //Anket?></span></a></li>
								<li class="ddn"><a href="#" onclick="show('switchs')"><i class="fa fa-chevron-right" aria-hidden="true"></i></a></li>
							</ul>
							<div id="switchs">
								<i class="fa fa-times" onclick="hide('switchs')"></i>
								<fieldset class="grey-bg">
									<legend>İpucu <span style="font-size:8px; color:#ccc;">(Ödemeli)</span></legend>
									1-İsim Soyisim <span style="font-size:8px; color:#ccc;">(t1)</span><br />
									2-Email <span style="font-size:8px; color:#ccc;">(t2)</span><br />
									3-Telefon <span style="font-size:8px; color:#ccc;">(t3)</span><br />
									4-Tarih <span style="font-size:8px; color:#ccc;">(t4)</span><br />
								</fieldset>
							</div>
						</div>
						<div class="v8-col200pxL-right">
							<div id="tab-bilgi" class="v8-tabs-content">
								<div class="v3-row">
									<fieldset class="grey-bg">
										<legend><?php echo $sdil[32]; //Anket?> <?php echo $sdil[39]; //Başlık?></legend>
										<?php $ft1="".trim($sdil[200])." ".trim($nedir)."";?>
										<input class="form-control" type="text" name="m1" id="simple-required" value="<?php echo $rs["m1"];?>"  style="" placeholder="<?php echo $ft1;?>"  onfocus="if(this.value == '<?php echo $ft1;?>') { this.value = ''} "  onblur="if(this.value == '') { this.value='<?php echo $ft1;?>'; }">
									</fieldset>
									<fieldset class="grey-bg">
										<legend><?php echo $sdil[32]; //Anket?> <?php echo $sdil[113]; //Türü?></legend>
										<select size="1" name="m2" style="" class="form-control">
											<option value="normal" <?php if($rs["m2"]=="normal"){?>Selected<?php }?>>Normal</option>
										</select>
									</fieldset>
									<?php $skat="id"; $ckat="Cat_ID"; ?>
										<fieldset class="grey-bg">
											<legend> <?php echo $form[0].$sdil[201]; //Formlar?> <span style="font-size:8px; color:#ccc;">(x2)</span></legend>
											<select size="1" name="x2[]" id="s2" class="chosen-select form-control" <?php echo $stip?> disabled>
												<option value="0"><?php echo $sdil[221]; //Lütfen Seçiniz?></option>
												<?php if($d10<>0){?>
													<optgroup label="<?php echo $t21s[0];?> <?php echo $sdil[12]; //Kategori?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqla=mysqli_query($conn, "select * from kategoriler where ne='skategori' order by sira asc"); while($rsa=mysqli_fetch_assoc($sqla)){?>
															<option value="<?php echo $rsa[$ckat];?>" title="<?php echo $rsa["Cat_".$_SESSION['lang'].""];?>" alt="<?php echo $rsa["Cat_".$_SESSION['lang'].""];?>" style="color:#6699FF" <?php foreach($s2S as $s2){if($s2==$rsa[$ckat]){echo "selected";}}?>>+ <?php echo $rsa["Cat_".$_SESSION['lang'].""];?> [<?php echo $rsa["Cat_ID"];?>]</option>
														<?php }?>
													</optgroup>
													<optgroup label="<?php echo $t21s[0];?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqlsa=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='sayfa' and s5=1 order by s1 asc");  while($rssa=mysqli_fetch_assoc($sqlsa)){?>
															<option value="<?php echo $rssa[$skat];?>" title="<?php echo $rssa["t1"];?>" alt="<?php echo $rssa["t1"];?>" style="color:#6699FF !important" <?php foreach($s2S as $s2){if($s2==$rssa[$skat]){echo "selected";}}?>>- <?php echo $rssa["t1"];?> [<?php echo $rssa["ne"][0];?><?php echo $rssa["id"];?>]</option>
														<?php }?>
													</optgroup>
												<?php }?>
												<?php if($b1<>0){?>
													<optgroup label="<?php echo $t22s[0];?> <?php echo $sdil[12]; //Kategori?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqla=mysqli_query($conn, "select * from kategoriler where ne='hkategori' order by sira asc"); while($rsa=mysqli_fetch_assoc($sqla)){?>
															<option value="<?php echo $rsa[$ckat];?>" title="<?php echo $rsa["Cat_".$_SESSION['lang'].""];?>" alt="<?php echo $rsa["Cat_".$_SESSION['lang'].""];?>" style="color:#6699FF" <?php foreach($s2S as $s2){if($s2==$rsa[$ckat]){echo "selected";}}?>>+ <?php echo $rsa["Cat_".$_SESSION['lang'].""];?> [<?php echo $rsa["Cat_ID"];?>]</option>
														<?php }?>
													</optgroup>
												<?php }?>
												<?php if($b1<>0){?>
													<optgroup label="<?php echo $n8s[0];?> <?php echo $sdil[12]; //Kategori?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqla=mysqli_query($conn, "select * from kategoriler where ne='mkategori' order by sira asc"); while($rsa=mysqli_fetch_assoc($sqla)){?>
															<option value="<?php echo $rsa[$ckat];?>" title="<?php echo $rsa["Cat_".$_SESSION['lang'].""];?>" alt="<?php echo $rsa["Cat_".$_SESSION['lang'].""];?>" style="color:#6699FF" <?php foreach($s2S as $s2){if($s2==$rsa[$ckat]){echo "selected";}}?>>+ <?php echo $rsa["Cat_".$_SESSION['lang'].""];?> [<?php echo $rsa["Cat_ID"];?>]</option>
														<?php }?>
													</optgroup>
													<optgroup label="<?php echo $n8s[0];?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqls=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='msayfa' and s5=1 order by s1 asc");  while($rss=mysqli_fetch_assoc($sqls)){?>
															<option value="<?php echo $rss[$skat];?>" title="<?php echo $rss["t1"];?>" alt="<?php echo $rss["t1"];?>" style="color:#6699FF !important" <?php foreach($s2S as $s2){if($s2==$rss[$skat]){echo "selected";}}?>>- <?php echo $rss["t1"];?> [<?php echo $rss["ne"][0];?><?php echo $rss["id"];?>]</option>
														<?php }?>
													</optgroup>
												<?php }?>
												<?php if($a4<>0){?>
													<optgroup label="<?php echo $t24s[0];?> <?php echo $sdil[12]; //Kategori?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqlx=mysqli_query($conn, "select * from kategoriler where ne='ukategori' order by sira asc"); while($rsx=mysqli_fetch_assoc($sqlx)){?>
															<option value="<?php echo $rsx[$ckat];?>" title="<?php echo $rsx["Cat_".$_SESSION['lang'].""];?>" alt="<?php echo $rsx["Cat_".$_SESSION['lang'].""];?>" style="color:#6699FF" <?php foreach($s2S as $s2){if($s2==$rsx[$ckat]){echo "selected";}}?>>+ <?php echo $rsx["Cat_".$_SESSION['lang'].""];?> [<?php echo $rsx["Cat_ID"];?>]</option>
															<?php $s2S = explode(',',$rs["s2"]); $sqly=mysqli_query($conn, "select * from kategoriler where ne='ualt_kategori' and c1=".$rsc["Cat_ID"]." order by sira asc"); while($rsy=mysqli_fetch_assoc($sqly)){?>
																<option value="<?php echo $rsy[$ckat];?>" title="<?php echo $rsy["Cat_".$_SESSION['lang'].""];?>" alt="<?php echo $rsy["Cat_".$_SESSION['lang'].""];?>" style="color:#6699FF" <?php foreach($s2S as $s2){if($s2==$rsy[$ckat]){echo "selected";}}?>>- <?php echo $rsy["Cat_".$_SESSION['lang'].""];?> [<?php echo $rsy["Cat_ID"];?>]</option>
															<?php }?>
														<?php }?>
													<optgroup label="<?php echo $t24s[0];?>">
														<?php $s2S = explode(',',$rs["s2"]); $sqlsa=mysqli_query($conn, "select * from ".$_SESSION["lang"]." where ne='kayit' and s13=1 order by s1 asc");  while($rssa=mysqli_fetch_assoc($sqlsa)){?>
															<option value="<?php echo $rssa[$skat];?>" title="<?php echo $rssa["t1"];?>" alt="<?php echo $rssa["t1"];?>" style="color:#6699FF !important" <?php foreach($s2S as $s2){if($s2==$rssa[$skat]){echo "selected";}}?>>- <?php echo $rssa["t1"];?> [<?php echo $rssa["ne"][0];?><?php echo $rssa["id"];?>]</option>
														<?php }?>
													</optgroup>
													</optgroup>
												<?php }?>
											</select>
										</fieldset>
									<fieldset class="grey-bg">
										<legend><?php echo $sdil[40]; //Açıklama?></legend>
										<textarea name="m3" class="form-control" style="height:150px" placeholder="<?php echo $sdil[40]; //Açıklama?>"><?php echo $rs["m3"];?></textarea>
									</fieldset>
								</div>
							</div>
							<div id="tab-icerik" class="v8-tabs-content" style="">
								<div class="v3-row">
									<?php $f=1; for ( $i=1; $i < 99 ; $i++ ){?>
										<fieldset id="f<?php echo $i; ?>" class="grey-bg" style="<?php if($i==1 or $jstn["t".$i.""]<>""){$f++;}else{?>display:none;<?php }?>">
											<legend>input <span style="font-size:8px; font-family:Arial; color:#ccc;"> (t<?php echo $i; ?>)</span></legend>
											<div class="v3-col-md-4">
												<input type="text" class="form-control" name="t<?php echo $i; ?>" id="simple-required" value="<?php echo $jstn["t".$i.""];?>" class="with-tip" title="t<?php echo $i; ?>" placeholder="Input Text">
											</div>
											<div class="v3-col-md-3">
												<input type="text" class="form-control" name="p<?php echo $i; ?>" id="simple-required" value="<?php echo $jstn["p".$i.""];?>" class="with-tip" title="p<?php echo $i; ?>" placeholder="Placeholder">
											</div>
											<div class="v3-col-md-3">
												<input type="text" class="form-control" name="v<?php echo $i; ?>" id="simple-required" value="<?php echo $jstn["v".$i.""];?>" class="with-tip" title="v<?php echo $i; ?>" placeholder="Value">
											</div>
											<div class="v3-col-md-1">
												<select size="1" name="i<?php echo $i; ?>" class="form-control" title="i<?php echo $i; ?>">
													<option value="0" <?php if($jssi["i".$i.""]=="0"){?>Selected<?php }?>>input</option>
													<option value="1" <?php if($jssi["i".$i.""]=="1"){?>Selected<?php }?>>textarea</option>
													<option value="2" <?php if($jssi["i".$i.""]=="2"){?>Selected<?php }?>>Select</option>
													<option value="3" <?php if($jssi["i".$i.""]=="3"){?>Selected<?php }?>>Radio</option>
													<option value="4" <?php if($jssi["i".$i.""]=="4"){?>Selected<?php }?>>Checkbox</option>
												</select>
											</div>
											<div class="v3-col-md-1">
												<div class="switch switch-sm switch-success">
													<input type="checkbox" name="s<?php echo $i; ?>" value="1" data-plugin-ios-switch="" title="(s<?php echo $i; ?>) <?php echo $sdil[174]; //Zorunlu?>" <?php if($jssi["s".$i.""]=="1"){?>Checked<?php }?>><br />
												</div>
											</div>
											<div class="v3-col-md-12">
												<input type="text" class="form-control" name="n<?php echo $i; ?>" id="simple-required" value="<?php echo $jstn["n".$i.""];?>" title="n<?php echo $i; ?>" style="margin-top:3px;" placeholder="Input <?php echo $sdil[40]; //Açıklama?>, <?php echo $sdil[173]; //Seçenek?>">
											</div>
										<a class="v3-btn v3-btn-xs v3-btn-warning" id="fn<?php echo $i; ?>" style="position: absolute; right: 9px; margin-top: <?php if($mobile==""){echo "110";}else{echo "24";}?>px; cursor:pointer; <?php if($jstn["t".$i.""]<>"" and $jstn["t".$f.""]<>""){echo "display:none;";}?>" onclick="toggle('#f<?php echo $i+1; ?>');hide('fn<?php echo $i; ?>')"><i class="fa fa-plus"></i> <?php echo $sdil[200].$sdil[201]; //Yeni?></a>
										</fieldset>
									<?php }?>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<div class="alert alert-info v3-row" style=" font-size:9px;bottom:-20px;">
			<i class="fa fa-plus"></i> <?php echo $rs["ts1"];?> <?php if(!empty($rs["ts2"])){?> & <i class="fa fa-refresh"></i> <?php echo $rs["ts2"];?> <?php }?>
		</div>
	</div>
</form>
</section>
</div>
</div>
</section>
<aside id="sidebar-right" class="sidebar-right">
	<div class="nano">
		<div class="nano-content">
			<a href="#" class="mobile-close d-md-none">
				Collapse <i class="fa fa-chevron-right"></i>
			</a>
			<div class="sidebar-right-wrapper">
				...
			</div>
		</div>
	</div>
</aside>
</div>
</section>
<?php
//-------------------------------------------------------------------------/İşlem Ekle/
if($_GET["durum"] == "kaydet"){
	$tnarr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="t" or substr($key,0,1)=="n" or substr($key,0,1)=="p" or substr($key,0,1)=="v"){
			$tnarr = $tnarr + array( $key => $value);
		}
	}
	$tnarr = json_encode($tnarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$siarr = array();
	foreach ($_POST as $key => $value){
		if(substr($key,0,1)=="s" or substr($key,0,1)=="i"){
			$siarr = $siarr + array( $key => $value);
		}
	}
	$siarr = json_encode($siarr, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_NUMERIC_CHECK);
	$Rsq = mysqli_query($conn, "update ".$_SESSION['lang']." set m1='".addslashes($_POST["m1"])."', m3='".addslashes($_POST["m3"])."', n1='".addslashes(stripslashes($tnarr))."' where id=".$_GET["id"]."");
	for ($l = 1; $l <= $lx; $l++) {
		$Rsq = mysqli_query($conn, "update lang".$l." set m2='".addslashes($_POST["m2"])."', m4='".$_POST["ffile"]."', n2='".addslashes(stripslashes($siarr))."'  where id=".$_GET["id"]."");
	}
	echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&id=".$_GET["id"]."&durum=ok#&tab-icerik",self,500,1);
}
?>