<?php
	header('Content-Type: text/html; charset=utf-8');
	error_reporting(0);
	$path="../../";
	include("../../map.php");
	include("../../secure.php");
	include("../../scripts.php");
?>
<!DOCTYPE html>
<html lang="tr">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>+Modules</title>
</head>
<body>
	<div class="alert alert-warning" id="result" style="display:none;"></div>
    <div class="" style="padding:0px 15px;">
        <div class="row">
            <!-- İçerik alanı -->
            <div class="col-12">
                <div class="tab-content" id="pills-tabContent">
                    <div class="tab-pane show active" id="pills-content-1" role="tabpanel" aria-labelledby="pills-tab-1">
							<table class="table table-no-more table-bordered table-striped mb-0">
								<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=ekle" autocomplete="off" id="fadd" name="tform">
									<tr class="addtr">
										<td class=""><input type="text" name="n1" id="n1" title="Modul [n1]" placeholder="+Modules" class="form-control"></td>
										<td class="w15"><input type="text" name="n2" id="n2" title="Kısaltma [n2]" placeholder="Tanım" class="form-control"></td>
										<td class="w5"><input style="" type="text" name="n4" value="" placeholder="T" class="form-control" title="Tanım ilk karakter"></td>
										<td class="w15">
											<input type="text" name="n3" id="n3" onkeyup="icons(this);" list="icons" title="ikon [n3]" placeholder="fa fa-" class="form-control">
											<ul class="icons" id="icons" data-input="n3" style="display:none;"></ul>
										</td>
										<td class="w10">
											<input type="text" list="lidesign" name="t3" id="t3" title="design [t3]" placeholder="Desing" class="form-control">
												<datalist id="lidesign">
													<?php
													$excludeFiles = ['footer', 'header', 'index', 'func', 'map', 'meta', 'script', 'sql'];
													$fileList = glob('../../../view/*.php'); $s = 0;
													foreach ($fileList as $file) {
														$filename = basename($file, '.php');
														if (!in_array($filename, $excludeFiles)) { $s++;
															?>
															<option value="<?php echo $filename ?>" title="<?php echo $filename ?>" alt="<?php echo $filename ?>" <?php if ($filename == $jsi["idesign"]) { echo "selected"; } ?>>
																<?php echo $filename ?>
															</option>
															<?php
														}
													}
													?>
												</datalist>
										</td>
										<td class="w5"><input style="" type="text" name="s10" title="No" value="0" class="form-control"></td>
										<td class="w5">
											<div class="switch switch-sm switch-success">
												<input type="checkbox" data-plugin-ios-switch="" name="s11" id="sitemap" value="1" class="switch" <?php if($rs["s11"]==1) {?>checked<?php }?> title="Sitemap" alt="Sitemap">
											</div>
										</td>
										<td class="w8">
											<select size="1" name="s19" style="" class="form-control">
												<option value="0">Admin</option>
												<?php $sql=mysqli_query($conn, "select s2,id,t1 from t5 where s9=1 $luye"); while($rsm=mysqli_fetch_assoc($sql)){?>
												<option class="" value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php if($rs["s19"]==$rsm["id"]){echo "Selected";}?>><?php echo $rsm["t1"];?></option>												<?php }?>
											</select>
										</td>
										<td class="w6">
											<div class="input-group-btn">
												<button tabindex="-1" class="btn btn-warning mbtn"  onclick="document.getElementById('fadd').submit();" type="button" <?php if ($authority==0){?>disabled<?php }?>><i class="fa fa-plus"></i><span class="ddn"> <?php echo $sdil[201]; //ekle?></span></button>
											</div>
										</td>
									<tr>
									</form>
										<?php $sqlx=mysqli_query($conn, "select * from genel where ne='xmodules' order by s10 asc,id desc"); while($rs=mysqli_fetch_assoc($sqlx)){?>
											<form method="POST" action="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=duzenle&id=<?php echo $rs["id"];?>" autocomplete="off" id="f<?php echo $rs["id"];?>">
												<tr  data-id="<?php echo $rs["id"];?>" style="">
													<td class=""><input type="text" name="n1" class="form-control" value="<?php echo $rs["n1"];?>" placeholder="+Modules"></td>
													<td class=""><input type="text" name="n2" class="form-control" value="<?php echo $rs["n2"];?>" placeholder="Tanım"></td>
													<td class=""><input style="" type="text" name="n4" value="<?php echo $rs["n4"];?>" placeholder="T" title="Tanım ilk karakter" class="form-control"></td>
													<td class=""><input type="text" name="n3" class="form-control" value="<?php echo $rs["n3"];?>" placeholder="fa fa-"></td>
													<td class=""><input type="text" name="t3" class="form-control" value="<?php echo $rs["t3"];?>" placeholder=""></td>
													<td class=""><input style="" type="text" name="s10" title="No" value="<?php echo $rs["s10"];?>" class="form-control"></td>
													<td class="">
													<div class="switch switch-sm switch-success">
														<input type="checkbox" data-plugin-ios-switch="" name="s11" id="sitemap" value="1" class="switch" <?php if($rs["s11"]==1) {?>checked<?php }?> title="Sitemap" alt="Sitemap">
													</div>
													</td>
													<td>
														<select size="1" name="s19" class="form-control">
															<option value="0">Admin</option>
															<?php $sql=mysqli_query($conn, "select s2,id,t1 from t5 where s9=1 $luye"); while($rsm=mysqli_fetch_assoc($sql)){?>
																<option class="" value="<?php echo $rsm["id"];?>" title="<?php echo $rsm["t1"];?>" alt="<?php echo $rsm["t1"];?>" style="color:#6699FF" <?php if($rs["s19"]==$rsm["id"]){echo "Selected";}?>><?php echo $rsm["t1"];?></option>
															<?php }?>
														</select>
													</td>
													<td class="">
														<div class="input-group-btn">
															<button tabindex="-1" class="btn btn-warning" type="button"  onclick="document.getElementById('f<?php echo $rs["id"];?>').submit();" <?php if ($authority==0){?>disabled<?php }?>><i class="fa fa-refresh"></i></button>
															<button style="margin-left: 1px" tabindex="-1" class="btn btn-danger btn-delete-row" data-href="?ne=<?php echo $_GET["ne"];?>&islem=<?php echo $_GET["islem"];?>&durum=sil&id=<?php echo $rs["id"];?>"><i class="fa fa-times"></i></button>
															<!--<button style="margin-left: 1px" tabindex="-1" class="btn btn-info" onclick="location.href='?ne=ayarlar&islem=ayarlar&tab=master&module=<?php echo $rs["n2"];?>'"><i class="fa fa-cog"></i></button>-->
														</div>
													</td>
												</tr>
											</form>
										<?php }?>
										</table>
                    </div>
                </div>
            </div>
        </div>
    </div>
