- Timestamp:
- 01/07/14 09:48:50 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Module/control.php
r17478 r17487 35 35 select = document.createElement("select"), 36 36 select.setAttribute("class","measure"), 37 $.ajax({ 37 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio 38 38 type:"post", 39 39 url:"Transaction/measurement.php", … … 48 48 }) 49 49 } 50 }) 50 }) // End of retrieving 51 51 ); 52 52 newtd_c2.setAttribute("width","115"); … … 66 66 selection = document.createElement("select"), 67 67 selection.setAttribute("class","source"), 68 $.ajax({ 68 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio 69 69 type:"post", 70 70 url:"Transaction/source.php", … … 80 80 }); 81 81 } 82 }) 82 }) // End of retrieving 83 83 ); 84 84 var newtd_c4 = document.createElement("td"); … … 147 147 $prev_time = array(); 148 148 ?> 149 function addRowClone 1(nextrow){149 function addRowCloneNew(nextrow){ 150 150 var targetView = document.getElementById("Data"); 151 151 // CREATE ELEMENT … … 190 190 input_data.setAttribute("value","+"), 191 191 input_data.onclick = function(){ 192 addRowClone 1("list_"+newlist);192 addRowCloneNew("list_"+newlist); 193 193 } 194 194 ); … … 200 200 select = document.createElement("select"), 201 201 select.setAttribute("class","measure"), 202 $.ajax({ 202 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio 203 203 type:"post", 204 204 url:"Transaction/measurement.php", … … 214 214 215 215 } 216 }) // End of retrieving 217 216 }) // End of retrieving 218 217 ); 219 218 newtd_c2.setAttribute("width","115"); … … 233 232 selection = document.createElement("select"), 234 233 selection.setAttribute("class","source"), 235 $.ajax({ 234 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio 236 235 type:"post", 237 236 url:"Transaction/source.php", … … 247 246 }); 248 247 } 249 }) 248 }) // End of retrieving 250 249 ); 251 250 var newtd_c4 = document.createElement("td"); … … 306 305 307 306 function addRowClone(nextrow){ 308 <?php 309 $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error()); 310 $observationsCount = mysql_query("SELECT COUNT(DISTINCT fStart) FROM schedule WHERE date(fStart) = '$days'"); 311 $observationsTime = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE date(fStart) = '$days'"); 312 313 $cnt3=0; 314 $cnt2=0; 315 $cnt4 = 0; 316 $cnt5 = 0; 317 //$data = array(); 318 //$counter=0; 319 $prevtimestamp = 0; 320 while($times = mysql_fetch_array($observationsTime)) 321 { 322 $timestamp=strtotime($times['fStart']); 323 $actualtime = date('Y-m-d H:i:s', $timestamp); 324 $timestamp2 = date('Y-m-d',$timestamp); 325 $date_time = date('H:i:s',$timestamp); 326 $prev_time[$cnt3]= $date_time; 327 ?> 328 $('#save').attr('value','UPDATE'); 329 var targetView = document.getElementById("Data"); 330 // CREATE ELEMENT 331 // COUNT LIST 332 var list = $(".datalisting").length; 333 var newlist = list+1; 334 335 var cctr=$('.dataTable tr').length; 336 ctr=cctr+1; 337 338 var newdiv = document.createElement("div"); 339 newdiv.setAttribute("id","list_"+newlist); 340 newdiv.setAttribute("class","datalisting"); 341 newdiv.setAttribute("style","margin:5px 0;"); 342 343 var newtable = document.createElement("table"); 344 newtable.setAttribute("class","dataTable"); 345 newtable.setAttribute("width","100%"); 346 newtable.setAttribute("border","1"); 347 newtable.setAttribute("cellspacing","0"); 348 newtable.setAttribute("cellpadding","0"); 349 350 var newInnertable = document.createElement("table"); 351 newInnertable.setAttribute("class","dataTable"); 352 newInnertable.setAttribute("width","100%"); 353 newInnertable.setAttribute("border","1"); 307 <?php 308 $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error()); 309 $observationsCount = mysql_query("SELECT COUNT(DISTINCT fStart) FROM schedule WHERE date(fStart) = '$days'"); 310 $observationsTime = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE date(fStart) = '$days'"); 311 312 $cnt3=0; 313 $prevtimestamp = 0; 314 while($times = mysql_fetch_array($observationsTime)) 315 { 316 $timestamp=strtotime($times['fStart']); 317 $actualtime = date('Y-m-d H:i:s', $timestamp); 318 $timestamp2 = date('Y-m-d',$timestamp); 319 $date_time = date('H:i:s',$timestamp); 320 $prev_time[$cnt3]= $date_time; 321 ?> 322 $('#save').attr('value','UPDATE'); 323 var targetView = document.getElementById("Data"); 324 // CREATE ELEMENT 325 // COUNT LIST 326 var list = $(".datalisting").length; 327 var newlist = list+1; 328 329 var cctr=$('.dataTable tr').length; 330 ctr=cctr+1; 331 332 var newdiv = document.createElement("div"); 333 newdiv.setAttribute("id","list_"+newlist); 334 newdiv.setAttribute("class","datalisting"); 335 newdiv.setAttribute("style","margin:5px 0;"); 336 337 var newtable = document.createElement("table"); 338 newtable.setAttribute("class","dataTable"); 339 newtable.setAttribute("width","100%"); 340 newtable.setAttribute("border","1"); 341 newtable.setAttribute("cellspacing","0"); 342 newtable.setAttribute("cellpadding","0"); 343 344 var newInnertable = document.createElement("table"); 345 newInnertable.setAttribute("class","dataTable"); 346 newInnertable.setAttribute("width","100%"); 347 newInnertable.setAttribute("border","1"); 354 348 355 newInnertable.setAttribute("cellspacing","0"); 356 newInnertable.setAttribute("cellpadding","0"); 357 358 var newtd_c1 = document.createElement("td"); 359 newtd_c1.setAttribute("width","200"); 360 newtd_c1.setAttribute("align","center"); 361 newtd_c1.appendChild( 362 input_data = document.createElement("input"), 363 input_data.setAttribute("type","time"), 364 input_data.setAttribute("class","time"), 365 input_data.setAttribute("size","10"), 366 input_data.setAttribute("value","<?php echo $date_time; ?>"), 367 input_data.setAttribute("autofocus","true") 368 ); 369 newtd_c1.appendChild( 370 input_data = document.createElement("input"), 371 input_data.setAttribute("type","button"), 372 input_data.setAttribute("value","+"), 373 input_data.onclick = function(){ 374 addRowClone1("list_<?php echo $cnt+1; ?>"); 375 } 376 ); 377 378 <?php 379 380 $observations = mysql_query("SELECT * FROM schedule WHERE fStart = '$actualtime'"); 381 382 while($rows = mysql_fetch_array($observations)) 383 { 384 ?> 385 var newtr<?php echo $cnt; ?> = document.createElement("tr"); 386 newtr<?php echo $cnt; ?>.setAttribute('class','tr'); 387 388 var newtd_c2 = document.createElement("td"); 389 newtd_c2.setAttribute("width","138"); 390 newtd_c2.setAttribute("align","center"); 391 newtd_c2.appendChild( 392 selection = document.createElement("select"), 393 <?php 394 $selectm = mysql_query("SELECT * FROM measurement"); 395 while($rowmeasure = mysql_fetch_array($selectm)) 396 { 397 ?> 398 selection.appendChild( 399 option = document.createElement("option"), 400 option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"), 401 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?> 402 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>")) 403 ), 404 <?php 405 } 406 ?> 407 408 409 selection.setAttribute('id','measure'), 410 selection.setAttribute('class','measure') 349 newInnertable.setAttribute("cellspacing","0"); 350 newInnertable.setAttribute("cellpadding","0"); 351 352 var newtd_c1 = document.createElement("td"); 353 newtd_c1.setAttribute("width","200"); 354 newtd_c1.setAttribute("align","center"); 355 newtd_c1.appendChild( 356 input_data = document.createElement("input"), 357 input_data.setAttribute("type","time"), 358 input_data.setAttribute("class","time"), 359 input_data.setAttribute("size","10"), 360 input_data.setAttribute("value","<?php echo $date_time; ?>"), 361 input_data.setAttribute("autofocus","true") 411 362 ); 412 newtd_c2.setAttribute("width","115"); 413 newtd_c2.setAttribute("align","center"); 414 newtd_c2.appendChild( 363 newtd_c1.appendChild( 415 364 input_data = document.createElement("input"), 416 365 input_data.setAttribute("type","button"), 417 366 input_data.setAttribute("value","+"), 418 input_data.onclick = function(){ 419 return addRow(newtr<?php echo $cnt; ?>); 420 ctr++; 421 }); 422 var newtd_c3 = document.createElement("td"); 423 newtd_c3.setAttribute("width","98"); 424 newtd_c3.setAttribute("align","center"); 425 newtd_c3.appendChild( 367 input_data.onclick = function(){ 368 addRowCloneNew("list_<?php echo $cnt+1; ?>"); 369 } 370 ); 371 372 <?php 373 374 $observations = mysql_query("SELECT * FROM schedule WHERE fStart = '$actualtime'"); 375 376 while($rows = mysql_fetch_array($observations)) 377 { 378 ?> 379 var newtr<?php echo $cnt; ?> = document.createElement("tr"); 380 newtr<?php echo $cnt; ?>.setAttribute('class','tr'); 381 382 var newtd_c2 = document.createElement("td"); 383 newtd_c2.setAttribute("width","138"); 384 newtd_c2.setAttribute("align","center"); 385 newtd_c2.appendChild( 426 386 selection = document.createElement("select"), 427 <?php428 $select = mysql_query("SELECT * FROM source");429 while($rowsource = mysql_fetch_array($select))430 {431 ?>387 <?php 388 $selectm = mysql_query("SELECT * FROM measurement"); 389 while($rowmeasure = mysql_fetch_array($selectm)) 390 { 391 ?> 432 392 selection.appendChild( 433 393 option = document.createElement("option"), 434 option.setAttribute( 'value','<?php echo $rowsource['fSourceKEY']; ?>'),435 <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo "option.setAttribute('selected',true),"; }?>436 option.appendChild(document.createTextNode("<?php echo $row source['fSourceName']; ?>"))394 option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"), 395 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?> 396 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>")) 437 397 ), 438 <?php 439 } 398 <?php 399 } 400 ?> 401 402 403 selection.setAttribute('id','measure'), 404 selection.setAttribute('class','measure') 405 ); 406 newtd_c2.setAttribute("width","115"); 407 newtd_c2.setAttribute("align","center"); 408 newtd_c2.appendChild( 409 input_data = document.createElement("input"), 410 input_data.setAttribute("type","button"), 411 input_data.setAttribute("value","+"), 412 input_data.onclick = function(){ 413 return addRow(newtr<?php echo $cnt; ?>); 414 ctr++; 415 }); 416 var newtd_c3 = document.createElement("td"); 417 newtd_c3.setAttribute("width","98"); 418 newtd_c3.setAttribute("align","center"); 419 newtd_c3.appendChild( 420 selection = document.createElement("select"), 421 <?php 422 $select = mysql_query("SELECT * FROM source"); 423 while($rowsource = mysql_fetch_array($select)) 424 { 425 ?> 426 selection.appendChild( 427 option = document.createElement("option"), 428 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'), 429 <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo "option.setAttribute('selected',true),"; } ?> 430 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>")) 431 ), 432 <?php 433 } 434 ?> 435 436 selection.setAttribute('id','source'), // End of retrieving 437 selection.setAttribute('class','source') // End of retrieving 438 ); 439 var newtd_c4 = document.createElement("td"); 440 newtd_c4.setAttribute("width","119"); 441 newtd_c4.setAttribute("align","center"); 442 newtd_c4.appendChild( 443 input_data = document.createElement("input"), 444 input_data.setAttribute("type","text"), 445 input_data.setAttribute("class","selected"), 446 input_data.setAttribute("size","12"), 447 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"), 448 input_data.setAttribute("placeholder","Value") 449 ); 450 var newtd_c5 = document.createElement("td"); 451 newtd_c5.setAttribute("width","115"); 452 newtd_c5.setAttribute("align","center"); 453 newtd_c5.setAttribute("width","115"); 454 newtd_c5.setAttribute("align","center"); 455 newtd_c5.appendChild( 456 input_data = document.createElement("input"), 457 input_data.setAttribute("type","button"), 458 input_data.setAttribute("value","Delete"), 459 input_data.onclick = function(){ return clearNode(newtr<?php echo $cnt; ?>); 460 } 461 ); 462 463 newtr<?php echo $cnt; ?>.appendChild(newtd_c2); 464 newtr<?php echo $cnt; ?>.appendChild(newtd_c3); 465 newtr<?php echo $cnt; ?>.appendChild(newtd_c4); 466 newtr<?php echo $cnt; ?>.appendChild(newtd_c5); 467 newInnertable.appendChild(newtr<?php echo $cnt; ?>); 468 <?php 469 $cnt++; 470 $prevtimestamp = $timestamp; 471 } 440 472 ?> 441 442 selection.setAttribute('id','source'), // End of retrieving 443 selection.setAttribute('class','source') // End of retrieving 444 ); 445 var newtd_c4 = document.createElement("td"); 446 newtd_c4.setAttribute("width","119"); 447 newtd_c4.setAttribute("align","center"); 448 newtd_c4.appendChild( 449 input_data = document.createElement("input"), 450 input_data.setAttribute("type","text"), 451 input_data.setAttribute("class","selected"), 452 input_data.setAttribute("size","12"), 453 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"), 454 input_data.setAttribute("placeholder","Value") 455 ); 456 var newtd_c5 = document.createElement("td"); 457 newtd_c5.setAttribute("width","115"); 458 newtd_c5.setAttribute("align","center"); 459 newtd_c5.setAttribute("width","115"); 460 newtd_c5.setAttribute("align","center"); 461 newtd_c5.appendChild( 473 var newtd_c6 = document.createElement("td"); 474 newtd_c6.appendChild(newInnertable); 475 476 var newtd_c7 = document.createElement("td"); 477 newtd_c7.setAttribute("width","115"); 478 newtd_c7.setAttribute("align","center"); 479 newtd_c7.appendChild( 462 480 input_data = document.createElement("input"), 463 481 input_data.setAttribute("type","button"), 464 input_data.setAttribute("value","Delete"), 465 input_data.onclick = function(){ return clearNode(newtr<?php echo $cnt; ?>); 466 } 482 input_data.setAttribute("value","Delete Main"), 483 input_data.onclick = function(){ return clearNode(newdiv); } 467 484 ); 468 469 newtr<?php echo $cnt; ?>.appendChild(newtd_c2); 470 newtr<?php echo $cnt; ?>.appendChild(newtd_c3); 471 newtr<?php echo $cnt; ?>.appendChild(newtd_c4); 472 newtr<?php echo $cnt; ?>.appendChild(newtd_c5); 473 newInnertable.appendChild(newtr<?php echo $cnt; ?>); 474 <?php 475 $cnt++; 476 $prevtimestamp = $timestamp; 477 } 478 ?> 479 var newtd_c6 = document.createElement("td"); 480 newtd_c6.appendChild(newInnertable); 481 482 var newtd_c7 = document.createElement("td"); 483 newtd_c7.setAttribute("width","115"); 484 newtd_c7.setAttribute("align","center"); 485 newtd_c7.appendChild( 486 input_data = document.createElement("input"), 487 input_data.setAttribute("type","button"), 488 input_data.setAttribute("value","Delete Main"), 489 input_data.onclick = function(){ return clearNode(newdiv); } 490 ); 491 492 var newOutertr = document.createElement("tr"); 493 494 newtable.appendChild(newtd_c1); 495 newtable.appendChild(newtd_c6); 496 newtable.appendChild(newtd_c7); 497 498 newdiv.appendChild(newtable); 499 500 if(nextrow != null){ 501 var doc = document.getElementById(nextrow); 502 $(doc).after(newdiv); 503 } else { 504 targetView.appendChild(newdiv); 505 } 506 <?php 485 486 var newOutertr = document.createElement("tr"); 487 488 newtable.appendChild(newtd_c1); 489 newtable.appendChild(newtd_c6); 490 newtable.appendChild(newtd_c7); 491 492 newdiv.appendChild(newtable); 493 494 if(nextrow != null){ 495 var doc = document.getElementById(nextrow); 496 $(doc).after(newdiv); 497 } else { 498 targetView.appendChild(newdiv); 499 } 500 <?php 507 501 } 508 502 … … 511 505 ?> 512 506 $('#save').attr('value','SAVE'); 513 addRowClone 1();507 addRowCloneNew(); 514 508 <?php 515 509 }
Note:
See TracChangeset
for help on using the changeset viewer.