<?php if(!defined("Hacking")){die("404 Not Found"); } ?>

<div id="tour-11" class="header-content">
  <h2><i class="fa fa-picture-o"></i>Slayt Listesi</h2>
</div>
<div class="body-content animated fadeIn">
  <div class="panel rounded shadow">
    <div class="panel-body">
      <table class="table table-striped">
        <thead>
          <tr>
            <th data-class="expand" class="text-center">Resim</th>
            <th data-hide="phone">Başlık</th>
            <th data-hide="phone" class="text-center">Gizle/Göster</th>
            <th data-hide="phone" class="text-center">Başlık Durumu</th>
            <th data-hide="phone" class="text-center">Sıralama</th>
            <th data-hide="phone,tablet" style="min-width: 200px" class="text-center">İşlem</th>
          </tr>
        </thead>
        <tbody>
          <?php
          if(@$_GET["islev"] != ""){
              $db->query("UPDATE slider SET sira='0' WHERE id='".$_GET["id"]."'");
              if($_GET["islev"] == "asagi"){
               $yeni_sira = $_GET["sira"] + 1;
              }elseif($_GET["islev"] == "yukari"){
                $yeni_sira = $_GET["sira"] - 1;
              }
              $db->query("UPDATE slider SET sira='".$_GET["sira"]."' WHERE sira='".$yeni_sira."'");
              $db->query("UPDATE slider SET sira='".$yeni_sira."' WHERE sira='0'");
          }
              /*  $galeri = $db->select('slider')
                    ->orderby('id','DESC')
                    ->run();*/
                    $galeri = $Modul->sayfalamastart($kayitsayisi,'slider');
                foreach ($galeri as $key => $galeriRow){
                    ?>
          <tr>
            <td class="text-center" style="width: 2%"><img src="../upload/slider/<?php echo $galeriRow['sliderResim']; ?>"  width="160" class="mt-5 mb-5"/></td>
            <td><?php echo $galeriRow['sliderBaslik']; ?></td>
          <!--  <td><center><?php //if($galeriRow["resim_goster"]=='1'){ echo '<i class="fa fa-eye" style="color:green;">'; } else { echo '<i class="fa fa-eye-slash" style="color:red;">';} ?></center></td> -->
          <td><center>
            <label class="switch">

              <input type="checkbox" id="toggle[<?=$galeriRow['id']?>]" name="toggle" <?php if($galeriRow['resim_goster']=="1"){ print "checked"; } ?> onclick="aktifkontrol(<?=$galeriRow['id']?>,'slider');">
              <span class="slider round"></span>
            </label></center>
          </td>
            <td><center><?php if($galeriRow["baslik_goster"]=='1'){ echo '<i class="fa fa-eye" style="color:green;">'; } else { echo '<i class="fa fa-eye-slash" style="color:red;">';} ?></center></td>
              <td align="center">
                <?php if($galeriRow["sira"] != "1"){?><a href="index.php?do=slider&islev=yukari&id=<?=$galeriRow["id"]?>&sira=<?=$galeriRow["sira"]?>"><i class="fa fa-arrow-up fa-2x" style="color:green;"></i></a> <?php } ?>
              &nbsp;  &nbsp; <?php if($galeriRow["sira"] != Count($galeri)){?><a href="index.php?do=slider&islev=asagi&id=<?=$galeriRow["id"]?>&sira=<?=$galeriRow["sira"]?>"><i class="fa fa-arrow-down fa-2x" style="color:red;"></i></a><?php } ?>
              </td>
            <td class="text-center">
              <a href="index.php?do=slider&duzenle=<?php echo $galeriRow['id']; ?>" class="btn btn-sm btn-primary btn-xs btn-push"><i class="fa fa-edit"></i> Düzenle</a>
              <a href="#" onclick="itemsil(<?php echo $galeriRow['id']?>,'','<?php echo $galeriRow['sliderBaslik']?>','slider');" class="btn btn-sm btn-danger btn-xs btn-push"><i class="fa fa-trash"></i>&nbsp;Slaytı Sil</a></td>
          </tr>
          <?php } ?>
        </tbody>
      </table>
    </div>
  </div>
  <?php
    $Modul->sayfalama('slider',"slider", $kayitsayisi);
  ?>
</div>
