Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include "include/conn.php";
- $tanggal;
- $ttl1='15-12-2015';
- $ttl2='17-12-2015';
- $jam_selesai='20.30';
- ?>
- <?php
- list($tgl1, $bln1, $thn1) = explode('-', $ttl1);
- ?>
- <?php
- list($tgl2, $bln2, $thn2) = explode('-', $ttl2);
- ?>
- <?php
- $fields=abs(gregoriantojd($bln1,$tgl1,$thn1 )-gregoriantojd($bln2,$tgl2,$thn2))+1;
- ?>
- <div class="container-fluid">
- <!-- Page Heading -->
- <div class="col-lg-12">
- <?php $status=$_GET['status'];
- if ($status=='ubah'){
- $nama='ubah';
- $col='warning';
- }else{
- $nama='simpan';
- $col='success';
- }
- ?>
- <div class="panel panel-<?php echo $col;?> bayang">
- <div class="panel-footer">
- <?php echo $ttl1 ?> s/d <?php echo $ttl2 ?>
- </div>
- </div>
- </div>
- <div class="row">
- <div class="col-lg-12">
- <?php if ($jam_selesai=='15.45'){
- $waktus = array(
- '08:00-08:45',
- '08:45-09:30',
- '09.30-10.15',
- '10.15-10.30',
- '10.30-11.15',
- '11.15-12.00',
- '12.00-13.00',
- '13.00-13.45',
- '13.45-14.30',
- '14.30-15.15',
- '15.15-15.45',
- );
- }
- elseif ($jam_selesai=='19.00'){
- $waktus = array(
- '08:00-08:45',
- '08:45-09:30',
- '09.30-10.15',
- '10.15-10.30',
- '10.30-11.15',
- '11.15-12.00',
- '12.00-13.00',
- '13.00-13.45',
- '13.45-14.30',
- '14.30-15.15',
- '15.15-15.45',
- '15.45-16.30',
- '16.30-17.15',
- '17.15-18.00',
- '18.00-19.00',
- );
- }
- else{
- $waktus = array(
- '08:00-08:45',
- '08:45-09:30',
- '09.30-10.15',
- '10.15-10.30',
- '10.30-11.15',
- '11.15-12.00',
- '12.00-13.00',
- '13.00-13.45',
- '13.45-14.30',
- '14.30-15.15',
- '15.15-15.45',
- '15.45-16.30',
- '16.30-17.15',
- '17.15-18.00',
- '18.00-19.00',
- '19.00-19.45',
- '19.45-20.30',
- );
- }
- ?>
- <script type="text/javascript">
- function check(element)
- {
- d=document;
- drops = d.getElementsByName('modul[]').length;
- opts = 99;
- for (i=1;i<drops+1;i++)
- {
- if (element.id != 'drop'+i && element.value != '0')
- {
- for (z=0;z<opts;z++)
- {
- if (d.getElementById('drop'+i).options[z].value == element.value)
- {
- d.getElementById('drop'+i).options[z] = null;
- break;
- }
- }
- }
- }
- }
- </script>
- <form enctype="multipart/form-data" action="input_jadual.php" method="post">
- <table class="table table-striped table-bordered" width="100%" cellspacing="0" border="1">
- <thead>
- <tr>
- <th width="10">No</th>
- <th width="60"><center>Time</center></th>
- <?php
- $begin = new DateTime($ttl1);
- $end = new DateTime($ttl2);
- $end = $end->modify( '+1 day' );
- $interval = new DateInterval('P1D');
- $daterange = new DatePeriod($begin, $interval ,$end);
- $dayList = array(
- 'Sunday' => 'Minggu',
- 'Monday' => 'Senin',
- 'Tuesday' => 'Selasa',
- 'Wednesday' => 'Rabu',
- 'Thursday' => 'Kamis',
- 'Friday' => 'Jumat',
- 'Saturday' => 'Sabtu'
- );
- foreach($daterange as $date){
- $tgl=$date->format("d-m-Y");
- $hariss = date('l', strtotime($tgl));
- $haris=$dayList[$hariss];
- if ($haris=='Minggu'){
- $warna='red';
- $dis='disabled';
- }else{
- $warna='';
- $dis='';
- }
- ?>
- <th><center><input type="hidden" name="hari[]" value="<?php echo $haris; ?>"/><input type="hidden" name="tgl[]" value="<?php echo $tgl; ?>"/><font color="<?php echo $warna; ?>"><?php echo $haris; ?><br><?php echo $tgl; ?></font></center></th>
- <?php } ?>
- </tr>
- </thead>
- <tbody>
- <?php $nos=1; $arrlength = count($waktus); for($x = 0; $x < $arrlength; $x++) { ?>
- <?php if ($waktus[$x]=='12.00-13.00'){
- ?>
- <tr disabled>
- <td class="data" align="center"><?php echo $nos;?></td>
- <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td>
- <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
- <td class="data" align="center">
- <i>Istirahat, Sholat & Makan</i>
- </td>
- <?php } ?>
- </tr>
- <?php } elseif ($waktus[$x]=='10.15-10.30'){
- ?>
- <tr disabled>
- <td class="data" align="center"><?php echo $nos;?></td>
- <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td>
- <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
- <td class="data" align="center">
- <i>Coffee Break</i>
- </td>
- <?php } ?>
- </tr>
- <?php } elseif ($waktus[$x]=='15.15-15.45'){
- ?>
- <tr disabled>
- <td class="data" align="center"><?php echo $nos;?></td>
- <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td>
- <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
- <td class="data" align="center">
- <i>Coffee Break</i>
- </td>
- <?php } ?>
- </tr>
- <?php } elseif ($waktus[$x]=='18.00-19.00'){
- ?>
- <tr disabled>
- <td class="data" align="center"><?php echo $nos;?></td>
- <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td>
- <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
- <td class="data" align="center">
- <i>Istirahat, Sholat & Makan</i>
- </td>
- <?php } ?>
- </tr>
- <?php
- }else{
- ?>
- <tr>
- <td class="data" align="center"><?php echo $nos;?></td>
- <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td>
- <?php $noz=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
- <?php $random = (rand()%500);
- if ($nos==1){
- $angka=$noz;
- }
- elseif ($nos==2){
- $angka=$fields+$noz;
- }
- elseif ($nos==3){
- $angka=$fields*2+$noz;
- }
- elseif ($nos==4){
- $angka=$fields*3+$noz;
- }
- elseif ($nos==5){
- $angka=$fields*3+$noz;
- }
- elseif ($nos==6){
- $angka=$fields*4+$noz;
- }
- elseif ($nos==7){
- $angka=$fields*6+$noz;
- }
- elseif ($nos==8){
- $angka=$fields*5+$noz;
- }
- elseif ($nos==9){
- $angka=$fields*6+$noz;
- }
- elseif ($nos==10){
- $angka=$fields*7+$noz;
- }
- elseif ($nos==11){
- $angka=$fields*10+$noz;
- }
- elseif ($nos==12){
- $angka=$fields*8+$noz;
- }
- elseif ($nos==13){
- $angka=$fields*9+$noz;
- }
- elseif ($nos==14){
- $angka=$fields*10+$noz;
- }
- elseif ($nos==15){
- $angka=$fields*14+$noz;
- }
- elseif ($nos==16){
- $angka=$fields*11+$noz;
- }
- elseif ($nos==17){
- $angka=$fields*12+$noz;
- }
- ?>
- <td class="data" align="center">
- <select name="modul[]" id="drop<?php echo $angka ?>" onchange="check(this); myDisable();">
- <option value="0">Lanjutan</option>
- <option value="FISIKA">FISIKA(3 hours)</option>
- <option value="GEOGRAPHIC">GEOGRAPHIC(4 hours)</option>
- <option value="MATEMATIKA">MATEMATIKA(5 hours)</option>
- <?php
- include 'include/conn.php';
- $select=mysql_db_query(@$db,"select nama_modul,jp from modul where nama_pelatihan='$nama_pelatihan'",@$koneksi);
- while($row=mysql_fetch_array($select))
- {
- $jp=$row['jp'];
- echo "<option value='".$row['nama_modul']."'>".$row['nama_modul']."(".$row['jp'].")</option>";
- }
- ?>
- </select>
- <script>
- function myDisable() {
- a=1;
- b=3;
- for (i=1;i<3;i++){
- posi=a+b*i;
- document.getElementById('drop'+posi).disabled = true;
- } }
- </script>
- </div>
- </td>
- <?php $noz++; } ?>
- </tr>
- <?php
- }
- ?>
- <?php $nos++; } ?>
- <input type="hidden" name="code" value="<?php echo $code ?>"/>
- <input type="hidden" name="bidang_diklat" value="<?php echo $bidang_diklat; ?>"/>
- <input type="hidden" name="nama_pelatihan" value="<?php echo $nama_pelatihan ?>"/>
- <input type="hidden" name="ttl1" value="<?php echo $ttl1 ?>"/>
- <input type="hidden" name="ttl2" value="<?php echo $ttl2 ?>"/>
- <input type="hidden" name="lokasi" value="<?php echo $lokasi ?>"/>
- <input type="hidden" name="status" value="final"/>
- </tbody>
- </table>
- </form>
- <br>
- </div>
- </div>
- </div>
Add Comment
Please, Sign In to add comment