<?php
	include "php_class/class_mysql.php";
	include "php_class/class_template.php";
	include "php_class/class_mahasiswa.php";
	include "php_class/class_grup.php";
	include "php_class/class_semesterpendek.php";
	include "php_class/class_dosen.php";
	$DataDosen = new dataDosen;
	$datasp = new DataSemesterPendek;
	$datasp2 = new DataSemesterPendek;
	$datagrup = new DataGrup;
	$DataMahasiswa = new DataMahasiswa;
	$DataTemplate = new DataTemplate;

?>
<link href="<?php echo $base?>plugins/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $base?>plugins/iCheck/all.css" rel="stylesheet" type="text/css" />
<link href="<?php echo $base?>plugins/timepicker/bootstrap-timepicker.min.css" rel="stylesheet"/>
<script src="<?php echo $base?>plugins/input-mask/jquery.inputmask.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/input-mask/jquery.inputmask.date.extensions.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/input-mask/jquery.inputmask.extensions.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/timepicker/bootstrap-timepicker.min.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/iCheck/icheck.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $base?>plugins/autocomplete/shieldui-all.css" />
<link href="<?php echo $base?>bootstrap/css/bootstrap-datetimepicker.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="<?php echo $base?>bootstrap/js/bootstrap-datetimepicker.js" charset="UTF-8"></script>
<script type="text/javascript" src="<?php echo $base?>bootstrap/js/locales/bootstrap-datetimepicker.id.js" charset="UTF-8"></script>
<link href="<?php echo $base?>plugins/datatables/dataTables.bootstrap.css" rel="stylesheet" type="text/css" />
<script src="<?php echo $base?>plugins/datatables/jquery.dataTables.min.js" type="text/javascript"></script>
<script src="<?php echo $base?>plugins/datatables/dataTables.bootstrap.min.js" type="text/javascript"></script>

<script>
	$(document).ready(function(){
	var base = <?php echo json_encode($base);?>;
		$("#setting").click(function(){
			$("#myModal").modal('show');
		});
		$("#example1").dataTable();
	});
</script>
<section class="content-header">
  <h1>
   Pembagian Kelas
  </h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo $base?>"><i class="fa fa-dashboard"></i> Home</a></li>
  </ol>
