<?php
include ("ust.php");
session_start(); ## -> Oturum Başlatıldı
$giris_kontrol = $_SESSION['kullanici_id']; if(empty($giris_kontrol)){echo '<meta http-equiv="refresh" content="0;URL=index.php">';}else{


$kategori = g("kategori");
$dilgoster = g("dilgoster");
$pid = g("pid");
if(empty($dilgoster)){}else{$d_k_d = "&dilgoster=$dilgoster";}

## -> Silme İşlemi
$sil = g('sil');
switch($sil){
case "sil":

// İşlem Kayıt Modülü
$islemk_islem = "Bir proje slider resmi silindi";
include("moduller/islemkayit_modul.php");

$id = g('id'); $id = mysql_real_escape_string($id);
$dosyabul=mysql_query("SELECT * FROM proje_slider WHERE id='$id'"); 
$getir2=mysql_fetch_array($dosyabul); 
$resim = $getir2['resim'];
unlink('../'.$resim.'');
$sil = mysql_query("delete from proje_slider where id='$id'") or die("Hata Olustu!");
if($sil){echo '<meta http-equiv="refresh" content="0;URL=proje_slider.php?durum=duzenleme-basarili&pid='.$pid.'&kategori='.$kategori.'"> ';}
}
## ->  Silme İşlemi

$icerik_getir=mysql_query("SELECT * FROM diller WHERE id='$dilgoster'"); 
$getir=mysql_fetch_array($icerik_getir); 
$dil_g_u_baslik = $getir['baslik'];
?>
				<link rel="stylesheet" href="assets/plugins/html5-editor/bootstrap-wysihtml5.css" />
				<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
			
				<div class="container-fluid">
              
				<?php // Bakım modu aktif ise tüm proje_sliderda bakım uyarısı verir.
				if($geayar_bakim == "evet"){include("moduller/bakim-modul.php");} ?>
		
                <div class="row">
                <div class="col-12">

				<?php $durum = g('durum'); if($durum == "duzenleme-basarili") { ?>
				<div class="alert alert-success"> <i class="fa fa-check"></i> İşlem başarıyla gerçekleştirildi
				<button type="button" class="close" data-dismiss="alert" aria-label="Close"> </button>
				</div>
				<?php } ?>
				
				
                <div class="card">
                <div class="card-body">
				<div class="col-md-12">
				<div class="row">		
				<div class="col-md-8">
				<h4 class="card-title">
				<?php
				$icerik_getir=mysql_query("SELECT * FROM projeler WHERE id='$pid'"); 
				$getir=mysql_fetch_array($icerik_getir); 
				$p_k_b_baslik = $getir['baslik'];
				echo $p_k_b_baslik;
				?> Slider Resimleri <h4>
                <h6 class="card-subtitle">Bu projeye bağlı slider resimlerini kolaylıkla yönetebilirsiniz</h6>
				</div>
				<div class="col-md-4">
				<?php 
				$islem = g("islem");
				if(empty($islem)){?>
				
		
				<?php if($kontrol_kullanici_yetki == "1"){?>
                <a  data-toggle="modal" data-target=".bs-example-modal-lg"  style="float:right;margin-left:10px;">
				<button type="button" class="btn waves-effect waves-light btn-primary" style="float:right;">
				<i class="fa fa-plus-circle"></i> Yeni
				</button>
				</a>
				<?php }else{ ?> 
				 <a  data-toggle="modal" data-target="#uyari-modal"  style="float:right;margin-left:10px;">
				<button type="button" class="btn waves-effect waves-light btn-primary" style="float:right;">
				<i class="fa fa-plus-circle"></i> Yeni
				</button>
				</a>
				<?php } ?>
					
				<a href="projeler.php?kategori=<?php echo $kategori;?>">
				<button type="button" class="btn waves-effect waves-light btn-danger" style="float:right;">
				<i class="fa fa-arrow-left"></i> Geri Dön
				</button>
				</a>
				
				
				</div>

				<div id="olustur-modal" class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
				<div class="modal-dialog modal-lg">
				<div class="modal-content">
				<div class="modal-header">
				<h4 class="modal-title"><i class="fa fa-plus" aria-hidden="true"></i>  Slider Resmi Yükle</h4>
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				</div>
				<div class="modal-body">
				<div class="modal-body">
				<form class="form-horizontal form-bordered" action='proje_slider.php?islem=yeni&ileri=ekle&pid=<?php echo $pid;?>&kategori=<?php echo $kategori;?>' method='post' enctype="multipart/form-data">
	
				<div class="panel-body panel-body-nopadding">
				<form class="form-horizontal form-bordered" action='fotografgalerisi.php?page=fotografyukle' method='post' enctype="multipart/form-data">
				<div class="form-group">
				<label class="col-sm-3 control-label">Resim Seçin: </label>
    
				<input name="resim" type="file" min="1" max="3" class="form-control" required="required"/>
      
				</div>
       
				</div>
		
				<div class="panel-footer">
				<div class="row">
				<div class="col-sm-6 col-sm-offset-3">
				<button class="btn btn-primary">Resmi Ekle</button>&nbsp;
				</div>
				</div>
				</div>
		  
				
				</div></form></div></div></div></div>
				
				</div>
				</div>
				</div>
				</div>
				
				<div class="row">
				<?php
				$resim_al = mysql_query("SELECT * FROM proje_slider WHERE m14='$pid' ORDER BY id DESC limit 0,999");
				while($yaz=mysql_fetch_array($resim_al)){

				$id = $yaz['id'];
				$fotograf = $yaz['resim'];
				$fototarih = $yaz['fototarih'];

				$boyut=filesize("../$fotograf");


				$boyut = $boyut / (1024);   
				$degisken = "$boyut";
				$sonhali = substr($degisken, 0, 3); 

				$bilgi = getimagesize("../$fotograf"); 
 
				$fotogenislik = $bilgi[0];
				$fotoyukseklik = $bilgi[1];
				$fototip = $bilgi['mime'];

				echo '

 				 <div class="col-lg-3 col-md-6">
				<div class="card">
				<div class="el-card-item">
				<div class="el-card-avatar el-overlay-1"> <img src="../'.$fotograf.'" alt="#" class="img-fluid"  />
				';
				if($kontrol_kullanici_yetki == "1"){
				echo '<center><a class="btn btn-small btn-block btn-danger" style="color:white;" data-toggle="modal" data-target="#sil-modal'.$id.'"><i class="fa fa-trash"></i></a></center>';
				}else{
				echo '<center><a class="btn btn-small btn-block btn-danger" style="color:white;" data-toggle="modal" data-target="#uyari-modal"><i class="fa fa-trash"></i></a></center>';	
				}
				echo '
				</div>
				<div class="el-card-content">
				<center><small>
				'.$fotogenislik.' x '.$fotoyukseklik.' px <br>
				'.$sonhali.' KB <br>
				'.$fototip.'</small></center>
				<br/> </div>
				</div>
				</div>
				</div>
				';
				
				echo '
				<div id="sil-modal'.$id.'" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="display: none;">
				<div class="modal-dialog">
				<div class="modal-content">
				<div class="modal-header">
				<h4 class="modal-title"><i class="fa fa-times" aria-hidden="true"></i> Resmi Sil</h4>
				<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
				</div>
				<div class="modal-body">
				<p>Bu resmi gerçekten silmek istiyormusunuz ?</p>
				</div>
				<div class="modal-footer">
				<button type="button" class="btn btn-default waves-effect" data-dismiss="modal">Hayır</button>
				<a href="proje_slider.php?sil=sil&id='.$id.'&pid='.$pid.'&kategori='.$kategori.'"><button type="button" class="btn btn-danger waves-effect waves-light">Evet</button></a>
				</div>
				</div>
				</div>
				</div>
				';
				
				}
				?>
				
				</div>
				
				
				<?php }?>
				
             
			

				<?php if($islem == "yeni"){?>
				
				<?php 
				## -> Yeni İçerik Ekleme
				$ileri = g('ileri');
				switch($ileri){
				case "ekle":

				$rastgele = rand(10000000,99999999);
				$posted = "resim";
			
				$m14 = $pid;
				$tarih = date('d.m.Y');
				if ($_FILES["resim"]['name']){ 
				$filename=$_FILES["$posted"]['name']; 
				$efilename = explode('.', $filename); 
				$uzanti = $efilename[count($efilename) - 1]; 

				$isim = $rastgele;
				$yeniad = "".$isim.".".$uzanti.""; 
				$resim = "vi-includes/images/projeler/".$yeniad; 
				move_uploaded_file($_FILES["$posted"]['tmp_name'],"../vi-includes/images/projeler/".$yeniad); } 

				// İşlem Kayıt Modülü
				$islemk_islem = "Yeni proje slider resmi yüklendi";
				include("moduller/islemkayit_modul.php");
				

				$ekle_veri = mysql_query("INSERT INTO proje_slider (resim,m14)VALUES('$resim','$m14')");

				if($ekle_veri){echo '<meta http-equiv="refresh" content="0;URL=proje_slider.php?durum=duzenleme-basarili&pid='.$pid.'&kategori='.$kategori.'"> '; }
				else{ echo '<meta http-equiv="refresh" content="0;URL=proje_slider.php?durum=hata"> '; }
				break;
				}
				## -> Yeni İçerik Ekleme
				
				?>	
			
				<?php } ?>
				
				
				
				
			
			
				
				
				
			
    
                </div>
                </div>
				</div>
                </div>
				</div>


	
<?php
include ("alt.php");
}
?>