<?php if(!defined("Hacking")){die("404 Not Found"); } ?>
<?php
    $gelen = @get('duzenle');
?>
<?php
error_reporting(0);
$video_bilgileri = $db->select('video')
        ->where('id',$gelen)
        ->run(true);

        if($_POST){
          // Formdan Gelen Dizi Değeri
          $videobaslik = post('videoBaslik');
          $videoEmbed   = $_POST['videoEmbed'];
          $videoResim = $_FILES["videoResim"]["name"];
          $videoText   = $_POST['videoText'];

          // referans Düzenleme Fonksiyonu
          $Modul->video_duzenle($videobaslik,$videoEmbed,$videoResim,$videoText,$gelen);
        }

  ?>
<div id="tour-11" class="header-content">
  <h2><i class="fa fa-video-camera"></i>Video Düzenle</h2>
  <div align="right">
    <button type="button" class="btn btn-success"><y style="color:black;"><b>Oluşturma: </b><?=date("d/m/Y", strtotime($video_bilgileri["olusturma_tarihi"]));?></y></button>
    <button type="button" class="btn btn-warning"><y style="color:black;"><b>Düzenleme:</b> <?=date("d/m/Y", strtotime($video_bilgileri["duzenleme_tarihi"]));?></y></button>
</div>
</div>
<div class="body-content animated fadeIn">

  <form action="" method="post" name="" enctype="multipart/form-data">
    <div class="row">
      <div class="col-md-12">
        <div class="panel rounded shadow">
          <div class="panel-heading">
            <div class="pull-left">
              <h3 class="panel-title"><i class="fa fa-edit"></i>Video Başlığı</h3>
            </div>
            <div class="clearfix"></div>
          </div>
          <div class="panel-body no-padding">
            <div class="form-body">
              <div class="form-group">
                <input class="form-control" name="videoBaslik" value="<?php echo $video_bilgileri["videoBaslik"]; ?>" placeholder="Video Adı" type="text">
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="row">
     <div class="col-md-12">
       <div class="panel rounded shadow">
         <div class="panel-heading">
           <div class="pull-left">
             <h3 class="panel-title"><i class="fa fa-picture-o"></i>Video Önizleme Resmi</h3>
           </div>
           <div class="clearfix"></div>
         </div>
         <div class="panel-body no-padding">
           <div class="form-group">
             <input class="form-control rounded" name="videoResim" style="border:0px solid #989898!important" type="file">
           </div>
           <center style="color:red;">
             Videoya ait kayıtlı resim, Eğerki yeni resim yüklemeyecekseniz seçim yapmanız gerekmez! <br>
             <img src="../upload/video/<?php echo $video_bilgileri["videoResim"]; ?>" style="width:150px;height:150px;">
           </center>
           <br>
         </div>
       </div>
       </div>
     </div>

     <div class="row">
       <div class="col-md-12">
         <div class="panel rounded shadow">
           <div class="panel-heading">
             <div class="pull-left">
               <h3 class="panel-title"><i class="fa fa-youtube"></i>Video URL</h3>
             </div>
             <div class="clearfix"></div>
           </div>
           <div class="panel-body no-padding">
             <div class="form-group">
               <input class="form-control rounded" name="videoEmbed" value='<?php echo $video_bilgileri["videoEmbed"]; ?>'  type="text">
             </div>
           </div>
         </div>
       </div>
     </div>
    <div class="row">
      <div class="col-md-12">
        <div class="panel rounded shadow">
          <div class="panel-heading">
            <div class="pull-left">
              <h3 class="panel-title"><i class="fa fa-edit"></i>Video Açıklaması</h3>
            </div>
            <div class="clearfix"></div>
          </div>
          <div class="panel-body no-padding">
            <div class="form-group">
              <textarea class="ckeditor" cols="80" id="editor1" name="videoText"  rows="10">
                  <?php echo $video_bilgileri["videoText"];?>
              </textarea>
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="form-footer">
          <div class="pull-left">
            <button class="btn btn-primary mr-5" type="submit">
            <li class="fa fa-floppy-o"></li>
            &nbsp;&nbsp;Düzenlemeyi Kaydet</button>
          </div>
          <div class="clearfix"></div>
      </div>
  </form>
</div>