</section>
</body>
</html>
<?php
	if($_POST["s10"]==""){$s10=0;}else{$s10=$_POST["s10"];}
	if($_POST["s11"]==""){$s11=0;}else{$s11=$_POST["s11"];}
	if($_POST["s19"]==""){$s19=0;}else{$s19=$_POST["s19"];}
	if($_GET["durum"]=="ekle"){
		$sql = $conn->query("insert into genel(t2,t3,ne,n1,n2,n3,n4,n5,s10,s11,s19) VALUES ('".$_POST["t2"]."', '".$_POST["t3"]."', 'xmodules', '".$_POST["n1"]."', '".$_POST["n2"]."', '".$_POST["n3"]."', '".$_POST["n4"]."', '".$_POST["n5"]."', '".$s10."', '".$s11."', '".$s19."')");
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);

	}elseif($_GET["durum"]=="duzenle"){
		$Rs = mysqli_query($conn, "update genel set t3='".$_POST["t3"]."', n1='".$_POST["n1"]."', n2='".$_POST["n2"]."', n3='".$_POST["n3"]."', n4='".$_POST["n4"]."', n5='".$_POST["n5"]."', s10='".$s10."', s11='".$s11."', s19='".$s19."' Where id=".$_GET["id"]."");		
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);

	}elseif($_GET["durum"]=="sil"){
		$Rs = mysqli_query($conn, "delete from genel where id=".$_GET["id"]);
		echo location("?ne=".$_GET["ne"]."&islem=".$_GET["islem"]."&durum=ok",self,500,1);	
	}
	?>