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

<div id="tour-11" class="header-content">
  <h2><i class="fa fa-file-text-o"></i>Sayfa Ayar Paneli</h2>
</div>
<div class="body-content animated fadeIn">
  <div class="row">
    <div class="col-md-12">
      <div class="panel">
        <div class="panel-body no-padding">
          <div class="table-responsive">
            <table class="table table-bordered table-middle">
              <thead>
                <tr>
                  <th>Sayfa Adı</th>
                  <th>Sef-Link</th>
                  <th>Menüde Gizle/Göster</th>
                  <th>Sıralama</th>
                  <th class="text-center" style="width: 11%;">İşlem</th>
                </tr>
              </thead>
              <tbody>
                <?php
                if(@$_GET["islev"] != ""){
                    $db->query("UPDATE sayfalar SET sira='0' WHERE sayfa_id='".$_GET["id"]."' AND sayfa_type=0");
                    if($_GET["islev"] == "asagi"){
                     $yeni_sira = $_GET["sira"] + 1;
                    }elseif($_GET["islev"] == "yukari"){
                      $yeni_sira = $_GET["sira"] - 1;
                    }
                    $db->query("UPDATE sayfalar SET sira='".$_GET["sira"]."' WHERE sira='".$yeni_sira."' AND sayfa_type=0");
                    $db->query("UPDATE sayfalar SET sira='".$yeni_sira."' WHERE sira='0' AND sayfa_type=0");
                }
                            //$sayfalar = $Sayfa->sayfa_listele();
                            $sayfalar = $Modul->sayfalamastart($kayitsayisi,'sayfalar',0);
                            foreach ($sayfalar as $key => $value){
                        ?>
                <tr class="border-danger">
                  <td><?php echo $value['sayfa_baslik']; ?></td>
                  <td><?php echo $value['sayfa_seflink']; ?></td>
                  <td>
                    <label class="switch">

                      <input type="checkbox" id="toggle[<?=$value['sayfa_id']?>]" name="toggle" <?php if($value['aktifkontrol']=="aktif"){ print "checked"; } ?> onclick="aktifkontrol(<?=$value['sayfa_id']?>,'sayfalar');">
                      <span class="slider round"></span>
                    </label>
                  </td>
                  <td align="center">
                    <?php if($value["sira"] != "1"){?><a href="index.php?do=sayfa&islev=yukari&id=<?=$value["sayfa_id"]?>&sira=<?=$value["sira"]?>"><i class="fa fa-arrow-up fa-2x" style="color:green;"></i></a> <?php } ?>
                  &nbsp;  &nbsp; <?php if($value["sira"] != Count($sayfalar)){?><a href="index.php?do=sayfa&islev=asagi&id=<?=$value["sayfa_id"]?>&sira=<?=$value["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=sayfa&duzenle=<?php echo $value['sayfa_id']; ?>" class="btn btn-success btn-s"> <i class="fa fa-edit"></i></a>
                                          <a href="#" onclick="itemsil(<?php echo $value['sayfa_id']?>,'','<?php echo $value['sayfa_baslik']?>','sayfa');" class="btn btn-danger btn-s"> <i class="fa fa-trash-o"></i></a></td>
                </tr>
                <?php } ?>
              </tbody>
            </table>
          </div>
        </div>
      </div>
      <?php
        $Modul->sayfalama("sayfa","sayfalar",$kayitsayisi, 0);    //sayfa do , tablo adı , limit , sayfa_type (tablo sayfa değilse girme)
      ?>
    </div>
  </div>
</div>
