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

<div id="tour-11" class="header-content">
  <h2><i class="fa fa-video-camera"></i>Video Listesi</h2>
</div>
<div class="body-content animated fadeIn">
  <div class="panel rounded shadow">
    <div class="panel-body">
      <table id="datatable-dom" class="table table-striped">
        <thead>
          <tr>
            <th data-class="expand" class="text-center">Video Resmi</th>
            <th data-hide="phone">Başlık</th>
            <th>Gizle/Göster</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 video 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 video SET sira='".$_GET["sira"]."' WHERE sira='".$yeni_sira."'");
              $db->query("UPDATE video SET sira='".$yeni_sira."' WHERE sira='0'");
          }
/*$video = $db->select('video')
                    ->orderby('id','DESC')
                    ->run();*/

                    $video = $Modul->sayfalamastart($kayitsayisi,'video');
                    foreach ($video as $key => $videoRow){
                    ?>
          <tr>
            <td class="text-center" style="width: 2%"><img src="../upload/video/<?php echo $videoRow['videoResim']; ?>"  width="160" class="mt-5 mb-5"/></td>
            <td><?php echo $videoRow['videoBaslik']; ?></td>
            <td>
              <label class="switch">

                <input type="checkbox" id="toggle[<?=$videoRow['id']?>]" name="toggle" <?php if($videoRow['aktifkontrol']=="aktif"){ print "checked"; } ?> onclick="aktifkontrol(<?=$videoRow['id']?>,'video');">
                <span class="slider round"></span>
              </label>
            </td>
            <td align="center">
              <?php if($videoRow["sira"] != "1"){?><a href="index.php?do=video&islev=yukari&id=<?=$videoRow["id"]?>&sira=<?=$videoRow["sira"]?>"><i class="fa fa-arrow-up fa-2x" style="color:green;"></i></a> <?php } ?>
&nbsp;  &nbsp; <?php if($videoRow["sira"] != Count($video)){?><a href="index.php?do=video&islev=asagi&id=<?=$videoRow["id"]?>&sira=<?=$videoRow["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=video&duzenle=<?php echo $videoRow['id']; ?>" class="btn btn-sm btn-primary btn-s btn-push"><i class="fa fa-edit"></i> Videoyu Düzenle</a>
              <a href="#" onclick="itemsil(<?php echo $videoRow['id']?>,'','<?php echo $videoRow['videoBaslik']?>','video');" class="btn btn-sm btn-danger btn-s btn-push"><i class="fa fa-trash"></i> Videoyu Sil</a>

            </td>
          </tr>
          <?php } ?>
        </tbody>
      </table>
    </div>
  </div>
  <?php
    $Modul->sayfalama("video","video", $kayitsayisi);    //sayfa do , tablo adı , limit , sayfa_type (tablo sayfa değilse girme)
  ?>
</div>
