<?php
defined('APK') or exit('Anda tidak dizinkan mengakses langsung script ini!');
$mapel = $_POST['mapel'];
$kelas = $_POST['kelas'];
$smt = $_POST['semester'];
?>
<div class='row'>
        <div class='col-md-12'>
            <div class='panel panel-default'>
               <div class="panel-heading" style="height:45px">
                  
                    <div class='box-tools pull-right'>
                        <?php if ($user['level'] == 'admin') : ?>
                            
                            <a href='?pg=impornilai' class='btn btn-sm btn-danger'><i class='fa fa-sync'></i> <span class='hidden-xs'> Kembali</span></a>
                           
                        <?php endif ?>
                    </div>
					 <h4 class='box-title'><i class="fas fa-upload fa-fw"></i> <?= $mapel ?> - <?= $kelas ?> - SEMESTER <?= $smt ?></h4>
                </div>
				
			  <div class="box-body">
                    <ul class="nav nav-tabs">
                        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true" >Data Nilai</a></li>
                        
                    </ul>
					
					<div class="tab-content">
                        <div class="tab-pane active" id="tab_1" >
						<br>
						<div class="panel panel-default">	
                <div class='box-body'>
                <div class="table-responsive">
                    <table style="font-size: 12px" class="table table-bordered table-hover" id="example1">
                        <thead>
                            <tr>
                                <th class="text-center" width="3%" rowspan="2">
                                    #
                                </th>
                              <th width="10%" rowspan="2">Kelas</th>
                                <th rowspan="2">N I S</th>
								 <th rowspan="2">N I S N</th>
                                 <th rowspan="2">Nama Siswa</th>
                              <th style="text-align:center" colspan="2"><?= $mapel ?></th>
                             </tr>
							 <tr>
							 <th width="10%"> KI-3</th>
							 <th width="10%">KI-4</th>
                            </tr>
                        </thead>
                        <tbody>
                            <?php
                            $query = mysqli_query($koneksi, "select * from nilai_transkip WHERE kelas='$kelas' AND mapel='$mapel' AND semester='$smt' ");
                            $no = 0;
                            while ($s = mysqli_fetch_array($query)) {
								$siswa = fetch($koneksi,'siswa',['nis'=>$s['nis']]);
								$ki3 = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM nilai_transkip  WHERE kelas='$kelas' AND mapel='$mapel' AND semester='$smt' AND ki='KI3'"));
                                $ki4 = mysqli_fetch_array(mysqli_query($koneksi, "SELECT * FROM nilai_transkip  WHERE kelas='$kelas' AND mapel='$mapel' AND semester='$smt' AND ki='KI4'"));
                                
								$no++;
                            ?>
                                <tr>
                                    <td><?= $no; ?></td>
                                   <td><?= $siswa['id_kelas'] ?></td>
								   <td><?= $siswa['nis'] ?></td>
								   <td><?= $siswa['nisn'] ?></td>
                                    <td><?= $siswa['nama'] ?></td>             
                                     <td><?= $ki3['nilai'] ?></td>
                                   <td><?= $ki4['nilai'] ?></td>
                                </tr>

                            <?php }
                            ?>

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
