<?php
	include "php_class/class_mysql.php";
	include "php_class/class_jadwal.php";
	$DataJadwal = new dataJadwal;
	$DataJadwal2 = new dataJadwal;
	$DataJadwal3 = new dataJadwal;

?>
<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(){
	var base = <?php echo json_encode($base);?>;
	
	$("#example1").dataTable();
		$("#setting").click(function(){
			$("#myModal").modal('show');
		});
	
	/*$('.context').bind('contextmenu', function(e){
		e.preventDefault();
    	var kode = $(this).attr('id');
		$('#kodekunci').val(kode);
   		$("#menuklik").modal('show');
	});*/
	
	$('#editdata').click(function(){
		var kode = $('#kodekunci').val();
		window.location=''+base+'edit-jadwal/'+ kode +'';
	});
	
	$('#nonaktif').click(function(){
		var kode = $('#kodekunci').val();
		if (confirm("Anda yakin me-nonaktifkan data dengan kode " + kode+"?")){
			window.location=''+base+'query-delete-jadwal/'+ kode +'';	
		}
	});
	
	$('#newdata').click(function(){
		var kode = $('#kodekunci').val();
		window.location=''+base+'add-detil-jadwal/'+ kode +'';
	});

  });
   
</script>
<section class="content-header">
  <h1>
    Rekap Data Beban Tugas
  </h1>
  <ol class="breadcrumb">
    <li><a href="<?php echo $base?>index"><i class="fa fa-dashboard"></i> Home</a></li>
    <li class="active">Rekap Beban Tugas</li>
  </ol>
