SHOW:
|
|
- or go back to the newest paste.
| 1 | - | <?php include "include/conn.php"; |
| 1 | + | <?php |
| 2 | //include "include/conn.php"; | |
| 3 | $tanggal; | |
| 4 | $ttl1='15-12-2015'; | |
| 5 | $ttl2='17-12-2015'; | |
| 6 | $jam_selesai='20.30'; | |
| 7 | //$ar=array(1,2);echo json_encode($ar); | |
| 8 | ?> | |
| 9 | <?php | |
| 10 | list($tgl1, $bln1, $thn1) = explode('-', $ttl1);
| |
| 11 | ?> | |
| 12 | <?php | |
| 13 | list($tgl2, $bln2, $thn2) = explode('-', $ttl2);
| |
| 14 | ?> | |
| 15 | <?php | |
| 16 | $fields=abs(gregoriantojd($bln1,$tgl1,$thn1 )-gregoriantojd($bln2,$tgl2,$thn2))+1; | |
| 17 | ?> | |
| 18 | ||
| 19 | <div class="container-fluid"> | |
| 20 | <!-- Page Heading --> | |
| 21 | ||
| 22 | - | <?php $status=$_GET['status']; |
| 22 | + | |
| 23 | ||
| 24 | <?php $status=isset($_GET['status'])?$_GET['status']:''; | |
| 25 | if ($status=='ubah'){
| |
| 26 | $nama='ubah'; | |
| 27 | $col='warning'; | |
| 28 | }else{
| |
| 29 | $nama='simpan'; | |
| 30 | $col='success'; | |
| 31 | } | |
| 32 | ?> | |
| 33 | <div class="panel panel-<?php echo $col;?> bayang"> | |
| 34 | <div class="panel-footer"> | |
| 35 | <?php echo $ttl1 ?> s/d <?php echo $ttl2 ?> | |
| 36 | </div> | |
| 37 | </div> | |
| 38 | </div> | |
| 39 | <div class="row"> | |
| 40 | <div class="col-lg-12"> | |
| 41 | ||
| 42 | <?php if ($jam_selesai=='15.45'){
| |
| 43 | $waktus = array( | |
| 44 | '08:00-08:45', | |
| 45 | '08:45-09:30', | |
| 46 | '09.30-10.15', | |
| 47 | '10.15-10.30', | |
| 48 | '10.30-11.15', | |
| 49 | '11.15-12.00', | |
| 50 | '12.00-13.00', | |
| 51 | '13.00-13.45', | |
| 52 | '13.45-14.30', | |
| 53 | '14.30-15.15', | |
| 54 | '15.15-15.45', | |
| 55 | ); | |
| 56 | } | |
| 57 | elseif ($jam_selesai=='19.00'){
| |
| 58 | $waktus = array( | |
| 59 | '08:00-08:45', | |
| 60 | '08:45-09:30', | |
| 61 | '09.30-10.15', | |
| 62 | '10.15-10.30', | |
| 63 | '10.30-11.15', | |
| 64 | '11.15-12.00', | |
| 65 | '12.00-13.00', | |
| 66 | '13.00-13.45', | |
| 67 | '13.45-14.30', | |
| 68 | '14.30-15.15', | |
| 69 | '15.15-15.45', | |
| 70 | '15.45-16.30', | |
| 71 | '16.30-17.15', | |
| 72 | '17.15-18.00', | |
| 73 | '18.00-19.00', | |
| 74 | ); | |
| 75 | } | |
| 76 | else{
| |
| 77 | $waktus = array( | |
| 78 | '08:00-08:45', | |
| 79 | '08:45-09:30', | |
| 80 | '09.30-10.15', | |
| 81 | '10.15-10.30', | |
| 82 | '10.30-11.15', | |
| 83 | '11.15-12.00', | |
| 84 | '12.00-13.00', | |
| 85 | '13.00-13.45', | |
| 86 | '13.45-14.30', | |
| 87 | '14.30-15.15', | |
| 88 | '15.15-15.45', | |
| 89 | '15.45-16.30', | |
| 90 | '16.30-17.15', | |
| 91 | '17.15-18.00', | |
| 92 | '18.00-19.00', | |
| 93 | '19.00-19.45', | |
| 94 | '19.45-20.30', | |
| 95 | ); | |
| 96 | } | |
| 97 | - | function check(element) |
| 97 | + | |
| 98 | <script type="text/javascript"> | |
| 99 | - | d=document; |
| 99 | + | |
| 100 | - | drops = d.getElementsByName('modul[]').length;
|
| 100 | + | |
| 101 | - | opts = 99; |
| 101 | + | <form enctype="multipart/form-data" action="input_jadual.php" method="post" id='jadwalKu'> |
| 102 | - | for (i=1;i<drops+1;i++) |
| 102 | + | |
| 103 | <thead> | |
| 104 | - | if (element.id != 'drop'+i && element.value != '0') |
| 104 | + | |
| 105 | - | {
|
| 105 | + | |
| 106 | - | for (z=0;z<opts;z++) |
| 106 | + | |
| 107 | <?php | |
| 108 | - | if (d.getElementById('drop'+i).options[z].value == element.value)
|
| 108 | + | |
| 109 | - | {
|
| 109 | + | |
| 110 | - | d.getElementById('drop'+i).options[z] = null;
|
| 110 | + | |
| 111 | - | break; |
| 111 | + | |
| 112 | - | } |
| 112 | + | |
| 113 | - | } |
| 113 | + | |
| 114 | 'Sunday' => 'Minggu', | |
| 115 | 'Monday' => 'Senin', | |
| 116 | 'Tuesday' => 'Selasa', | |
| 117 | 'Wednesday' => 'Rabu', | |
| 118 | - | <form enctype="multipart/form-data" action="input_jadual.php" method="post"> |
| 118 | + | |
| 119 | 'Friday' => 'Jumat', | |
| 120 | 'Saturday' => 'Sabtu' | |
| 121 | ); | |
| 122 | ||
| 123 | $noHari=0; | |
| 124 | foreach($daterange as $date){
| |
| 125 | $tgl=$date->format("d-m-Y");
| |
| 126 | $hariss = date('l', strtotime($tgl));
| |
| 127 | $haris=$dayList[$hariss]; | |
| 128 | if ($haris=='Minggu'){
| |
| 129 | $warna='red'; | |
| 130 | $dis='disabled'; | |
| 131 | }else{
| |
| 132 | $warna=''; | |
| 133 | $dis=''; | |
| 134 | } | |
| 135 | ?> | |
| 136 | <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> | |
| 137 | <?php | |
| 138 | $noHari++; | |
| 139 | } | |
| 140 | //===============jumlah hari dan jam | |
| 141 | $arrlength = count($waktus); | |
| 142 | echo '<input type=hidden id="hariTotal" value="'.$noHari.'" />'; | |
| 143 | echo '<input type=hidden id="jamTotal" value="'.$arrlength.'" />'; | |
| 144 | //print_r($daterange); | |
| 145 | ?> | |
| 146 | </tr> | |
| 147 | </thead> | |
| 148 | <tbody> | |
| 149 | <?php | |
| 150 | $nos=1; | |
| 151 | ||
| 152 | - | <?php } ?> |
| 152 | + | for($x = 0; $x < $arrlength; $x++) { ?>
|
| 153 | <?php if ($waktus[$x]=='12.00-13.00'){
| |
| 154 | ?> | |
| 155 | <tr disabled> | |
| 156 | - | <?php $nos=1; $arrlength = count($waktus); for($x = 0; $x < $arrlength; $x++) { ?>
|
| 156 | + | |
| 157 | - | <?php if ($waktus[$x]=='12.00-13.00'){
|
| 157 | + | |
| 158 | <?php | |
| 159 | $no=1; | |
| 160 | for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
| |
| 161 | <td class="data" align="center"> | |
| 162 | <i>Istirahat, Sholat & Makan</i> | |
| 163 | </td> | |
| 164 | <?php } ?> | |
| 165 | </tr> | |
| 166 | <?php } elseif ($waktus[$x]=='10.15-10.30'){
| |
| 167 | ?> | |
| 168 | - | <?php } elseif ($waktus[$x]=='10.15-10.30'){
|
| 168 | + | |
| 169 | <td class="data" align="center"><?php echo $nos;?></td> | |
| 170 | <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td> | |
| 171 | <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
| |
| 172 | <td class="data" align="center"> | |
| 173 | <i>Coffee Break</i> | |
| 174 | </td> | |
| 175 | <?php } ?> | |
| 176 | </tr> | |
| 177 | <?php } elseif ($waktus[$x]=='15.15-15.45'){
| |
| 178 | ?> | |
| 179 | <tr disabled> | |
| 180 | <td class="data" align="center"><?php echo $nos;?></td> | |
| 181 | <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td> | |
| 182 | <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
| |
| 183 | <td class="data" align="center"> | |
| 184 | <i>Coffee Break</i> | |
| 185 | </td> | |
| 186 | <?php } ?> | |
| 187 | </tr> | |
| 188 | <?php } elseif ($waktus[$x]=='18.00-19.00'){
| |
| 189 | ?> | |
| 190 | <tr disabled> | |
| 191 | <td class="data" align="center"><?php echo $nos;?></td> | |
| 192 | <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td> | |
| 193 | <?php $no=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
| |
| 194 | <td class="data" align="center"> | |
| 195 | <i>Istirahat, Sholat & Makan</i> | |
| 196 | </td> | |
| 197 | <?php } ?> | |
| 198 | </tr> | |
| 199 | <?php | |
| 200 | }else{
| |
| 201 | ?> | |
| 202 | <tr> | |
| 203 | <td class="data" align="center"><?php echo $nos;?></td> | |
| 204 | <td class="data" align="center"><input type="hidden" name="waktu[]" value="<?php echo $waktus[$x];?>"/><?php echo $waktus[$x];?></td> | |
| 205 | <?php | |
| 206 | $noz=1; | |
| 207 | - | <?php $noz=1; for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) { ?>
|
| 207 | + | for($i = 0; $i < (is_numeric($fields)?$fields:1); $i++) {
|
| 208 | - | <?php $random = (rand()%500); |
| 208 | + | |
| 209 | $random = (rand()%500); | |
| 210 | if ($nos==1){
| |
| 211 | $angka=$noz; | |
| 212 | } | |
| 213 | elseif ($nos==2){
| |
| 214 | $angka=$fields+$noz; | |
| 215 | } | |
| 216 | elseif ($nos==3){
| |
| 217 | $angka=$fields*2+$noz; | |
| 218 | } | |
| 219 | elseif ($nos==4){
| |
| 220 | $angka=$fields*3+$noz; | |
| 221 | } | |
| 222 | elseif ($nos==5){
| |
| 223 | $angka=$fields*3+$noz; | |
| 224 | } | |
| 225 | elseif ($nos==6){
| |
| 226 | $angka=$fields*4+$noz; | |
| 227 | } | |
| 228 | elseif ($nos==7){
| |
| 229 | $angka=$fields*6+$noz; | |
| 230 | } | |
| 231 | elseif ($nos==8){
| |
| 232 | $angka=$fields*5+$noz; | |
| 233 | } | |
| 234 | elseif ($nos==9){
| |
| 235 | $angka=$fields*6+$noz; | |
| 236 | } | |
| 237 | elseif ($nos==10){
| |
| 238 | $angka=$fields*7+$noz; | |
| 239 | } | |
| 240 | elseif ($nos==11){
| |
| 241 | $angka=$fields*10+$noz; | |
| 242 | } | |
| 243 | elseif ($nos==12){
| |
| 244 | $angka=$fields*8+$noz; | |
| 245 | } | |
| 246 | elseif ($nos==13){
| |
| 247 | $angka=$fields*9+$noz; | |
| 248 | } | |
| 249 | elseif ($nos==14){
| |
| 250 | $angka=$fields*10+$noz; | |
| 251 | } | |
| 252 | elseif ($nos==15){
| |
| 253 | $angka=$fields*14+$noz; | |
| 254 | } | |
| 255 | elseif ($nos==16){
| |
| 256 | $angka=$fields*11+$noz; | |
| 257 | } | |
| 258 | elseif ($nos==17){
| |
| 259 | $angka=$fields*12+$noz; | |
| 260 | } | |
| 261 | ||
| 262 | $angka=$x*100 +100+$noz; | |
| 263 | - | <select name="modul[]" id="drop<?php echo $angka ?>" onchange="check(this); myDisable();"> |
| 263 | + | |
| 264 | ||
| 265 | - | <option value="FISIKA">FISIKA(3 hours)</option> |
| 265 | + | |
| 266 | - | <option value="GEOGRAPHIC">GEOGRAPHIC(4 hours)</option> |
| 266 | + | <!-- value : {idPelajaran,jam} -->
|
| 267 | - | <option value="MATEMATIKA">MATEMATIKA(5 hours)</option> |
| 267 | + | <select name="modul[]" id="drop<?php echo $angka ?>" onchange="check(this,<?=$angka;?>); myDisable0(<?=$angka;?>);"> |
| 268 | <option value="0">Lanjutan</option> | |
| 269 | - | include 'include/conn.php'; |
| 269 | + | <option value="[3,3]">FISIKA(3 hours)</option> |
| 270 | - | $select=mysql_db_query(@$db,"select nama_modul,jp from modul where nama_pelatihan='$nama_pelatihan'",@$koneksi); |
| 270 | + | <option value="[4,4]">GEOGRAPHIC(4 hours)</option> |
| 271 | - | while($row=mysql_fetch_array($select)) |
| 271 | + | <option value="[5,5]">MATEMATIKA(5 hours)</option> |
| 272 | <?php | |
| 273 | // include 'include/conn.php'; | |
| 274 | - | echo "<option value='".$row['nama_modul']."'>".$row['nama_modul']."(".$row['jp'].")</option>";
|
| 274 | + | // $select=mysql_db_query(@$db,"select nama_modul,jp from modul where nama_pelatihan='$nama_pelatihan'",@$koneksi); |
| 275 | // while($row=mysql_fetch_array($select)) | |
| 276 | $data=array( | |
| 277 | array('id'=>7,'jp'=>"3", "nama_modul"=>"modul 1"),
| |
| 278 | array('id'=>8,'jp'=>"2", "nama_modul"=>"modul 2"),
| |
| 279 | - | function myDisable() {
|
| 279 | + | array('id'=>9,'jp'=>"2", "nama_modul"=>"modul 3"),
|
| 280 | - | a=1; |
| 280 | + | |
| 281 | - | b=3; |
| 281 | + | ); |
| 282 | - | for (i=1;i<3;i++){
|
| 282 | + | foreach($data as $row) |
| 283 | - | posi=a+b*i; |
| 283 | + | |
| 284 | - | document.getElementById('drop'+posi).disabled = true;
|
| 284 | + | |
| 285 | - | } } |
| 285 | + | echo "\n\t\t\t\t<option value='[".$row['id'].",".$row['jp']."]'>".$row['nama_modul']."(".$row['jp']." hours)</option>";
|
| 286 | } | |
| 287 | - | </div> |
| 287 | + | |
| 288 | </select> | |
| 289 | <!--<?=$angka." $x $fields $noz";?>--> | |
| 290 | </td> | |
| 291 | <?php $noz++; } ?> | |
| 292 | </tr> | |
| 293 | <?php | |
| 294 | } | |
| 295 | ?> | |
| 296 | ||
| 297 | <?php $nos++; } ?> | |
| 298 | <input type="hidden" name="code" value="<?php echo $code ?>"/> | |
| 299 | <input type="hidden" name="bidang_diklat" value="<?php echo $bidang_diklat; ?>"/> | |
| 300 | <input type="hidden" name="nama_pelatihan" value="<?php echo $nama_pelatihan ?>"/> | |
| 301 | <input type="hidden" name="ttl1" value="<?php echo $ttl1 ?>"/> | |
| 302 | <input type="hidden" name="ttl2" value="<?php echo $ttl2 ?>"/> | |
| 303 | <input type="hidden" name="lokasi" value="<?php echo $lokasi ?>"/> | |
| 304 | <input type="hidden" name="status" value="final"/> | |
| 305 | </tbody> | |
| 306 | </table> | |
| 307 | <input type='reset' /> | |
| 308 | </form> | |
| 309 | - | </div> |
| 309 | + | |
| 310 | </div> | |
| 311 | </div> | |
| 312 | <script> | |
| 313 | var d=document; | |
| 314 | drops = d.getElementById('jamTotal').value;
| |
| 315 | opts = d.getElementById('hariTotal').value;
| |
| 316 | for (iJam=1;iJam<=drops;iJam++){
| |
| 317 | for (z=1;z<=opts;z++){
| |
| 318 | i2=(iJam*100)+z; | |
| 319 | try{
| |
| 320 | newValue=d.getElementById('drop'+i2).options[z].value;
| |
| 321 | d.getElementById('drop'+i2).disabled = false;
| |
| 322 | d.getElementById('drop'+i2).value = null;
| |
| 323 | }catch(e){
| |
| 324 | ok=0; | |
| 325 | } | |
| 326 | } | |
| 327 | ||
| 328 | } | |
| 329 | d.getElementById('jadwalKu').reset();
| |
| 330 | function myDisable0(posi ) {
| |
| 331 | //invalid | |
| 332 | } | |
| 333 | ||
| 334 | function myDisable(posi,size) {
| |
| 335 | //a=1; | |
| 336 | //b=3; | |
| 337 | console.log("pos:"+posi);
| |
| 338 | posisi2=posi+100; | |
| 339 | iDisable=size; | |
| 340 | while(iDisable>1){
| |
| 341 | try{
| |
| 342 | newValue=d.getElementById('drop'+posisi2).options[z].value;
| |
| 343 | console.log("id:"+posisi2);
| |
| 344 | console.log("val:"+d.getElementById('drop'+posisi2).value);
| |
| 345 | iDisable--; | |
| 346 | ok=1; | |
| 347 | }catch(e){
| |
| 348 | ok=0; | |
| 349 | } | |
| 350 | ||
| 351 | if(ok==1){
| |
| 352 | document.getElementById('drop'+posisi2).disabled = true;
| |
| 353 | d.getElementById('drop'+posisi2).value = null;
| |
| 354 | }else{}
| |
| 355 | posisi2+=100; | |
| 356 | } | |
| 357 | } | |
| 358 | ||
| 359 | function check(element,posisi) | |
| 360 | {
| |
| 361 | ||
| 362 | ||
| 363 | //d.getElementsByName('modul[]').length;
| |
| 364 | //opts = 99; | |
| 365 | console.log("id:"+element.id+"|val:"+element.value);
| |
| 366 | data = JSON.parse(element.value); | |
| 367 | jamTaken=data[1]; | |
| 368 | console.log("drops:"+drops+"|opts:"+opts);
| |
| 369 | iComp=0; | |
| 370 | for (iJam=1;iJam<=drops;iJam++){
| |
| 371 | for (z=1;z<=opts;z++){
| |
| 372 | i2=(iJam*100)+z; | |
| 373 | console.log("i="+iJam+"|z="+z+"|i2="+i2);
| |
| 374 | iComp++; | |
| 375 | try{
| |
| 376 | newValue=d.getElementById('drop'+i2).options[z].value;
| |
| 377 | ok=1; | |
| 378 | }catch(e){
| |
| 379 | ok=0; | |
| 380 | } | |
| 381 | ||
| 382 | if(ok==1){
| |
| 383 | if (element.id != 'drop'+i2 && element.value != '0'){
| |
| 384 | console.log("i2:"+i2+'|val:'+element.value+"|val2:"+d.getElementById('drop'+i2).options[z].value);
| |
| 385 | if (d.getElementById('drop'+i2).options[z].value == element.value){
| |
| 386 | d.getElementById('drop'+i2).options[z] = null;
| |
| 387 | //break; | |
| 388 | }else{
| |
| 389 | console.log( 'i2:'+i2+'|val:'+d.getElementById('drop'+i2).options[z].value);
| |
| 390 | } | |
| 391 | }else{
| |
| 392 | console.log("i2:"+i2);
| |
| 393 | } | |
| 394 | }else{
| |
| 395 | console.log('not found '+i2);
| |
| 396 | } | |
| 397 | } | |
| 398 | } | |
| 399 | myDisable(posisi,jamTaken); | |
| 400 | /* | |
| 401 | for (iJam=1;iJam<drops+1;iJam++) | |
| 402 | {
| |
| 403 | // console.log("i:"+i);
| |
| 404 | // if (element.id != 'drop'+i && element.value != '0'){
| |
| 405 | // console.log("drop:"+i+'|val:'+element.value);
| |
| 406 | for (z=1;z<=opts;z++) | |
| 407 | {
| |
| 408 | i2=(iJam*100)+z; | |
| 409 | console.log("i="+iJam+"|z="+z+"|i2="+i2);
| |
| 410 | iComp++; | |
| 411 | try{
| |
| 412 | newValue=d.getElementById('drop'+i2).options[z].value;
| |
| 413 | ok=1; | |
| 414 | }catch(e){
| |
| 415 | ||
| 416 | ok=0; | |
| 417 | } | |
| 418 | ||
| 419 | if(ok==1){
| |
| 420 | if (element.id != 'drop'+i2 && element.value != '0'){
| |
| 421 | console.log("i2:"+i2+'|val:'+element.value+"|val2:"+d.getElementById('drop'+i2).options[z].value);
| |
| 422 | if (d.getElementById('drop'+i2).options[z].value == element.value)
| |
| 423 | {
| |
| 424 | d.getElementById('drop'+i2).options[z] = null;
| |
| 425 | //break; | |
| 426 | }else{
| |
| 427 | console.log( 'i2:'+i2+'val:'+d.getElementById('drop'+i2).options[z].value);
| |
| 428 | } | |
| 429 | }else{
| |
| 430 | console.log("i2:"+i2);
| |
| 431 | } | |
| 432 | }else{
| |
| 433 | console.log('not found '+i2);
| |
| 434 | } | |
| 435 | ||
| 436 | } | |
| 437 | } | |
| 438 | */ | |
| 439 | console.log("total komponen:"+iComp);
| |
| 440 | } | |
| 441 | </script> | |
| 442 | </div> |