<?php 
	include "php_class/class_mysql.php";
	include "php_class/class_dosen.php";
	include "php_class/class_ujian.php";
	include "php_class/class_jadwal.php";
	$dataujian = new dataUjian;
	$DataDosen = new dataDosen;
	$datajadwal = new dataJadwal;
	$datajadwal2 = new dataJadwal;

?>

<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>
<script type="text/javascript" src="<?php echo $base?>plugins/autocomplete/shieldui-all.min.js"></script>
<script>
	$(document).ready(function(){
	var base = <?php echo json_encode($base);?>;
		$("#matkul").click(function(){
			$("#myModal2").modal('show');
		});
		$("#cari").click(function(){
			$("#myModal1").modal('show');
		});
		$("#setting").click(function(){
			$("#myModal").modal('show');
		});

	});
</script>

<style>
	.checkbox2{	width:20px; height:20px; float:left; }
</style>
<section class="content-header">
  <h1>
   Data Jadwal UTS
  </h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo $base?>"><i class="fa fa-dashboard"></i> Home</a></li>
    <li><a href="<?php echo $base?>data-jadwal">Data Jadwal</a></li>
    <li class="active">Tambah Data Jadwal UTS</li>
  </ol>
</section>
<section class="content">
 	<div class="row">
    	<div class="col-md-12">
        	 <div class="box box-info">
                <div class="box-header">
                  <h3 class="box-title">Tambah Data Jadwal UTS</h3>
                </div>
                <div class="box-body">
                    <div class="col-sm-7" >
                        <?php 
                        $tahun = $_POST['tahun'];
                        $semester = $_POST['semester'];
                        
                            if ($tahun == '' ){
                                $tahun = '2016/2017';
                            }
                            if ($semester == '' ){
                                $semester = 'GENAP';
                            }					
                            if ($program == '') {
                                $program = 'Reguler';	
                            }	
                                        
                                echo "<H5 style='margin-bottom:15px;'>Tahun Akademik : ".$tahun."</h5>";
                                echo "<H5 style='margin-bottom:15px;'>Semester Akademik : ".$semester."</h5>";
                                
                        ?>
                    </div>
                    <div class="col-sm-5">
            <button type="submit" class="btn btn-primary" id="setting" style="margin-top:20px; float:right"> <i class="glyphicon glyphicon glyphicon glyphicon-edit" style="padding-right:4px;"></i>Setting</button>
                    </div>
                </div>    
                <div class="box-body">

                	<form method="post" action="<?php echo $base?>query-add-jadwal-uas">
                    	<input type="hidden" name="idmatakuliah" id="idmatkul">
                        <div class="form-group">
                            <label class="control-label">Mata Kuliah</label>
                            <input type="text" name="matakuliah"  class="form-control"  placeholder="mata kuliah" id="matkul">
                        </div>
                        <div class="form-group">
                            <label for="Operator" class="control-label">Nama Dosen *cari nama dosen apabila sudah pernah dimasukkan sebelumnya</label>
                            <div class="input-group">
                                <input type="text" name="dosen" required="required" class="form-control"  placeholder="NIP/NIK" id="nama">
                                <span class="input-group-addon" id="cari">
                                    <i class="glyphicon glyphicon-search" ></i>
                                </span>
							</div>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">SKS</label>
                            <input type="text" name="sks" required="required" class="form-control"  placeholder="sks">
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Semester</label>
                            <input type="text" name="semester" required="required" class="form-control"  placeholder="semester" >
                         </div>

                        <div class="form-group">
                            <label for="Operator" class="control-label">Jurusan</label>
                            <select class="form-control" name="jurusan">
                            	<option value="Akuntansi">Akuntansi</option>
                                <option value="IESP">IESP</option>
                                <option value="Manajemen">Manajemen</option>
                            </select>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Kelas</label>
                            <input type="text" name="kelas" required="required" class="form-control"  placeholder="kelas" >
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Hari</label>
                            <select name="hari" class="form-control">
                            	<option value="SENIN">SENIN</option>
                                <option value="SELESA">SELESA</option>
                                <option value="RABU">RABU</option>
                                <option value="KAMIS">KAMIS</option>
                                <option value="JUMAT">JUMAT</option>
                                <option value="SABTU">SABTU</option>
                            </select>
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Ruang</label>
                            <input type="text" name="ruang" required="required" class="form-control"  placeholder="ruang" >
                         </div>
                         <div class="form-group">
                            <label for="Operator" class="control-label">Waktu</label>
                            <input type="text" name="waktu" required="required" class="form-control"  placeholder="waktu" >
                         </div>
                            <input type="hidden" name="sm" required="required" class="form-control"  value="<?php echo $semester?>" >
                            <input type="hidden" name="tahun" required="required" class="form-control"  value="<?php echo $tahun ?>" >
                         <div class="form-group">
                            <button type="submit" class="btn btn-default"><i class='glyphicon glyphicon-ok'></i> Simpan</button>
                         </div>
                    </form>
                </div>
               </div>
         </div>
    </div>
