Changeset 16873 for schedule/function
- Timestamp:
- 06/20/13 05:02:05 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/function/SplitDelete.php
r16816 r16873 9 9 var is=0; 10 10 window.cnt=0; 11 12 13 14 15 //-------------------------------- fetch----------------------------//16 17 18 19 //-----------------------------------------------//20 //end fetch21 22 //------------------------------------------------//23 11 var x = 0; 24 25 12 <?php 26 27 28 include '../include/factdb.php'; 29 30 31 if(isset($_GET['days'])){ 32 $day = $_GET['days']; 33 }else{ 34 35 $day =date("Y-m-d"); 36 37 } 38 39 40 $days = Date('Y-m-d',strtotime($day)); 41 ?> 42 //alert('<?php echo $day; ?>'); 43 44 <?php 45 46 47 $fetch = mysql_query("SELECT * FROM schedule") or die(mysql_error()); 48 49 while($rows = mysql_fetch_array($fetch)){ 50 $timestamp=strtotime($rows['fLastUpdate']); 13 include '../include/factdb.php'; 14 if(isset($_GET['days'])) 15 { 16 $day = $_GET['days']; 17 } 18 else 19 { 20 $day =date("Y-m-d"); 21 } 22 $days = Date('Y-m-d',strtotime($day)); 23 $fetch = mysql_query("SELECT * FROM schedule") or die(mysql_error()); 24 while($rows = mysql_fetch_array($fetch)) 25 { 26 $timestamp=strtotime($rows['fStart']); 51 27 $timestamp2 = date('Y-m-d',$timestamp); 52 28 $date_time = date('H:i',$timestamp); 53 29 //$time_new = $date_time->format('H:i:s') 54 if($days == $timestamp2){ 55 56 30 if($days == $timestamp2) 31 { 57 32 ?> 58 33 cnt++; 59 34 60 61 35 $('#save').hide(); 36 $('#update').show(); 37 var div= document.createElement("div"); 38 div.setAttribute('id','TableHolder'); 62 39 var table = document.createElement("table"); 63 40 table.setAttribute('id',"table"+cnt); … … 69 46 input = document.createElement("input"), 70 47 input.setAttribute("type","time"), 71 input.setAttribute("id","Time" +cnt),48 input.setAttribute("id","Time"), 72 49 input.setAttribute("max","24"), 73 50 input.setAttribute("min","1"), … … 81 58 button.setAttribute('value','[+]'), 82 59 button.setAttribute('id','btnAddTime'), 83 button.setAttribute('name','table'+cnt), 84 button.onclick=function(){ 85 86 87 88 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01; 60 button.setAttribute('name','#table'+cnt), 61 button.onclick=function(){ 62 63 64 if($('#Time').val() != ""){ var splitting = $('#Time').val().split(':'); var add = 01; 89 65 90 66 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; … … 121 97 122 98 123 name="name"; value=""; meas = "name"; meas2 = "time"; //getTableId = $(this).attr('name');99 name="name"; value=""; meas = "name"; meas2 = "time"; // getTableId = $(this).attr('name'); 124 100 split1(); }else{ alert("please enter value for time to add measurement"); } 125 101 … … 131 107 td.appendChild( 132 108 sourcecbo= document.createElement('select'), 133 sourcecbo.setAttribute('id','source' +cnt),109 sourcecbo.setAttribute('id','source'), 134 110 <?php 135 111 $source=mysql_query("SELECT*FROM source"); … … 151 127 } 152 128 ?> 153 sourcecbo.setAttribute('id','source' +cnt)129 sourcecbo.setAttribute('id','source') 154 130 155 131 ); … … 158 134 td1.appendChild( 159 135 measurementcbo= document.createElement('select'), 160 measurementcbo.setAttribute('id','measurement' +cnt),136 measurementcbo.setAttribute('id','measurement'), 161 137 <?php 162 138 $measure=mysql_query("SELECT*FROM measurement"); … … 175 151 } 176 152 ?> 177 measurementcbo.setAttribute('id','measurement' +cnt)153 measurementcbo.setAttribute('id','measurement') 178 154 ); 179 155 td1.appendChild( … … 181 157 button.setAttribute('type','button'), 182 158 button.setAttribute('value','[+]'), 183 button.setAttribute('id','btnAddTime' +cnt),184 button.setAttribute('name',' table'+cnt),185 button.onclick=function(){ 186 if($('#Time' +cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); name="name"; value=$(this).attr('name'); meas = "hidden"; meas2 = true; is=1; getTableId = $(this).attr('name'); split1(); }else{ alert("please enter value for time to add measurement"); }159 button.setAttribute('id','btnAddTime'), 160 button.setAttribute('name','#table'+cnt), 161 button.onclick=function(){ 162 if($('#Time').val() != ""){ timeValue = $('#Time').val(); name="name"; value=$(this).attr('name'); meas = "hidden"; meas2 = true; is=1; getTableId = $(this).attr('name'); split1(); }else{ alert("please enter value for time to add measurement"); } 187 163 188 164 … … 194 170 input = document.createElement('input'), 195 171 input.setAttribute('type','text'), 196 input.setAttribute('id','txtData' +cnt),172 input.setAttribute('id','txtData'), 197 173 input.setAttribute('value','<?php echo $rows['fData']; ?>') 198 174 … … 210 186 { 211 187 212 if($('#Time' +cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30;188 if($('#Time').val() != ""){ var splitting = $('#Time').val().split(':'); var add = 30; 213 189 214 190 … … 263 239 tr.appendChild(td4); 264 240 table.appendChild(tr); 265 266 $('#TableH1').append( table);241 div.appendChild(table); 242 $('#TableH1').append(div); 267 243 268 244 <?php … … 271 247 ?> 272 248 273 if(cnt==0){ 274 var table = document.createElement("table"); 249 if(cnt==0) 250 { 251 $('#save').show(); 252 $('#update').hide(); 253 var div= document.createElement("div"); 254 div.setAttribute('id','TableHolder'); 255 var table = document.createElement("table"); 275 256 table.setAttribute('id',"table2"); 276 257 table.setAttribute('width','100%'); … … 283 264 input = document.createElement("input"), 284 265 input.setAttribute("type","time"), 285 input.setAttribute("id","Time 1"),266 input.setAttribute("id","Time"), 286 267 input.setAttribute("max","24"), 287 268 input.setAttribute("min","1"), … … 295 276 button.setAttribute('name','#table2'), 296 277 button.onclick=function(){ 297 if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 01; 278 var aa; 279 $('div#TableHolder #table2 #Time').each(function(){ 280 aa = $(this).val(); 281 }); 282 if(aa != ""){ var splitting =aa.split(':'); var add = 01; 298 283 299 284 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; … … 313 298 314 299 $("table").each(function() { 315 if($(this).attr("name")==' table2'){300 if($(this).attr("name")=='#table2'){ 316 301 get = "#"+$(this).attr("id"); 317 302 … … 335 320 td.appendChild( 336 321 sourcecbo= document.createElement('select'), 337 sourcecbo.setAttribute('id','source 1'),322 sourcecbo.setAttribute('id','source'), 338 323 <?php 339 324 $source=mysql_query("SELECT*FROM source"); … … 351 336 } 352 337 ?> 353 sourcecbo.setAttribute('id','source 1')338 sourcecbo.setAttribute('id','source') 354 339 355 340 ); … … 358 343 td1.appendChild( 359 344 measurementcbo= document.createElement('select'), 360 measurementcbo.setAttribute('id','measurement 1'),345 measurementcbo.setAttribute('id','measurement'), 361 346 <?php 362 347 $measure=mysql_query("SELECT*FROM measurement"); … … 373 358 } 374 359 ?> 375 measurementcbo.setAttribute('id','measurement 1')360 measurementcbo.setAttribute('id','measurement') 376 361 ); 377 362 td1.appendChild( … … 382 367 button.setAttribute('name','#table2'), 383 368 button.onclick=function(){ 384 if($('#Time1').val() != ""){ timeValue = $('#Time1').val(); name="name"; value="table2"; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 369 var aa; 370 $('div#TableHolder #table2 #Time').each(function(){ 371 aa = $(this).val(); 372 }); 373 if(aa != ""){ timeValue =aa; name="name"; value=$(this).attr('name'); meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 385 374 386 375 … … 392 381 input = document.createElement('input'), 393 382 input.setAttribute('type','text'), 394 input.setAttribute('id','txtData 1')383 input.setAttribute('id','txtData') 395 384 396 385 ); … … 405 394 button.onclick= function() 406 395 { 407 if($('#Time1').val() != ""){ var splitting = $('#Time1').val().split(':'); var add = 30; var limit = 60; 396 var aa; 397 $('div#TableHolder #table2 #Time').each(function(){ 398 aa = $(this).val(); 399 }); 400 if(aa != ""){ var splitting = aa.split(':'); var add = 30; var limit = 60; 408 401 var adds =0; 409 402 adds = (Number(splitting[1]) + Number(add)); … … 438 431 button.setAttribute('id','btnDelete'), 439 432 button.onclick=function(){ 440 $('#table 1').remove();433 $('#table2').remove(); 441 434 442 435 } … … 450 443 tr.appendChild(td4); 451 444 table.appendChild(tr); 445 div.appendChild(table); 446 $('#TableH1').append(div); 452 447 453 $('#TableH1').append(table);454 448 var div= document.createElement("div"); 449 div.setAttribute('id','TableHolder'); 455 450 var table = document.createElement("table"); 456 451 table.setAttribute('id',"table1"); … … 464 459 input = document.createElement("input"), 465 460 input.setAttribute("type","time"), 466 input.setAttribute("id","Time 2"),461 input.setAttribute("id","Time"), 467 462 input.setAttribute("max","24"), 468 463 input.setAttribute("min","1"), … … 476 471 button.setAttribute('name','#table1'), 477 472 button.onclick=function(){ 478 if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 01; 473 var aa; 474 $('div#TableHolder #table1 #Time').each(function(){ 475 aa = $(this).val(); 476 }); 477 478 if(aa != ""){ var splitting = aa.split(':'); var add = 01; 479 479 480 480 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; … … 495 495 496 496 $("table").each(function() { 497 if($(this).attr("name")==' table1'){497 if($(this).attr("name")=='#table1'){ 498 498 get = "#"+$(this).attr("id"); 499 499 … … 501 501 }else{ 502 502 if(s==0){ 503 get = '#table'+cnt;503 get = '#table'+cnt; 504 504 } 505 505 } … … 518 518 td.appendChild( 519 519 sourcecbo= document.createElement('select'), 520 sourcecbo.setAttribute('id','source 2'),520 sourcecbo.setAttribute('id','source'), 521 521 <?php 522 522 $source=mysql_query("SELECT*FROM source"); … … 534 534 } 535 535 ?> 536 sourcecbo.setAttribute('id','source 2')536 sourcecbo.setAttribute('id','source') 537 537 538 538 ); … … 541 541 td1.appendChild( 542 542 measurementcbo= document.createElement('select'), 543 measurementcbo.setAttribute('id','measurement 2'),543 measurementcbo.setAttribute('id','measurement'), 544 544 <?php 545 545 $measure=mysql_query("SELECT*FROM measurement"); … … 556 556 } 557 557 ?> 558 measurementcbo.setAttribute('id','measurement 2')558 measurementcbo.setAttribute('id','measurement') 559 559 ); 560 560 td1.appendChild( … … 565 565 button.setAttribute('name','#table1'), 566 566 button.onclick=function(){ 567 if($('#Time2').val() != ""){ timeValue = $('#Time2').val(); name="name"; value="table1"; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 567 var aa; 568 $('div#TableHolder #table1 #Time').each(function(){ 569 aa = $(this).val(); 570 }); 571 572 if(aa != ""){ timeValue = aa; name="name"; value="#table1"; meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split2(); }else{ alert("please enter value for time to add measurement"); } 568 573 569 574 … … 575 580 input = document.createElement('input'), 576 581 input.setAttribute('type','text'), 577 input.setAttribute('id','txtData 2')582 input.setAttribute('id','txtData') 578 583 579 584 ); … … 588 593 button.onclick= function() 589 594 { 590 if($('#Time2').val() != ""){ var splitting = $('#Time2').val().split(':'); var add = 30; 595 var aa; 596 $('div#TableHolder #table1 #Time').each(function(){ 597 aa = $(this).val(); 598 }); 599 if(aa != ""){ var splitting = aa.split(':'); var add = 30; 591 600 592 601 var limit = 60; … … 640 649 tr.appendChild(td4); 641 650 table.appendChild(tr); 642 643 $('#TableH1').append( table);651 div.appendChild(table); 652 $('#TableH1').append(div); 644 653 645 654 … … 653 662 654 663 cnt++; 664 var div= document.createElement("div"); 665 div.setAttribute('id','TableHolder'); 655 666 var table = document.createElement("table"); 656 667 table.setAttribute('id',"table"+cnt); … … 668 679 input = document.createElement("input"), 669 680 input.setAttribute("type","time"), 670 input.setAttribute("id","Time" +cnt),681 input.setAttribute("id","Time"), 671 682 input.setAttribute("max","24"), 672 683 input.setAttribute("min","1"), … … 683 694 button.setAttribute('id','btnAddTime'), 684 695 button.setAttribute(meas,meas2), 685 button.setAttribute('name','table'+cnt), 686 687 button.onclick=function(){ 688 if($('#Time'+cnt).val() != ""){var splitting = $('#Time'+cnt).val().split(':'); var add = 01; 696 button.setAttribute('name','#table'+cnt), 697 698 button.onclick=function(){ 699 var aa; 700 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 701 aa = $(this).val(); 702 }); 703 if(aa != ""){var splitting = aa.split(':'); var add = 01; 689 704 690 705 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; … … 728 743 td.appendChild( 729 744 sourcecbo= document.createElement('select'), 730 sourcecbo.setAttribute('id','source' +cnt),745 sourcecbo.setAttribute('id','source'), 731 746 <?php 732 747 $source=mysql_query("SELECT*FROM source"); … … 744 759 } 745 760 ?> 746 sourcecbo.setAttribute('id','source' +cnt)761 sourcecbo.setAttribute('id','source') 747 762 748 763 ); … … 751 766 td1.appendChild( 752 767 measurementcbo= document.createElement('select'), 753 measurementcbo.setAttribute('id','measurement' +cnt),768 measurementcbo.setAttribute('id','measurement'), 754 769 <?php 755 770 $measure=mysql_query("SELECT*FROM measurement"); … … 766 781 } 767 782 ?> 768 measurementcbo.setAttribute('id','measurement' +cnt)783 measurementcbo.setAttribute('id','measurement') 769 784 ); 770 785 td1.appendChild( … … 775 790 button.setAttribute('name','#table'+cnt), 776 791 button.onclick=function(){ 777 778 if($('#Time'+cnt).val() != "") 792 var aa; 793 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 794 aa = $(this).val(); 795 }); 796 if(aa != "") 779 797 { 780 798 name = "name"; 781 value = " table"+cnt;782 timeValue = $('#Time'+cnt).val();799 value = "#table"+cnt; 800 timeValue = aa; 783 801 meas = "hidden"; 784 802 meas2 = true; … … 800 818 input = document.createElement('input'), 801 819 input.setAttribute('type','text'), 802 input.setAttribute('id','txtData' +cnt)820 input.setAttribute('id','txtData') 803 821 804 822 ); … … 812 830 button.setAttribute('name','#table'+cnt), 813 831 button.onclick=function(){ 814 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30; 832 var aa; 833 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 834 aa = $(this).val(); 835 }); 836 if(aa != ""){ var splitting = aa.split(':'); var add = 30; 815 837 816 838 var limit = 60; … … 861 883 tr.appendChild(td4); 862 884 table.appendChild(tr); 863 864 $( table).insertAfter($(getTableId));885 div.appendChild(table); 886 $(div).insertAfter($(getTableId)); 865 887 866 888 … … 871 893 872 894 cnt++; 895 var div= document.createElement("div"); 896 div.setAttribute('id','TableHolder'); 873 897 var table = document.createElement("table"); 874 898 table.setAttribute('id',"table"+cnt); … … 885 909 input = document.createElement("input"), 886 910 input.setAttribute("type","time"), 887 input.setAttribute("id","Time" +cnt),911 input.setAttribute("id","Time"), 888 912 input.setAttribute("max","24"), 889 913 input.setAttribute("min","1"), … … 898 922 button.setAttribute('id','btnAddTime'), 899 923 button.setAttribute(meas,meas2), 900 button.setAttribute('name','table'+cnt), 901 902 button.onclick=function(){ 903 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 01; 924 button.setAttribute('name','#table'+cnt), 925 926 button.onclick=function(){ 927 var aa; 928 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 929 aa = $(this).val(); 930 }); 931 if(aa != ""){ var splitting = aa.split(':'); var add = 01; 904 932 905 933 timeValue = pad((Number(splitting[0]) + Number(add)),2)+':'+splitting[1]; … … 941 969 td.appendChild( 942 970 sourcecbo= document.createElement('select'), 943 sourcecbo.setAttribute('id','source' +cnt),971 sourcecbo.setAttribute('id','source'), 944 972 <?php 945 973 $source=mysql_query("SELECT*FROM source"); … … 957 985 } 958 986 ?> 959 sourcecbo.setAttribute('id','source' +cnt)987 sourcecbo.setAttribute('id','source') 960 988 961 989 ); … … 965 993 td1.appendChild( 966 994 measurementcbo= document.createElement('select'), 967 measurementcbo.setAttribute('id','measurement' +cnt),995 measurementcbo.setAttribute('id','measurement'), 968 996 <?php 969 997 $measure=mysql_query("SELECT*FROM measurement"); … … 980 1008 } 981 1009 ?> 982 measurementcbo.setAttribute('id','measurement' +cnt)1010 measurementcbo.setAttribute('id','measurement') 983 1011 ); 984 1012 td1.appendChild( … … 989 1017 button.setAttribute('name','#table'+cnt), 990 1018 button.onclick=function(){ 991 992 if($('#Time'+cnt).val() != ""){ timeValue = $('#Time'+cnt).val(); 1019 var aa; 1020 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 1021 aa = $(this).val(); 1022 }); 1023 if(aa != ""){ timeValue = aa; 993 1024 name = "name"; value = $(this).attr('name'); meas = "hidden"; meas2 = true; getTableId = $(this).attr('name'); split1(); }else{ alert("please enter value for time to add measurement"); } 994 1025 … … 1002 1033 input = document.createElement('input'), 1003 1034 input.setAttribute('type','text'), 1004 input.setAttribute('id','txtData' +cnt)1035 input.setAttribute('id','txtData') 1005 1036 1006 1037 ); … … 1014 1045 button.setAttribute('name','#table'+cnt), 1015 1046 button.onclick=function(){ 1016 if($('#Time'+cnt).val() != ""){ var splitting = $('#Time'+cnt).val().split(':'); var add = 30; 1047 var aa; 1048 $('div#TableHolder #table'+cnt+' #Time').each(function(){ 1049 aa = $(this).val(); 1050 }); 1051 if(aa != ""){ var splitting = aa.split(':'); var add = 30; 1017 1052 1018 1053 var limit = 60; … … 1058 1093 tr.appendChild(td4); 1059 1094 table.appendChild(tr); 1060 1061 $( table).insertAfter($(getTableId));1095 div.appendChild(table); 1096 $(div).insertAfter($(getTableId)); 1062 1097 } 1063 1098
Note:
See TracChangeset
for help on using the changeset viewer.