</section>
<section class="content">
  <div class="row">
    <div class="col-xs-12">
     
      <div class="box">
        <div class="box-body">
					<div class="row">
                        <div class="col-sm-7" >
							<?php 
							$tahun = $_POST['tahun'];
							$semester = $_POST['semester'];
							$jurusan = $_POST['jurusan'];
							$program = $_POST['program'];
							
								if ($tahun == '' ){
									$tahun = '2016/2017';
								}
								if ($semester == '' ){
									$semester = 'GENAP';
								}					
								if ($jurusan == '' ){
									$jurusan = 'SEMUA';
								}					
								if ($program == '' ){
									$program = 'Reguler';
								}					

									echo "<H3 style='margin-bottom:15px;'>Tahun Akademik : ".$tahun."</h3>";
									echo "<H5 style='margin-bottom:15px;'>Semester Akademik : ".$semester."</h5>";
									echo "<H5 style='margin-bottom:15px;'>Jurusan : ".$jurusan."</h5>";
									echo "<H5 style='margin-bottom:15px;'>Program : ".$program."</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="table-responsive" style="margin-top:30px;">
          <table id="example1" class="table table-bordered table-striped table-hover">
             <thead>
                <tr>
                    <th>No</th>
                    <th>Nama Dosen</th>
                    <th>Semester</th>
                    <th>Tahun</th>
                    <th>Kelas</th>
                    <th>Aksi</th>
                </tr>
            </thead>
            <tbody>
            <?php
            	$JumlahData = $DataJadwal->get_beban_rekap('',$a,'jumlah', $semester, $tahun, $jurusan, $program);
				if ($JumlahData<=0){
					echo "<tr class='odd gradeX'>";
					echo "<td>No Data</td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "<td></td>";
					echo "</tr>";	
				}else{
					for ($a=1;$a<=$JumlahData;$a++){
						$id = $DataJadwal->get_beban_rekap('id',$a,'', $semester, $tahun, $jurusan, $program);
						$nama = $DataJadwal->get_beban_rekap('nama',$a,'', $semester, $tahun, $jurusan, $program);
						$tahun = $DataJadwal->get_beban_rekap('tahun',$a,'', $semester, $tahun, $jurusan, $program);
						$semester = $DataJadwal->get_beban_rekap('semester',$a,'', $semester, $tahun, $jurusan, $program);
						$kelas = $DataJadwal->get_beban_rekap('kelas',$a,'', $semester, $tahun, $jurusan, $program);
						
						echo "<tr class='odd gradeX'>";
						echo "<td>".$a."</td>";
						echo "<td>".$nama."</td>";
						echo "<td>".$tahun."</td>";
						echo "<td>".$semester."</td>";
						echo "<td>".$kelas."</td>";
						echo "<td><a href='cetak-beban-tugas/$id' target='_blank''><i class='glyphicon glyphicon-print'></i> Cetak</a></td>";
						echo "</tr>";
					}
				}
			?>
        	</tbody>
          </table>
          </div>
                    <div class="col-sm-12" >
                          <form action="<?php echo $base?>laporan-pembayaran-dosen-luar-dalam.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-primary" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i> Form B Dosen Luar Dalam (Lebih)</button>
                         </form>   
                          <form action="<?php echo $base?>laporan-form-b-dosen-dalam.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-primary" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i> Form B Dosen Dalam</button>
                         </form>   
                          <form action="<?php echo $base?>laporan-form-b-dosen-luar.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-primary" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i> Form B Dosen Luar</button>
                         </form>   
                          <form action="<?php echo $base?>laporan-form-b-dosen-luar-dalam.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-primary" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i> Form B Dosen Luar Dalam</button>
                         </form>
					</div>
					<div class="col-sm-12" >
						<form action="<?php echo $base?>tabel-formb-dosen-luar.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-success" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i>Export Form B Dosen Luar</button>
                         </form>
						<form action="<?php echo $base?>tabel-formb-dosen-dalam.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-success" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i>Export Form B Dosen Dalam</button>
                         </form>
						 <form action="<?php echo $base?>tabel-formb-dosen-luar-dalam.php" method="post" name="cmb" style="float:right; margin-right:10px;" id="cmb" target="_blank">
                                    <input type="hidden" name="semester" value="<?php echo $semester?>" />
                                    <input type="hidden" name="tahun" value="<?php echo $tahun?>" />
                                    <input type="hidden" name="jurusan" value="<?php echo $jurusan?>" />
                                    <input type="hidden" name="program" value="<?php echo $program?>" />
                                <button type="submit" class="btn btn-success" id="OK" style="margin-top:20px;"> <i class="glyphicon glyphicon-print"></i>Export Form B Dosen Luar Dalam</button>
                         </form>
                    </div>
          <div id="menuklik" class="modal fade" role="dialog">
          	<div class="modal-dialog modal-sm">
                <div class="modal-content">
                	<div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h5 class="modal-title">Aksi</h5>
                    </div>
                  	<div class="modal-body">
                        <input type="hidden" value="" id="kodekunci">
                        <div align="center">
                        <p><button type="button" class="btn btn-default" id="editdata">Edit Data</button></p>
                        <p><button type="button" class="btn btn-default" id="nonaktif">Non Aktif</button></p>
                        </div>
                        
                     </div>
                </div>
            </div>
          </div>
          
          
        </div><!-- /.box-body -->
      </div><!-- /.box -->
    </div><!-- /.col -->
  </div><!-- /.row -->
  
</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?>rekap-beban-tugas" method="post" name="cmb" style="margin-bottom:35px;" id="cmb">
            <div class="form-group">
                <label class="control-label">Jurusan</label>
                <select class="form-control" name="jurusan">
                <?php 
                    if ($jurusan != "") {
                        echo "<option value='".$jurusan."'>".$jurusan."</option>";
                    }
                ?>
                    <option value="SEMUA">SEMUA</option>
                    <option value="IESP">IESP</option>
                    <option value="AKUNTANSI">AKUNTANSI</option>
                    <option value="MANAJEMEN">MANAJEMEN</option>
                </select>
			</div>
            <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>
            <div class="form-group">
                <label class="control-label">Program</label>
                <select class="form-control" name="program">
                <?php 
                    if ($program != "") {
                        echo "<option value='".$program."'>".$program."</option>";
                    }
                ?>
                	<option value="Semua">Semua</option>
                	<option value="Reguler">Reguler</option>
                    <option value="R. Sore Eksekutif">R. Sore Eksekutif</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>