</section>
<section class="content">
 	<div class="row">
    	<div class="row">
        	<div class="col-md-12">
            </div>
        </div>
    	<div class="col-md-12">
        <?php 
			$idmatkul = $xcode;
			$bagi = $xcode2;
			$tahun = $_SESSION['smtahun'];
			$semester = $_SESSION['smsemester'];
			$program = $_SESSION['smprogram'];
			$matkul = $datasp2->get_matakuliah_id('matakuliah', $idmatkul);
			$kode = $datasp2->get_matakuliah_id('kode', $idmatkul);
		?>
             
        	 <div class="box box-info">
                <div class="box-body">
                       <div class="table-responsive" style="margin-top:30px;">

                          <table id="example2" class="table table-bordered table-striped table-hover">
                             <thead>
                                <tr>
                                    <th>No</th>
                                    <th>Mata Kuliah</th>
                                    <th>Kelas</th>
                                    <th>Dosen</th>
                                    <th colspan="2">Aksi</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php
								$JumlahData = $datasp->get_temp_bagi_kelas('',$a,'jumlah', $program, $tahun, $semester, $idmatkul);
                                if ($JumlahData<=0){
                                    echo "<tr class='odd gradeX'>";
                                    echo "<td>No Data</td>";
                                    echo "<td></td>";
									echo "<td></td>";
                                    echo "</tr>";	
                                }else{
                                    
									for ($a=1;$a<=$JumlahData;$a++){
										$nama = $datasp->get_temp_bagi_kelas('Nama',$a,'', $program, $tahun, $semester, $idmatkul);
                                        $NPM = $datasp->get_temp_bagi_kelas('NPM',$a,'', $program, $tahun, $semester, $idmatkul);
										$kelas = $datasp->get_temp_bagi_kelas('kelas',$a,'', $program, $tahun, $semester, $idmatkul);
										$dosen = $datasp->get_temp_bagi_kelas('dosen',$a,'', $program, $tahun, $semester, $idmatkul);

                                        echo "<tr  class='odd gradeX'>";
										echo "<td>".$a."</td>";
										echo "<td>".$matkul."</td>";
										echo "<td>".$kelas."</td>";
										if($dosen == ''){
										echo "<td>-</td>";	
										}else{
										echo "<td>".$dosen."</td>";
										}
										echo "<td><a href='".$base."sempek-pilih-dosen/$kelas'>Ubah Dosen</a></td>";
										echo "<td><a href='".$base."cetak-absen-dosen/$kelas/$idmatkul'><i class='glyphicon glyphicon-print'></i> Cetak</a></td>";
                                        echo "</tr>";
                                    }
                                }
                            ?>
                            </tbody>
                          </table>
                          
          			</div>
            <a href="<?php echo $base?>bagi-kelas/<?php echo $idmatkul?>/1"><button type="submit" class="btn btn-primary" style="margin-top:20px; float:right"> <i class="glyphicon glyphicon glyphicon glyphicon-edit" style="padding-right:4px;"></i>Ubah Jumlah Kelas</button></a>
            <a href="<?php echo $base?>data-matkul-sempek"><button type="submit" class="btn btn-success" style="margin-top:20px; float:right; margin-right:10px;"> <i class="glyphicon glyphicon glyphicon glyphicon-list" style="padding-right:4px;"></i>Data Semester Pendek</button></a>
				</div>
             </div>   
        	 <div class="box box-info">
                <div class="box-body">
				<?php
						
					echo "<H5 style='margin-bottom:15px;'>Mata Kuliah: ".$matkul."</h5>";
					echo "<H5 style='margin-bottom:15px;'>Sandi Mata Kuliah: ".$kode."</h5>";
				?>
                       <div class="table-responsive" style="margin-top:30px;">

                          <table id="example1" class="table table-bordered table-striped table-hover">
                             <thead>
                                <tr>
                                    <th>No</th>
                                    <th>NPM</th>
                                    <th>Nama Mahasiswa</th>
                                    <th>Kelas</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php
								$JumlahData = $datasp2->get_temp_bagi('',$a,'jumlah', $program, $tahun, $semester, $idmatkul);
                                if ($JumlahData<=0){
                                    echo "<tr class='odd gradeX'>";
                                    echo "<td>No Data</td>";
                                    echo "<td></td>";
									echo "<td></td>";
                                    echo "</tr>";	
                                }else{
                                    
									for ($a=1;$a<=$JumlahData;$a++){
										$nama = $datasp2->get_temp_bagi('Nama',$a,'', $program, $tahun, $semester, $idmatkul);
                                        $NPM = $datasp2->get_temp_bagi('NPM',$a,'', $program, $tahun, $semester, $idmatkul);
										$kelas = $datasp2->get_temp_bagi('kelas',$a,'', $program, $tahun, $semester, $idmatkul);

                                        echo "<tr  class='odd gradeX'>";
										echo "<td>".$a."</td>";
										echo "<td>".$NPM."</td>";
										echo "<td>".$nama."</td>";
										echo "<td>".$kelas."</td>";
                                        echo "</tr>";
                                    }
                                }
                            ?>
                            </tbody>
                          </table>
                          
          			</div>
                    	<form action="<?php echo $base?>tabel-absen-sempek.php" method="post" target="_blank">
                        	<input type="hidden" name="idmatkul" value="<?php echo $idmatkul?>">
                            <input type="hidden" name="program" value="<?php echo $program?>">
                            <input type="hidden" name="tahun" value="<?php echo $tahun?>">
                            <input type="hidden" name="semester" value="<?php echo $semester?>">
                            <input type="hidden" name="matkul" value="<?php echo $matkul?>">
                            <input type="hidden" name="kode" value="<?php echo $kode?>">
                           	<button type="submit" class="btn btn-primary" style="margin-top:20px; float:right"> <i class="glyphicon glyphicon glyphicon glyphicon-edit" style="padding-right:4px;"></i>Export Excel</button>
                        </form>        

				</div>

             </div> 
         </div>
    </div>
</section>

    	
