<?php
function tgl_indo($tanggal)
{
  $bulan = array(
    1 =>   'Januari',
    'Februari',
    'Maret',
    'April',
    'Mei',
    'Juni',
    'Juli',
    'Agustus',
    'September',
    'Oktober',
    'November',
    'Desember'
  );
  $pecahkan = explode('/', $tanggal);

  // variabel pecahkan 0 = tanggal
  // variabel pecahkan 1 = bulan
  // variabel pecahkan 2 = tahun

  return $pecahkan[0] . ' ' . $bulan[(int)$pecahkan[1]] . ' ' . $pecahkan[2];
}

include "../config.php";
$nisn = $_POST['nisn']; //get the nama value from form
$q = "SELECT * from tb_student where nisn = '$nisn' "; //query to get the search result
$result = mysqli_query($koneksi, $q); //execute the query $q
$num_rows = mysqli_num_rows($result);

if ($num_rows == 0)
  include "no-result.php";
else
  echo "
    <div class='well' style='margin-bottom: 50px;'>
    <p align='center'><img src='images/logo.png' height='100' /></p>
    <h4 align='center' style='margin: 15px 0 -10px 0;'><b>SISTEM INFORMASI</br>PENGUMUMAN KELULUSAN SMKN 8 BANDUNG</b></h4>
    <hr>
    <div align='center' class='alert alert-dismissable alert-info' role='alert'><h4><b>DETAIL STATUS KELULUSAN</b></h4></div>";

echo "
<table min-width='100' class='table table-striped table-bordered'>";
while ($data = mysqli_fetch_array($result)) {  //fetch the result from query into an array
  echo "
  <tr class='success'>
    <td colspan='4' align='center'><font color='#000000' size='4' style='font-weight: bold;';><b>IDENTITAS PESERTA DIDIK</b></td>
  </tr>

  <tr class='secondary'><td width='250'>Nama Lengkap</td>
   <b> <td width='480'><strong><b>  " . $data['name'] . " </b></strong></td></b>
  </tr>

  <tr><td>Tempat dan Tanggal Lahir</td>
    <td colspan='3'><font style='text-transform: capitalize;'><strong>  " . $data['addresse'] . " / " . $data['tgllhr'] . "</strong></font></td>
  </tr>

  <tr class='secondary'><td>Nama Orang Tua</td>
  <td colspan='3'><font style='text-transform: uppercase;'><strong> " . $data['kelas'] . "</strong></font></td>
  </tr>

  <tr><td>Nomor Induk Siswa (NIS)</td>
  <td colspan='3'><font style='text-transform: capitalize;'><strong>  " . $data['ket'] . "</strong></font></td>
</tr>
  
  <tr><td>Nomor Induk Siswa Nasional (NISN)</td>
    <td colspan='3'><strong>  " . $data['nisn'] . "</strong></td>
  </tr>
  
  <tr><td>Program Keahlian</td>
    <td colspan='3'><font style='text-transform: capitalize;'><strong> " . $data['sekolah'] . "</strong></font></td>
  </tr>
  
  <tr><td>Kompetensi Keahlian</td>
    <td colspan='3'><font style='text-transform: capitalize;'><strong> " . $data['1'] . "</strong></font></td>
  </tr>

  <tr class='primary'>
    <td colspan='4' >
    <b> </b>
    </td>
  </tr>

  <tr class='success'>
    <td colspan='4' align='center'><font color='#000000' size='4' style='font-weight: bold;';>STATUS KELULUSAN DINYATAKAN</td>
  </tr>
  <tr class='warning'>
    <td colspan='4' align='center'><font color='#0066FF' size='6' style='text-transform: uppercase;'><b>LULUS</b></td>
  </tr>
  <tr class='success'>
    <td colspan='4' align='center'><b>Silahkan klik tombol di bawah ini untuk mengunduh berkas Surat Keterangan Lulus (SKL)</b></td>
  </tr>

  <tr class='secondary'>
    <td colspan='4'></td>
  </tr>
  <tr class='warning'>
    <td colspan='4' >
    <center><a class='btn btn-primary' href='file/" . $data['2'] . "' role='button'>Download Berkas SKL</a></center>
    </td>
    
 

    
  
    <tr class='primary'>
    <td colspan='4' >
   <b> </b>
    </td>
    </tr>
   
  </table>";


  echo "
    <div class='form-group' style='margin-bottom: -10px;'>
      <p align='center'>
        <a href='model/caridata.php' class='btn btn-success'>
         KEMBALI
        </a>
       
      </p>
    </div>";

    












}
