<?php include("header.php");?>


<?php
if(g('islem')=="sil")
{
	$id = g('id');
	
	$resim_bul=Sonuc(Sorgu("SELECT * FROM urun_kategori WHERE id='$id'"));
	$resim_sil1	=	unlink("../uploads/urunkategori/kucuk/".$resim_bul->resim);
	$resim_sil2	=	unlink("../uploads/urunkategori/".$resim_bul->resim);
	
	$kategori_sil_sorgu = Sorgu("DELETE FROM urun_kategori WHERE id='$id'");
	
	$bilgi = '	 <div class="alert alert-success">
										Başarı ile Silinmiştir !
				  </div>' ;
	
}

?>


  <section id="main-content">
          <section class="wrapper site-min-height">
              <!-- page start-->
              <section class="panel">
                  <header class="panel-heading">
                      Kategoriler
                  </header>
                  <div class="panel-body">
                      <div class="adv-table editable-table ">
                          <div class="clearfix">
                               <div class="box-header">
                <a href="kategoriekle.php" class="btn btn-shadow btn-warning">
				<i class="fa fa-plus"></i> Kategori Ekle</a>
                </div><!-- /.box-header --><br>
                          
                          </div>
                          <div class="space15"></div>
                          <table class="table table-striped table-hover table-bordered" id="editable-sample">
                              <thead>
                              <tr>
                                  <th>Sıra</th>
                                  <th>Kategori Adı</th>
                                  <th>Kategori Resmi</th>
                                  <th>Durumu</th>
                                  <th>İşlem</th>
                                 
                              </tr>
                              </thead>
                              <tbody>
							  
							  
							  
				        <?php $KategoriSorgu = Sorgu("SELECT * FROM urun_kategori ORDER BY id DESC");
        while($KategoriSonuc = Sonuc($KategoriSorgu)){?>
							  
                              <tr class="">
                                  <td><?php echo $KategoriSonuc->id; ?></td>
                                   <td><?php echo $KategoriSonuc->id; ?></td>
                        <td><?php echo $KategoriSonuc->kategori_adi; ?></td>
								  <td>
								  <?php if($SayfaSonuc->resim == ""){?>
                                  <img width="30px" height="30px" src="https://placeholdit.imgix.net/~text?txtsize=19&bg=efefef&txtclr=aaaaaa%26text%3Dno%2Bimage&txt=no+image&w=200&h=150">
								  <?php }else{?>
								 <img width="30px" height="30px" src="../uploads/urunkategori/<?php echo $KategoriSonuc->resim; ?>">
								   <?php } ?>
								   </td>
								   
								   
								   
                                  <td class="center">
								  <?php
			 				        if($KategoriSonuc->durum=='1'){?>
								  <span class="label label-success label-mini">Aktif</span>
								     <?php } else { ?>
								  <span class="label label-danger label-mini">Pasif</span>
								    <?php } ?> 
									</td>
								  
								  
								  
								  
								           <td>

									      <a  href="?islem=sil&id=<?php echo $KategoriSonuc->id;?>" onclick="return confirm('Silmek istediğinize emin misiniz ?')" class="btn btn-danger btn-xs"><i class="fa fa-trash-o "></i></a>
										     <a  href="kategoriekle.php?islem=duzenle&id=<?php echo $KategoriSonuc->id;?>""  class="btn btn-primary btn-xs"><i class="fa fa-pencil"></i></a>
                                            </td>
											
                              </tr>
                             
                             
							    <?php } ?>  
							 
							 
							 
							 
							 
							 
                              </tbody>
                          </table>
                      </div>
                  </div>
              </section>
              <!-- page end-->
          </section>
      </section>



<?php include("footer.php");?>