<?php
include("../library/inc.connection.php");
include_once "library/inc.library.php";
include_once "library/inc.sesadmin.php";
include_once "library/inc.dataadmin.php";
include_once "library/inc.ref.php";
$semester_id = $_SESSION['SES_SEMESTER'];

?> 
<div class="col-xs-12">
<!-- Standar Tabel awal -->
		<div class="box table-responsive">
            <div class="box-header bg-navy">
              <h3 class="box-title"><li class='glyphicon glyphicon-tasks'></li> &nbsp;&nbsp; Data Pembagian Tugas Mengajar Mapel Suplemen</h3>
			  <div class="box-tools pull-right">
			  <a href='?page=Tambah-Pembelajaran-Suplemen' target='_self' alt='Tambah KKM' class="btn btn-warning btn-sm"><li class="glyphicon glyphicon-plus"></li> Tambah Pembelajaran</a>   
            </div>
            </div>
            <!-- /.box-header -->
            <div class="box-body">
<table id="datatabel" class="table table-bordered table-striped table-hover">
<thead>
  <tr class="bg-olive"> 
        <th>No</th>
         <th>Semester</th>
       <th>Mata Pelajaran</th>
        <th>Kelas</th>
        <th>Guru</th>
		 <th>Hapus</th>
       
  </tr>
</thead>

<?php 
    $query=pg_query("SELECT
a.pembelajaran_id,
a.rombongan_belajar_id,
a.mata_pelajaran_id,
a.semester_id,
a.ptk_terdaftar_id,
b.nm_kelas,
c.nm_mapel,
d.ptk_id,
e.nama,
f.nama_semester
FROM
tabel_pembelajaran AS a
INNER JOIN tabel_kelas AS b ON b.rombongan_belajar_id = a.rombongan_belajar_id AND b.semester_id = a.semester_id
INNER JOIN tabel_mapel AS c ON c.mata_pelajaran_id = a.mata_pelajaran_id
INNER JOIN tabel_ptk_terdaftar AS d ON d.ptk_terdaftar_id = a.ptk_terdaftar_id
INNER JOIN tabel_ptk AS e ON e.ptk_id = d.ptk_id
INNER JOIN semester AS f ON f.semester_id = a.semester_id 
WHERE a.semester_id='$semester_id' AND c.kelompok='S' ORDER BY e.nama ASC");
$ni=1;
$counter=1;
while($result=pg_fetch_array($query)){
  $no=$ni++;
    $Kode = $result['pembelajaran_id']; 
	
	
echo "<tr>
          <td align='center'>".$no."</td>
          <td align='left'>".semester_konversi($result['semester_id'],'nama_semester')."</td>
         <td align='left'>".$result['nm_mapel']."</td>
          <td align='left'>".$result['nm_kelas']."</td>
           <td align='left'>".$result['nama']."</td>
       <td align='center'><a href='?page=Pembelajaran-Suplemen-Hapus&amp;Kode=".$Kode."' target='_self' alt='Hapus Data' class='btn btn-danger btn-sm' onclick='return confirm(\"Anda hanya diijinkan menghapus data pembelajaran jika belum pernah melakukan proses penilaian, Yakin menghapus data ini ?\");'>Hapus</a></td>
        
        </tr>";

} 
?>


</table>
</div><div id="loading" align="center"></div>
          </div>
<!-- Standar Tabel akhir -->
</div>