</section>

<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Setting</h4>
      </div>
      <div class="modal-body">
          <form action="<?php echo $base?>add-jadwal-uas" method="post" name="cmb" style="margin-bottom:35px;" id="cmb">
            <div class="form-group">
                <label class="control-label">Tahun Akademik</label>
                <select class="form-control" name="tahun">
                <?php 
                    if ($tahun != "") {
                        echo "<option value='".$tahun."'>".$tahun."</option>";
                    }
					    $JumlahData = $datajadwal2->get_all_tahun('',$a,'jumlah');	
                            for ($a=1;$a<=$JumlahData;$a++){
                            $tahun = $datajadwal2->get_all_tahun('tahun',$a,'');
                       		echo "<option value=".$tahun.">".$tahun."</option>";
                        }
                ?>
                </select>
			</div>
            <div class="form-group">
                <label class="control-label">Semester</label>
                <select class="form-control" name="semester">
                <?php 
                    if ($semester != "") {
                        echo "<option value='".$semester."'>".$semester."</option>";
                    }
                ?>
                	<option value="GENAP">GENAP</option>
                    <option value="GANJIL">GANJIL</option>
                </select>
			</div>

                <button type="submit" class="btn btn-primary" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon glyphicon-ok-circle"></i> OK</button>
         </form>   
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
    	
<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 type="text/javascript">
  $(document).ready(function(){
	$("#example1").dataTable();
	
  });
</script>

<div id="myModal1" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Daftar Dosen</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example1" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Dosen</th>
                    <th>Semester Akademik</th>
                    <th>Tahun Akademik</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $dataujian->get_data_uts_all('',$a,'jumlah', $semester, $tahun);
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $dataujian->get_data_uts_all('id',$a,'', $semester, $tahun);
						$dosen = $dataujian->get_data_uts_all('dosen', $a, '', $semester, $tahun);
						$sm = $dataujian->get_data_uts_all('sm', $a, '', $semester, $tahun);
						$tahun = $dataujian->get_data_uts_all('tahun', $a, '', $semester, $tahun);
						
						echo "<tr ids='".$id."-".$dosen."' class='odd gradeX context pilih1'>";
						echo "<td>".$id."</td>";
						echo "<td>".$dosen."</td>";
						echo "<td>".$sm."</td>";
						echo "<td>".$tahun."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(document).ready(function(){
		$('.pilih1').click(function(){
			var kode = $(this).attr('ids');
			var pecah = kode.split("-");	
				kodeDosen = pecah[0];
				dosen = pecah[1];
				
			$('#nama').val(dosen);
			$('#myModal1').modal('hide')
		});
	});
</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 type="text/javascript">
  $(document).ready(function(){
	$("#example2").dataTable();
	
  });
</script>

<div id="myModal2" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Data Mata Kuliah</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example2" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Sandi</th>
                    <th>Mata Kuliah</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $datajadwal->get_data_matkul('',$a,'jumlah');
				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 = $datajadwal->get_data_matkul('matakuliah',$a,'');
						$kode = $datajadwal->get_data_matkul('kode',$a,'');
						
						echo "<tr ids='".$kode."-".$Nama."' class='odd gradeX context pilih2'>";
						echo "<td>".$a."</td>";
						echo "<td>".$kode."</td>";
						echo "<td>".$Nama."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(document).ready(function(){
		$('.pilih2').click(function(){
			var kode = $(this).attr('ids');
			var pecah = kode.split("-");	
				id = pecah[0];
				mat = pecah[1];
				
			$('#idmatkul').val(id);
			$('#matkul').val(mat);
			$('#myModal2').modal('hide')
		});
	});
</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 type="text/javascript">
  $(document).ready(function(){
	$("#example3").dataTable();
	
  });
</script>

<div id="myModal3" class="modal fade" role="dialog">
  <div class="modal-dialog modal-lg">
    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">&times;</button>
        <h4 class="modal-title">Data Mata Kuliah</h4>
      </div>
      <div class="modal-body">
      	<div class="table-responsive">
          <table id="example3" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Dosen</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $dataujian->get_data_uts_all('',$a,'jumlah');
				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++){
						$id = $dataujian->get_data_uts_all('id',$a,'', $hari);
						$dosen = $dataujian->get_data_uts_all('dosen', $a, '', $hari);
						
						echo "<tr ids='".$Nama."' class='odd gradeX context pilih3'>";
						echo "<td>".$id."</td>";
						echo "<td>".$Nama."</td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
        </div>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" id="closemodal" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>
<script>
	$(document).ready(function(){
		$('.pilih3').click(function(){
			var dosen = $(this).attr('ids');
				
			$('#dosen').val(id);
			$('#myModal3').modal('hide')
		});
	});
</script>
