<?php
if ($_GET[act] == '') {

?>
  <div class="col-xs-12">
    <div class="box">
      <div class="box-header">
        <h3 class="box-title"><?php if (isset($_GET[kelas]) and isset($_GET[tahun])) {
                                echo "Jadwal Pelajaran";
                              } else {
                                echo "Jadwal Pelajaran Pada Tahun " . date('Y');
                              } ?></h3>
        <form style='margin-right:5px; margin-top:0px' class='pull-right' action='' method='GET'>
          <input type="hidden" name='view' value='soal'>
          <?php

          $tahun = mysqli_query($conn, "SELECT * FROM tahun_ajaran where aktif='Y'");
          while ($k = mysqli_fetch_array($tahun)) {

            echo "<input type='hidden' class='form-control' value='$k[idTahunAjaran]'name='tahun' > </input>";
          }
          ?>
          <select name='kelas' style='padding:4px'>
            <?php
            if ($_SESSION[level] == 'admin') {
              echo "<option value=''>- Pilih Kelas -</option>";
              $kelas = mysqli_query($conn, "SELECT * FROM kelas_siswa");
              while ($k = mysqli_fetch_array($kelas)) {
                if ($_GET[kelas] == $k[idKelas]) {
                  echo "<option value='$k[idKelas]' selected>$k[idKelas] - $k[nmKelas]</option>";
                } else {
                  echo "<option value='$k[idKelas]'>$k[idKelas] - $k[nmKelas]</option>";
                }
              }
            } elseif ($_SESSION[level] == 'guru') {
              echo "<option value=''>- Pilih Kelas -</option>";
              $kelas = mysqli_query($conn, "SELECT * FROM kelas_siswa");
              while ($k = mysqli_fetch_array($kelas)) {
                if ($_GET[kelas] == $k[idKelas]) {
                  echo "<option value='$k[idKelas]' selected>$k[idKelas] - $k[nmKelas]</option>";
                } else {
                  echo "<option value='$k[idKelas]'>$k[idKelas] - $k[nmKelas]</option>";
                }
              }
            } else {
              echo "<option value=''>- Pilih Kelas -</option>";
              $kelas = mysqli_query($conn, "SELECT * FROM kelas_siswa where idKelas='$_SESSION[kls]'");
              while ($k = mysqli_fetch_array($kelas)) {
                if ($_GET[kelas] == $k[idKelas]) {
                  echo "<option value='$k[idKelas]' selected>$k[idKelas] - $k[nmKelas]</option>";
                } else {
                  echo "<option value='$k[idKelas]'>$k[idKelas] - $k[nmKelas]</option>";
                }
              }
            }


            ?>
          </select>
          <input type="submit" style='margin-top:-4px' class='btn btn-success btn-sm' value='Lihat'>
        </form>

      </div><!-- /.box-header -->
      <div class="box-body">
        <table id="example" class="table table-bordered table-striped">
          <thead>
            <tr>
              <th style='width:20px'>No</th>
              <th>Jadwal Pelajaran</th>
              <th>Kelas</th>
              <th>Guru</th>
              <th>Hari</th>
              <th>Total</th>
              <th>Action</th>
            </tr>
          </thead>
          <tbody>
            <?php
            if (isset($_GET[kelas]) and isset($_GET[tahun])) {
              $tampil = mysqli_query($conn, "SELECT a.*, e.nmKelas, b.namamatapelajaran, b.kode_pelajaran, c.nama_guru FROM rb_jadwal_pelajaran a 
                                            JOIN rb_mata_pelajaran b ON a.kode_pelajaran=b.kode_pelajaran
                                              JOIN rb_guru c ON a.nip=c.nip 
                                            
                                                  JOIN kelas_siswa e ON a.idKelas=e.idKelas 
                                                  where a.idKelas='$_GET[kelas]' 
                                                    AND a.idTahunAjaran='$_GET[tahun]' 
                                                       ORDER BY a.hari DESC");
            }
            $no = 1;
            while ($r = mysqli_fetch_array($tampil)) {
              $total = mysqli_num_rows(mysqli_query($conn, "SELECT * FROM rb_quiz_ujian where kodejdwl='$r[kodejdwl]'"));
              echo "<tr><td>$no</td>
                              <td>$r[namamatapelajaran]</td>
                              <td>$r[nmKelas]</td>
                              <td>$r[nama_guru]</td>
                              <td>$r[hari]</td>
                            
                              
                              <td style='color:red'>$total Record</td>";
              echo "<td style='width:70px !important'><center>
                                <a class='btn btn-success btn-xs' title='List Soal Quiz' href='?view=soal&act=listsoal&jdwl=$r[kodejdwl]&kd=$r[kode_pelajaran]&id=$r[idKelas]'><span class='glyphicon glyphicon-th'></span> List Soal dan Jawaban</a>
                              </center></td>";

              echo "</tr>";
              $no++;
            }
            ?>
          </tbody>
        </table>
      </div><!-- /.box-body -->
      <?php
      if ($_GET[kelas] == '' and $_GET[tahun] == '') {
        echo "<center style='padding:60px; color:red'>Silahkan Memilih Tahun akademik dan Kelas Terlebih dahulu...</center>";
      }
      ?>
    </div>
  </div>
<?php
} elseif ($_GET[act] == 'listsoal') {

  $d = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM kelas_siswa where idKelas='$_GET[id]'"));
  $m = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_mata_pelajaran where kode_pelajaran='$_GET[kd]'"));
  echo "<div class='col-md-12'>
              <div class='box box-info'>
                <div class='box-header with-border'>
                  <h3 class='box-title'>Daftar Ujian dan Quiz Online</b></h3>";
  if ($_SESSION[level] != 'kepala') {
    echo "<a class='pull-right btn btn-primary btn-sm' href='?view=soal&act=tambah&jdwl=$_GET[jdwl]&id=$_GET[id]&kd=$_GET[kd]'>Tambahkan Data</a>";
  }
  echo "</div>
              <div class='box-body'>

              <div class='col-md-12'>
              <table class='table table-condensed table-hover'>
                  <tbody>
                    <input type='hidden' name='id' value='$s[idKelas]'>
                    <tr><th width='120px' scope='row'>Kode Kelas</th> <td>$d[idKelas]</td></tr>
                    <tr><th scope='row'>Nama Kelas</th>               <td>$d[nmKelas]</td></tr>
                    <tr><th scope='row'>Mata Pelajaran</th>           <td>$m[namamatapelajaran]</td></tr>
                  </tbody>
              </table>
              </div>

                <div class='col-md-12'>
                  <table id='example1' class='table table-condensed table-bordered table-striped'>
                      <thead>
                      <tr>
                        <th style='width:40px'>No</th>
                        <th>Kategori</th>
                        <th>Keterangan</th>
                        <th>Batas Waktu</th>";
  if ($_SESSION[level] != 'kepala') {
    echo "<th style='width:210px'>Action</th>";
  }
  echo "</tr>
                    </thead>
                    <tbody>";

  $no = 1;
  $tampil = mysqli_query($conn, "SELECT * FROM rb_quiz_ujian a JOIN rb_kategori_quiz_ujian b ON a.id_kategori_quiz_ujian=b.id_kategori_quiz_ujian where a.kodejdwl='$_GET[jdwl]' ORDER BY a.id_quiz_ujian");
  while ($r = mysqli_fetch_array($tampil)) {
    echo "<tr>
                            <td>$no</td>
                            <td style='color:red'>$r[kategori_quiz_ujian]</td>
                            <td>$r[keterangan]</td>
                            <td>$r[batas_waktu] WIB</td>";
    if ($_SESSION[level] == 'kepala') {
    } else {
      echo "<td><a class='btn btn-primary btn-xs' title='Lihat Soal' href='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$r[id_quiz_ujian]&id=$_GET[id]&kd=$_GET[kd]'><span class='glyphicon glyphicon-search'></span> Lihat Soal</a>
                                          <a class='btn btn-success btn-xs' title='Lihat Jawaban' href='?view=soal&act=semuajawaban&jdwl=$_GET[jdwl]&idsoal=$r[id_quiz_ujian]&id=$_GET[id]&kd=$_GET[kd]'><span class='glyphicon glyphicon-th-list'></span> Jawaban Siswa</a>
                                          <a class='btn btn-danger btn-xs' title='Delete Bahan dan Tugas' href='?view=soal&act=listsoal&jdwl=$_GET[jdwl]&id=$_GET[id]&kd=$_GET[kd]&hapus=$r[id_quiz_ujian]'><span class='glyphicon glyphicon-remove'></span></a></td>";
    }
    echo "</tr>";
    $no++;
  }

  if (isset($_GET[hapus])) {
    mysqli_query($conn, "DELETE FROM rb_quiz_ujian where id_quiz_ujian='$_GET[hapus]'");
    echo "<script>document.location='?view=soal&act=listsoal&jdwl=" . $_GET[jdwl] . "&id=" . $_GET[id] . "&kd=" . $_GET[kd] . "';</script>";
  }

  echo "</tbody>
                  </table>
                </div>
              </div>
              </form>
            </div>";
} elseif ($_GET[act] == 'tambah') {

  if (isset($_POST[tambah])) {
    if (function_exists('date_default_timezone_set')) date_default_timezone_set('Asia/Jakarta');
    $waktu = date("Y-m-d H:i:s");
    $date = date_create($waktu);
    $tjam = date_add($date, date_interval_create_from_date_string("$_POST[c] minutes"));
    $bataswaktu = date_format($tjam, 'Y-m-d H:i:s');
    mysqli_query($conn, "INSERT INTO rb_quiz_ujian VALUES ('','$_POST[a]','$_GET[jdwl]','$_POST[b]','$bataswaktu')");
    echo "<script>document.location='?view=soal&act=listsoal&jdwl=" . $_GET[jdwl] . "&id=" . $_GET[id] . "&kd=" . $_GET[kd] . "';</script>";
  }

  echo "<div class='col-md-12'>
              <div class='box box-info'>
                <div class='box-header with-border'>
                  <h3 class='box-title'>Tambah List Ujian dan Quiz Baru</h3>
                </div>
              <div class='box-body'>
              <form method='POST' class='form-horizontal' action='' enctype='multipart/form-data'>
                <div class='col-md-12'>
                  <table class='table table-condensed table-bordered'>
                  <tbody>
                    <tr><th width='120px' scope='row'>Kategori</th> <td><select class='form-control' name='a'> 
                             <option value='0' selected>- Pilih Kategori -</option>";
  $kategori = mysqli_query($conn, "SELECT * FROM rb_kategori_quiz_ujian");
  while ($a = mysqli_fetch_array($kategori)) {
    echo "<option value='$a[id_kategori_quiz_ujian]'>$a[kategori_quiz_ujian]</option>";
  }
  echo "</select>
                    </td></tr>
                    <tr><th scope='row'>Keterangan</th>        <td><input type='text' class='form-control' name='b'></td></tr>
                    <tr><th scope='row'>Batas Waktu</th>      <td><input style='width:20%' type='text' class='pull-left form-control' name='c'> Menit</td></tr>
                  </tbody>
                  </table>
                </div>
                
              </div>
              <div class='box-footer'>
                    <button type='submit' name='tambah' class='btn btn-info'>Tambahkan</button>
                    <a href='?view=bahantugas'><button class='btn btn-default pull-right'>Cancel</button></a>
                    
                  </div>
              </form>
            </div>";
} elseif ($_GET[act] == 'semuasoal') {


  $so = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_quiz_ujian a 
                        JOIN rb_kategori_quiz_ujian b ON a.id_kategori_quiz_ujian=b.id_kategori_quiz_ujian 
                          JOIN rb_jadwal_pelajaran c ON a.kodejdwl=c.kodejdwl 
                            JOIN kelas_siswa d ON c.idKelas=d.idKelas where a.id_quiz_ujian='$_GET[idsoal]'"));

  if (isset($_POST[essai])) {
    mysqli_query($conn, "INSERT INTO rb_pertanyaan_essai VALUES('','$_GET[idsoal]','$_POST[a]')");
    echo "<script>document.location='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]';</script>";
  }

  if (isset($_POST[objektif])) {
    mysqli_query($conn, "INSERT INTO rb_pertanyaan_objektif VALUES('','$_GET[idsoal]','$_POST[a]','$_POST[b]','$_POST[c]','$_POST[d]','$_POST[e]','$_POST[f]','$_POST[g]')");
    echo "<script>document.location='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]';</script>";
  }

  if (isset($_GET[deleteessai])) {
    mysqli_query($conn, "DELETE FROM rb_pertanyaan_essai where id_pertanyaan_essai='$_GET[deleteessai]'");
    echo "<script>document.location='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]';</script>";
  }

  if (isset($_GET[deleteobjektif])) {
    mysqli_query($conn, "DELETE FROM rb_pertanyaan_objektif where id_pertanyaan_objektif='$_GET[deleteobjektif]'");
    echo "<script>document.location='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]';</script>";
  }

  echo "<div class='col-xs-12'>  
              <div class='box'>
                <div class='box-header'>
                  <h3 class='box-title'>Soal Essai '<span class='text-info'>$so[kategori_quiz_ujian]</span>' 
                    <br><small>$so[nmKelas] - $so[keterangan]</small></h3>
                  <a href='#' class='btn btn-primary btn-sm pull-right' data-toggle='modal' data-target='#essai'>Tambah Soal Essai</a>
                </div>
                <div class='box-body'>
                  <table class='table table-condensed table-bordered table-striped'>
                        <tr bgcolor=#cecece>
                          <th style='width:40px'>No</th>
                          <th>Pertanyaan Essai</th>
                          <th colspan=2></th>
                        </tr>";
  $essai = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_essai` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_essai DESC");
  $no = 1;
  while ($k = mysqli_fetch_array($essai)) {
    echo "<tr>
                            <td>$no</td>
                            <td>$k[pertanyaan_essai]</td>
                            <td style='width:60px'><a  class='btn btn-danger btn-xs' href='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]&deleteessai=$k[id_pertanyaan_essai]'><span class='glyphicon glyphicon-remove'></span></a></td>
                            </tr>";
    $no++;
  }
  echo "</table>
                </div>
              </div>

              <div class='box'>
                <div class='box-header'>
                  <h3 class='box-title'>Soal Objektif '<span class='text-info'>$so[kategori_quiz_ujian]</span>' 
                  <br><small>$so[nmKelas] - $so[keterangan]</small></h3>
                  <a href='' class='btn btn-primary btn-sm pull-right' data-toggle='modal' data-target='#objektif'>Tambah Soal Objektif </a>
                </div>
                <div class='box-body'>
                  <table class='table table-condensed table-bordered'>
                    <tr>
                      <th style='width:40px'>No</th>
                      <th>Pertanyaan Objektif</th>
                      <th colspan=2></th>
                    </tr>";
  $objektif = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_objektif` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_objektif DESC");
  $noo = 1;
  while ($ko = mysqli_fetch_array($objektif)) {
    echo "<tr>
                            <td>$noo</td>
                            <td>$ko[pertanyaan_objektif] <br>";
    if (trim($ko[jawab_a]) != '') {
      echo "<input type='radio' name='$noo'> a. $ko[jawab_a] <br>";
    }
    if (trim($ko[jawab_b]) != '') {
      echo "<input type='radio' name='$noo'> b. $ko[jawab_b] <br>";
    }
    if (trim($ko[jawab_c]) != '') {
      echo "<input type='radio' name='$noo'> c. $ko[jawab_c] <br>";
    }
    if (trim($ko[jawab_d]) != '') {
      echo "<input type='radio' name='$noo'> d. $ko[jawab_d] <br>";
    }
    if (trim($ko[jawab_e]) != '') {
      echo "<input type='radio' name='$noo'> e. $ko[jawab_e]";
    }
    echo "<div class='btn btn-default btn-xs btn-block'>Kunci Jawaban : $ko[kunci_jawaban]</div>
                            </td>
                            <td style='width:60px'><a class='btn btn-danger btn-xs' href='?view=soal&act=semuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]&deleteobjektif=$ko[id_pertanyaan_objektif]'><span class='glyphicon glyphicon-remove'></span></a></td>
                            </tr>";
    $noo++;
  }
  echo "</table>
                </div>
              </div>
            </div>";
} elseif ($_GET[act] == 'semuajawaban') {


  $d = mysqli_fetch_array(mysqli_query($conn, "SELECT a.*, b.*, c.*, d.*, e.*, f.nama_guru as nama_guru, f.nip FROM rb_quiz_ujian a 
              JOIN rb_jadwal_pelajaran b ON a.kodejdwl=b.kodejdwl 
                JOIN kelas_siswa c ON b.idKelas=c.idKelas
                  JOIN rb_mata_pelajaran d ON b.kode_pelajaran=d.kode_pelajaran 
                    JOIN rb_kategori_quiz_ujian e ON a.id_kategori_quiz_ujian=e.id_kategori_quiz_ujian 
                      JOIN rb_guru f ON b.nip=f.nip where a.kodejdwl='$_GET[jdwl]'"));
  echo "<div class='col-md-12'>
              <div class='box box-info'>
                <div class='box-header with-border'>
                  <h3 class='box-title'>Data Jawaban Quiz / Ujian Online</b></h3>
                </div>
              <div class='box-body'>

              <div class='col-md-12'>
              <table class='table table-condensed table-hover'>
                  <tbody>
                    <input type='hidden' name='id' value='$s[kodekelas]'>
                    <tr><th width='120px' scope='row'>Kode Kelas</th>  <td>$d[idKelas]</td></tr>
                    <tr><th scope='row'>Nama Kelas</th>                <td>$d[nmKelas]</td></tr>
                    <tr><th scope='row'>Mata Pelajaran</th>            <td>$d[namamatapelajaran] - (Pengajar : $d[nama_guru])</td></tr>
                    <tr><th scope='row'>$d[kategori_quiz_ujian]</th><td>$d[keterangan]</td></tr>
                  </tbody>
              </table>
              </div>

                <div class='col-md-12'>
                  <table class='table table-condensed table-bordered table-striped'>
                      <thead>
                      <tr>
                        <th>No</th>
                        <th>NISN</th>
                        <th>Nama Siswa</th>
                        <th>Jenis Kelamin</th>
                        <th>Status Jawaban</th>
                        <th>Action</th>
                      </tr>
                    </thead>
                    <tbody>";

  $no = 1;
  $tampil = mysqli_query($conn, "SELECT * FROM view_detil_siswa
                                              where idKelas='$_GET[id]' ORDER BY nisnSiswa ASC");
  while ($r = mysqli_fetch_array($tampil)) {
    $to = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as total FROM rb_jawaban_objektif a 
                                      JOIN rb_pertanyaan_objektif b ON a.id_pertanyaan_objektif=b.id_pertanyaan_objektif 
                                        where a.nisn='$r[nisnSiswa]' AND b.id_quiz_ujian='$_GET[idsoal]'"));
    $es = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as total FROM rb_jawaban_essai a JOIN rb_pertanyaan_essai b 
                                              ON a.id_pertanyaan_essai=b.id_pertanyaan_essai where a.nisn='$r[nisnSiswa]' 
                                                AND b.id_quiz_ujian='$_GET[idsoal]'"));

    if ($to[total] <= 0 or $es[total] <= 0) {
      $statusnilai = "<i span style='color:red'>Belum Dijawab</i>";
    } else {
      $statusnilai = "<i span style='color:green'>Sudah Dijawab</i>";
    }
    echo "<tr bgcolor=$warna>
                            <td>$no</td>
                            <td style='color:red'>$r[nisnSiswa]</td>
                            <td>$r[nmSiswa]</td>
                            <td>$r[jkSiswa]</td>
                            <td>$statusnilai</td>
                            <td style='width:130px'><a class='btn btn-primary btn-xs' href='?view=soal&act=semuajawabansiswa&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]&noinduk=$r[nisnSiswa]'><span class='glyphicon glyphicon-search'></span> Lihat Jawaban</a></td>
                          </tr>";
    $no++;
  }

  echo "</tbody>
                  </table>
                </div>
              </div>
            </div>";
} elseif ($_GET[act] == 'semuajawabansiswa') {


  $so = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_quiz_ujian a 
                        JOIN rb_kategori_quiz_ujian b ON a.id_kategori_quiz_ujian=b.id_kategori_quiz_ujian 
                          JOIN rb_jadwal_pelajaran c ON a.kodejdwl=c.kodejdwl 
                            JOIN kelas_siswa d ON c.idKelas=d.idKelas where a.id_quiz_ujian='$_GET[idsoal]'"));
  $si = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM siswa where nisnSiswa='$_GET[noinduk]'"));

  if (isset($_POST[nilaiessai])) {
    $ce = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as cek FROM rb_nilai_pertanyaan_essai where id_quiz_ujian='$_GET[idsoal]' AND nisn='$_GET[noinduk]'"));
    if ($ce[cek] >= 1) {
      mysqli_query($conn, "UPDATE rb_nilai_pertanyaan_essai SET nilai_essai='$_POST[a]' where id_quiz_ujian='$_GET[idsoal]' AND nisn='$_GET[noinduk]'");
      echo "<script>document.location='?view=soal&act=semuajawabansiswa&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]&noinduk=$_GET[noinduk]';</script>";
    } else {
      mysqli_query($conn, "INSERT INTO rb_nilai_pertanyaan_essai VALUES('','$_GET[idsoal]','$_GET[noinduk]','$_POST[a]')");
      echo "<script>document.location='?view=soal&act=semuajawabansiswa&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]&noinduk=$_GET[noinduk]';</script>";
    }
  }
  // Rumus Menghitung Total Nilai
  $objek = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_objektif` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_objektif DESC");
  $total = mysqli_num_rows($objek);
  $nilai = 100 / $total;
  $to = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as total FROM `rb_jawaban_objektif` a 
                        JOIN rb_pertanyaan_objektif b ON a.id_pertanyaan_objektif=b.id_pertanyaan_objektif 
                          where a.jawaban=b.kunci_jawaban AND a.nisn='$_GET[noinduk]' 
                            AND b.id_quiz_ujian='$_GET[idsoal]'"));
  $hasil = $nilai * $to[total];

  $nli = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_nilai_pertanyaan_essai where nisn='$_GET[noinduk]' AND id_quiz_ujian='$_GET[idsoal]'"));
  if (trim($nli[nilai_essai] == '')) {
    $nilaiessai = '0';
  } else {
    $nilaiessai = $nli[nilai_essai];
  }
  $akhir = ($nilaiessai + $hasil) / 2;

  echo "<div class='col-xs-12'>  
              <div class='box'>
                  <div class='box-header'>
                    <table class='table table-condensed'>
                        <tbody>
                          <tr><th width='120px' scope='row'>No Induk</th>  <td> : $si[nisnSiswa]</td></tr>
                          <tr><th scope='row'>Nama Siswa</th>              <td> : $si[nmSiswa]</td></tr>
                          <tr><th scope='row'>Nilai Akhir</th>              <td> : (Nilai Essai + Nilai Objektif) : 2 = $akhir</td></tr>
                        </tbody>
                    </table>
                  </div>

                <div class='box-header'>
                  <h3 class='box-title'>Soal Essai '<span class='text-info'>$so[kategori_quiz_ujian]</span>' 
                    <br><small>$so[nmKelas] - $so[keterangan]</small>
                  </h3>";
  if ($nilaiessai == '0') {
    echo "<a style='width:150px' class='btn btn-danger pull-right' href='' data-toggle='modal' data-target='#nilaiessai'>Input Nilai Essai</a>";
  } else {
    echo "<a style='width:150px' class='btn btn-success pull-right' href='' data-toggle='modal' data-target='#nilaiessai'>Nilai Essai : $nilaiessai</a>";
  }
  echo "</div>
                <div class='box-body'>

                  <table class='table table-condensed table-bordered'>
                        <tr>
                          <th style='width:40px'>No</th>
                          <th>Pertanyaan Essai</th>
                        </tr>";
  $essai = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_essai` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_essai DESC");
  $no = 1;
  while ($k = mysqli_fetch_array($essai)) {
    $je = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_jawaban_essai where id_pertanyaan_essai='$k[id_pertanyaan_essai]' AND nisn='$_GET[noinduk]'"));
    echo "<tr>
                            <td>$no</td>
                            <td>$k[pertanyaan_essai] <br>
                                <div style='height:100px; overflow:hidden'>
                                  <pre style='height:100px'><b>Jabawan</b> : <br>$je[jawaban_essai]</pre>
                                </div>
                            </td>
                            </tr>";
    $no++;
  }
  echo "</table>
                </div>
              </div>";

  echo "<div class='box'>
                <div class='box-header'>
                  <h3 class='box-title'>Soal Objektif '<span class='text-info'>$so[kategori_quiz_ujian]</span>' 
                  <br><small>$so[nmKelas] - $so[keterangan]</small>
                  </h3>
                  <a style='width:150px' class='btn btn-success pull-right' href=''>Nilai Objektif : $hasil</a>
                </div>
                <div class='box-body'>

                  <table class='table table-condensed table-bordered'>
                    <tr>
                      <th style='width:40px'>No</th>
                      <th>Pertanyaan Objektif</th>
                    </tr>";
  $objektif = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_objektif` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_objektif DESC");
  $noo = 1;
  while ($ko = mysqli_fetch_array($objektif)) {
    $jo = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_jawaban_objektif where id_pertanyaan_objektif='$ko[id_pertanyaan_objektif]' AND nisn='$_GET[noinduk]'"));
    if ($ko[kunci_jawaban] == $jo[jawaban]) {
      $jawab = "<span class='glyphicon glyphicon-ok pull-right'></span>";
      $color = 'success';
      $jawaban = 'checked';
      $status = 'Benar';
    } else {
      $jawab = "<span class='glyphicon glyphicon-remove pull-right'></span>";
      $color = 'danger';
      $status = 'Salah';
    }
    echo "<tr>
                            <td>$noo</td>
                            <td>$ko[pertanyaan_objektif] <br>";
    if (trim($ko[jawab_a]) != '') {
      echo "<input type='radio' name='$noo'> a. $ko[jawab_a] <br>";
    }
    if (trim($ko[jawab_b]) != '') {
      echo "<input type='radio' name='$noo'> b. $ko[jawab_b] <br>";
    }
    if (trim($ko[jawab_c]) != '') {
      echo "<input type='radio' name='$noo'> c. $ko[jawab_c] <br>";
    }
    if (trim($ko[jawab_d]) != '') {
      echo "<input type='radio' name='$noo'> d. $ko[jawab_d] <br>";
    }
    if (trim($ko[jawab_e]) != '') {
      echo "<input type='radio' name='$noo'> e. $ko[jawab_e]";
    }
    if ($jo[jawaban] != '') {
      echo "<div class='btn btn-$color btn-xs btn-block'>Jawaban Anda '$jo[jawaban]' $status $jawab</div>";
    }
    echo "</td>
                          </tr>";
    $noo++;
  }

  echo "</table>
                </div>
              </div>
            </div>";
} elseif ($_GET[act] == 'detailguru') {

?>
  <div class="col-xs-12">
    <div class="box">
      <div class="box-header">
        <h3 class="box-title"><?php if (isset($_GET[tahun])) {
                                echo "Quiz dan Ujian Online";
                              } else {
                                echo "Quiz dan Ujian Online Pada " . date('Y');
                              } ?></h3>
        <form style='margin-right:5px; margin-top:0px' class='pull-right' action='' method='GET'>
          <input type="hidden" name='view' value='soal'>
          <input type="hidden" name='act' value='detailguru'>
          <select name='tahun' style='padding:4px'>
            <?php
            echo "<option value=''>- Pilih Tahun Akademik -</option>";
            $tahun = mysqli_query($conn, "SELECT * FROM rb_tahun_akademik");
            while ($k = mysqli_fetch_array($tahun)) {
              if ($_GET[tahun] == $k[idTahunAjaran]) {
                echo "<option value='$k[idTahunAjaran]' selected>$k[nama_tahun]</option>";
              } else {
                echo "<option value='$k[idTahunAjaran]'>$k[nama_tahun]</option>";
              }
            }
            ?>
          </select>
          <input type="submit" style='margin-top:-4px' class='btn btn-success btn-sm' value='Lihat'>
        </form>

      </div><!-- /.box-header -->
      <div class="box-body">
        <table id="example1" class="table table-bordered table-striped">
          <thead>
            <tr>
              <th style='width:20px'>No</th>
              <th>Jadwal Pelajaran</th>
              <th>Kelas</th>
              <th>Guru</th>
              <th>Hari</th>
              <th>Mulai</th>
              <th>Selesai</th>
              <th>Ruangan</th>
              <th>Semester</th>
              <th>Total</th>
              <th>Action</th>
            </tr>
          </thead>
          <tbody>
            <?php
            if (isset($_GET[tahun])) {
              $tampil = mysqli_query($conn, "SELECT a.*, e.nmKelas, b.namamatapelajaran, b.kode_pelajaran, c.nama_guru FROM rb_jadwal_pelajaran a 
                                            JOIN rb_mata_pelajaran b ON a.kode_pelajaran=b.kode_pelajaran
                                              JOIN rb_guru c ON a.nip=c.nip 
                                                
                                                  JOIN kelas_siswa e ON a.idKelas=e.idKelas 
                                                  where a.nip='$_SESSION[id]' 
                                                    AND a.idTahunAjaran='$_GET[tahun]' 
                                                       ORDER BY a.hari DESC");
            } else {
              $tampil = mysqli_query($conn, "SELECT a.*, e.nmKelas, b.namamatapelajaran, b.kode_pelajaran,c.nama_guru FROM rb_jadwal_pelajaran a 
                                            JOIN rb_mata_pelajaran b ON a.kode_pelajaran=b.kode_pelajaran
                                              JOIN rb_guru c ON a.nip=c.nip 
                                  
                                                JOIN kelas_siswa e ON a.idKelas=e.idKelas 
                                                  where a.nip='$_SESSION[id]' 
                                                    
                                                      AND a.idTahunAjaran LIKE '" . date('Y') . "%' ORDER BY a.hari DESC");
            }
            $no = 1;
            while ($r = mysqli_fetch_array($tampil)) {
              $total = mysqli_num_rows(mysqli_query($conn, "SELECT * FROM rb_quiz_ujian where kodejdwl='$r[kodejdwl]'"));
              echo "<tr><td>$no</td>
                              <td>$r[namamatapelajaran]</td>
                              <td>$r[nmKelas]</td>
                              <td>$r[nama_guru]</td>
                              <td>$r[hari]</td>
                              <td>$r[jam_mulai]</td>
                              <td>$r[jam_selesai]</td>
                              <td>$r[nama_ruangan]</td>
                              <td>$r[idTahunAjaran]</td>
                              <td style='color:red'>$total Record</td>
                              <td><a class='btn btn-success btn-xs' title='List Soal Quiz' href='?view=soal&act=listsoal&jdwl=$r[kodejdwl]&id=$r[idKelas]&kd=$r[kode_pelajaran]'><span class='glyphicon glyphicon-th'></span> Tampilkan</a></td>
                          </tr>";
              $no++;
            }
            ?>
          </tbody>
        </table>
      </div><!-- /.box-body -->
    </div>
  </div>

<?php
} elseif ($_GET[act] == 'detailsiswa') {
  
?>
  <div class="col-xs-12">
    <div class="box">
      <div class="box-header">
        <h3 class="box-title"><?php if (isset($_GET[kelas]) and isset($_GET[tahun])) {
                                echo "Quiz dan Ujian Online";
                              } else {
                                echo "Quiz dan Ujian Online " . date('Y');
                              } ?></h3>
       

      </div><!-- /.box-header -->
      <div class="box-body">
        <table id="example1" class="table table-bordered table-striped">
          <thead>
            <tr>
              <th style='width:20px'>No</th>
              <th>Kode</th>
              <th>Jadwal Pelajaran</th>
              <th>Kelas</th>
              <th>Guru</th>
              <th>Hari</th>

              <th>Total</th>
            </tr>
          </thead>
          <tbody>
            <?php
            if (isset($_GET[tahun])) {
              $tampil = mysqli_query($conn, "SELECT a.*, e.nmKelas, b.namamatapelajaran, b.kode_pelajaran, c.nama_guru FROM rb_jadwal_pelajaran a 
                                            JOIN rb_mata_pelajaran b ON a.kode_pelajaran=b.kode_pelajaran
                                              JOIN rb_guru c ON a.nip=c.nip 
                                                
                                                  JOIN kelas_siswa e ON a.idKelas=e.idKelas 
                                                  where a.idKelas='$_SESSION[kls]' 
                                                    AND a.idTahunAjaran='$_GET[tahun]'
                                                       
                                                        ORDER BY a.hari DESC");
            } else {
              $tampil = mysqli_query($conn, "SELECT a.*, e.nmKelas, b.namamatapelajaran, b.kode_pelajaran, c.nama_guru FROM rb_jadwal_pelajaran a 
                                            JOIN rb_mata_pelajaran b ON a.kode_pelajaran=b.kode_pelajaran
                                              JOIN rb_guru c ON a.nip=c.nip 
                                                
                                                JOIN kelas_siswa e ON a.idKelas=e.idKelas 
                                                  where a.idKelas='$_SESSION[kls]' 
                                                    
                                                     AND a.idTahunAjaran LIKE '" . date('Y') . "%' ORDER BY a.hari DESC");
            }
            $no = 1;
            while ($r = mysqli_fetch_array($tampil)) {
              $total = mysqli_num_rows(mysqli_query($conn, "SELECT * FROM rb_quiz_ujian where kodejdwl='$r[kodejdwl]'"));
              echo "<tr><td>$no</td>
                              <td>$r[kode_pelajaran]</td>
                              <td>$r[namamatapelajaran]</td>
                              <td>$r[nmKelas]</td>
                              <td>$r[nama_guru]</td>
                              <td>$r[hari]</td>
                           
                          
                              <td style='color:red'>$total Record</td>
                              <td><a class='btn btn-success btn-xs' title='List QUiz dan Ujian' href='?view=soal&act=listsoalsiswa&jdwl=$r[kodejdwl]&id=$r[idKelas]&kd=$r[kode_pelajaran]'><span class='glyphicon glyphicon-th'></span> Tampilkan</a></td>
                          </tr>";
              $no++;
            }
            ?>
          </tbody>
        </table>
      </div><!-- /.box-body -->
    </div>
  </div>

<?php
} elseif ($_GET[act] == 'listsoalsiswa') {
  
  $d = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM kelas_siswa where idKelas='$_GET[id]'"));
  $m = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_mata_pelajaran where kode_pelajaran='$_GET[kd]'"));
  echo "<div class='col-md-12'>
              <div class='box box-info'>
                <div class='box-header with-border'>
                  <h3 class='box-title'>Daftar Ujian dan Quiz Online</b></h3>
                </div>
              <div class='box-body'>

              <div class='col-md-12'>
              <table class='table table-condensed table-hover'>
                  <tbody>
                    <input type='hidden' name='id' value='$s[kodekelas]'>
                    <tr><th width='120px' scope='row'>Kode Kelas</th> <td>$d[idKelas]</td></tr>
                    <tr><th scope='row'>Nama Kelas</th>               <td>$d[nmKelas]</td></tr>
                    <tr><th scope='row'>Mata Pelajaran</th>           <td>$m[namamatapelajaran]</td></tr>
                  </tbody>
              </table>
              </div>

                <div class='col-md-12'>
                  <table id='example1' class='table table-condensed table-bordered table-striped'>
                      <thead>
                      <tr>
                        <th style='width:40px'>No</th>
                        <th>Kategori</th>
                        <th>Keterangan</th>
                        <th>Batas Waktu</th>
                        <th style='width:80px'>Action</th>
                      </tr>
                    </thead>
                    <tbody>";

  $no = 1;
  $tampil = mysqli_query($conn, "SELECT * FROM rb_quiz_ujian a JOIN rb_kategori_quiz_ujian b ON a.id_kategori_quiz_ujian=b.id_kategori_quiz_ujian where a.kodejdwl='$_GET[jdwl]' ORDER BY a.id_quiz_ujian");
  while ($r = mysqli_fetch_array($tampil)) {
    echo "<tr>
                            <td>$no</td>
                            <td style='color:red'>$r[kategori_quiz_ujian]</td>
                            <td>$r[keterangan]</td>
                            <td>$r[batas_waktu] WIB</td>";
    $sekarangwaktu = date("YmdHis");
    $bataswaktu1 = str_replace('-', '', $r[batas_waktu]);
    $bataswaktu2 = str_replace(':', '', $bataswaktu1);
    $bataswaktu3 = str_replace(' ', '', $bataswaktu2);
    if ($sekarangwaktu > $bataswaktu3) {
      echo "<td><a style='width:100px' class='btn btn-danger btn-xs' title='Lihat Soal $sekarangwaktu - $bataswaktu3' href=''><span class='glyphicon glyphicon-search'></span> Waktu Habis</a></td>";
    } else {
      echo "<td><a style='width:100px' class='btn btn-primary btn-xs' title='Lihat Soal' href='?view=soal&act=jawabsemuasoal&jdwl=$_GET[jdwl]&idsoal=$r[id_quiz_ujian]&id=$_GET[id]&kd=$_GET[kd]'><span class='glyphicon glyphicon-search'></span> Jawab Soal</a></td>";
    }
    echo "</tr>";
    $no++;
  }

  echo "</tbody>
                  </table>
                </div>
              </div>
              </form>
            </div>";
} elseif ($_GET[act] == 'jawabsemuasoal') {
  
  $jml = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as jmlp FROM `rb_pertanyaan_objektif` where id_quiz_ujian='$_GET[idsoal]'"));
  if (isset($_POST['simpanobjektif'])) {
    $n = $jml[jmlp];
    for ($i = 0; $i <= $n; $i++) {
      if (isset($_POST['a' . $i])) {
        $jawab = $_POST['a' . $i];
        $pertanyaan = $_POST['b' . $i];
        $cek = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as tot FROM rb_jawaban_objektif where nisn='$_SESSION[ids] ' AND id_pertanyaan_objektif='$pertanyaan'"));
        if ($cek[tot] >= 1) {
          mysqli_query($conn, "UPDATE rb_jawaban_objektif SET jawaban='$jawab' where id_pertanyaan_objektif='$pertanyaan' AND nisn='$_SESSION[ids] '");
        } else {
          $waktuobjektif = date("Y-m-d H:i:s");
          mysqli_query($conn, "INSERT INTO rb_jawaban_objektif (nisn, id_pertanyaan_objektif, jawaban, waktu_objektif) VALUES('$_SESSION[ids] ','$pertanyaan','$jawab','$waktuobjektif')");
        }
      }
    }
    echo "<script>document.location='?view=soal&act=jawabsemuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]';</script>";
  }

  $so = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_quiz_ujian a 
                        JOIN rb_kategori_quiz_ujian b ON a.id_kategori_quiz_ujian=b.id_kategori_quiz_ujian 
                          JOIN rb_jadwal_pelajaran c ON a.kodejdwl=c.kodejdwl 
                            JOIN kelas_siswa d ON c.idKelas=d.idKelas where a.id_quiz_ujian='$_GET[idsoal]'"));

  echo "<div class='col-xs-12'>  
              <div class='box'>
                <div class='box-header'>
                  <h3 class='box-title'>Jawab Soal Essai '<span class='text-info'>$so[kategori_quiz_ujian]</span>' 
                    <br><small>$so[nmKelas] - $so[keterangan]</small></h3>
                </div>
                <div class='box-body'>
                  <table class='table table-condensed table-bordered table-striped'>
                        <tr bgcolor=#cecece>
                          <th style='width:40px'>No</th>
                          <th>Pertanyaan Essai</th>
                          <th>Point</th>
                        </tr>";
  $essai = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_essai` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_essai DESC");
  $no = 1;
  while ($k = mysqli_fetch_array($essai)) {
    $je = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_jawaban_essai where id_pertanyaan_essai='$k[id_pertanyaan_essai]' AND nisn='$_SESSION[ids] '"));
    echo "<tr>
                            <td>$no</td>
                            <td>$k[pertanyaan_essai] <br>
                                <b>Jabawan</b> : <pre>$je[jawaban_essai]</pre></td>
                            <td style='width:70px'><a  class='btn btn-success btn-xs' href='?view=soal&act=jawabsoalessai&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]&idp=$k[id_pertanyaan_essai]'><span class='glyphicon glyphicon-pencil'></span> Jawab</a></td>
                            </tr>";
    $no++;
  }
  echo "</table>
                </div>
              </div>

              <div class='box'>
                <div class='box-header'>
                  <h3 class='box-title'>Soal Objektif '<span class='text-info'>$so[kategori_quiz_ujian]</span>' 
                  <br><small>$so[nmKelas] - $so[keterangan]</small></h3>
                </div>
                <div class='box-body'>
                <form action='' method='POST'>
                  <table class='table table-condensed table-bordered'>
                    <tr>
                      <th style='width:40px'>No</th>
                      <th>Pertanyaan Objektif</th>
                    </tr>";
  $objektif = mysqli_query($conn, "SELECT * FROM `rb_pertanyaan_objektif` where id_quiz_ujian='$_GET[idsoal]' ORDER BY id_pertanyaan_objektif DESC");
  $noo = 1;
  while ($ko = mysqli_fetch_array($objektif)) {
    $ce = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_jawaban_objektif where id_pertanyaan_objektif='$ko[id_pertanyaan_objektif]' AND nisn='$_SESSION[ids] '"));
    echo "<tr>
                            <td>$noo</td>
                            <td>$ko[pertanyaan_objektif] <br>
                                <input type='hidden' value='$ko[id_pertanyaan_objektif]' name='b" . $noo . "'>";
    if ($ce[jawaban] == 'a') {
      if (trim($ko[jawab_a]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='a' checked> a. $ko[jawab_a] <br>";
      }
    } else {
      if (trim($ko[jawab_a]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='a'> a. $ko[jawab_a] <br>";
      }
    }

    if ($ce[jawaban] == 'b') {
      if (trim($ko[jawab_b]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='b' checked> b. $ko[jawab_b] <br>";
      }
    } else {
      if (trim($ko[jawab_b]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='b'> b. $ko[jawab_b] <br>";
      }
    }

    if ($ce[jawaban] == 'c') {
      if (trim($ko[jawab_c]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='c' checked> c. $ko[jawab_c] <br>";
      }
    } else {
      if (trim($ko[jawab_c]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='c'> c. $ko[jawab_c] <br>";
      }
    }

    if ($ce[jawaban] == 'd') {
      if (trim($ko[jawab_d]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='d' checked> d. $ko[jawab_d] <br>";
      }
    } else {
      if (trim($ko[jawab_d]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='d'> d. $ko[jawab_d] <br>";
      }
    }

    if ($ce[jawaban] == 'e') {
      if (trim($ko[jawab_e]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='e' checked> e. $ko[jawab_e]";
      }
    } else {
      if (trim($ko[jawab_e]) != '') {
        echo "<input type='radio' name='a" . $noo . "' value='e'> e. $ko[jawab_e]";
      }
    }
    echo "</td>
                            </tr>";
    $noo++;
  }
  echo "</table>
              <div class='box-footer'>
                    <button type='submit' name='simpanobjektif' class='btn btn-info btn-sm pull-right'>Simpan Jawaban</button>
              </div>
              </form>
                </div>
              </div>
            </div>";
} elseif ($_GET[act] == 'jawabsoalessai') {
  
  if (isset($_POST[simpan])) {
    $cek = mysqli_fetch_array(mysqli_query($conn, "SELECT count(*) as total FROM rb_jawaban_essai where nisn='$_SESSION[ids] ' AND id_pertanyaan_essai='$_GET[idp]'"));
    if ($cek[total] >= 1) {
      mysqli_query($conn, "UPDATE rb_jawaban_essai SET jawaban_essai = '$_POST[a]' where nisn='$_SESSION[ids] ' AND id_pertanyaan_essai='$_GET[idp]'");
    } else {
      $waktujawab = date("Y-m-d H:i:s");
      mysqli_query($conn, "INSERT INTO rb_jawaban_essai VALUES('','$_SESSION[ids] ','$_GET[idp]','$_POST[a]','$waktujawab')");
    }
    echo "<script>document.location='?view=soal&act=jawabsemuasoal&jdwl=$_GET[jdwl]&idsoal=$_GET[idsoal]&id=$_GET[id]&kd=$_GET[kd]';</script>";
  }

  $n = mysqli_fetch_array(mysqli_query($conn, "SELECT * FROM rb_jawaban_essai where nisn='$_SESSION[ids] ' AND id_pertanyaan_essai='$_GET[idp]'"));
  echo "<form method='POST' class='form-horizontal' action='' enctype='multipart/form-data'>
            <div class='col-md-12'>
              <div class='box box-info'>
                <div class='box-header with-border'>
                  <h3 class='box-title'>Jawab Soal Essai</h3>
                </div>
              <div class='box-body'>
              
                  <table class='table table-condensed table-bordered'>
                  <tbody>
                    <tr><th width=120px scope='row'>Jawaban</th>           <td><textarea rows='4' class='form-control' name='a'>$n[jawaban_essai]</textarea></td></tr>
                  </tbody>
                  </table>
              </div>

              <div class='box-footer'>
                    <button type='submit' name='simpan' class='btn btn-info'>Submit</button>
                    <a href='?view=guru'><button class='btn btn-default pull-right'>Cancel</button></a>
              </div>
            </div>
          </form>";
}
?>