<?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;
	$datasp3 = new DataSemesterPendek;
	$datagrup = new DataGrup;
	$DataMahasiswa = new DataMahasiswa;
	$DataTemplate = new DataTemplate;
	$idmatkul = $xcode;
	$status = $xcode2;
	$tahun = $_SESSION['smtahun'];
	$semester = $_SESSION['smsemester'];
	$program = $_SESSION['smprogram'];
	$_SESSION['idmatkul'] = $idmatkul;

	$ada = $datasp3->get_jumlah_matkul('',$a,'jumlah', $program, $tahun, $semester, $idmatkul);
	if($ada > 0 and $status != 1){
		echo "<script>window.location='".$base."bagi-kelas-lanjutan/".$idmatkul."'</script>";
 	} 
 ?>
<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 
			
			$matkul = $datasp2->get_matakuliah_id('matakuliah', $idmatkul);
			$kode = $datasp2->get_matakuliah_id('kode', $idmatkul);
		?>
        
        	 <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>NPM</th>
                                    <th>Nama Mahasiswa</th>
                                </tr>
                            </thead>
                            <tbody>
                            <?php
								$JumlahData = $datasp->get_matkul_sempek_mhs('',$a,'jumlah', $program, $tahun, $semester, $idmatkul);
                                if ($JumlahData<=0){
                                    echo "<tr class='odd gradeX'>";
                                    echo "<td>No Data</td>";
                                    echo "<td></td>";
                                    echo "</tr>";	
                                }else{
                                    
									for ($a=1;$a<=$JumlahData;$a++){
										$nama = $datasp->get_matkul_sempek_mhs('Nama',$a,'', $program, $tahun, $semester, $idmatkul);
                                        $NPM = $datasp->get_matkul_sempek_mhs('NPM',$a,'', $program, $tahun, $semester, $idmatkul);

                                        echo "<tr  class='odd gradeX'>";
										echo "<td>".$NPM."</td>";
										echo "<td>".$nama."</td>";
                                        echo "</tr>";
                                    }
                                }
                            ?>
                            </tbody>
                          </table>
          			</div>
				</div>
             </div> 
        	 <div class="box">
                <div class="box-body">
                    <form method="post" action="<?php echo $base?>query-add-temp-bagi">
                        <input type="hidden" name="idmatkul" value="<?php echo $idmatkul?>">
                         <div class="form-group">
                            <label class="control-label">Jumlah Bagi Kelas</label>
                            <input type="text" class="form-control" placeholder="jumlah" name="jumlah">
                         </div>
                         <div class="form-group">
                        <button type="submit" class="btn btn-primary" id="simpan"> <i class="glyphicon glyphicon-ok"></i> OK</button>
                         </div>
                    </form>
                </div>
             </div>
         </div>
    </div>
</section>

    	
