Changeset 17456 for schedule/Module
- Timestamp:
- 01/04/14 08:16:21 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Module/control.php
r17455 r17456 306 306 307 307 function addRowClone(nextrow){ 308 309 $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fStartASC, fMeasurementID ASC") or die(mysql_error());310 311 312 313 314 315 316 317 318 319 320 321 while($ times = mysql_fetch_array($observationsTime))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 321 while($rows = mysql_fetch_array($fetch)) 322 322 { 323 $timestamp=strtotime($times['fStart']); 323 $scheduleId = $rows['fScheduleID']; 324 $timestamp=strtotime($rows['fStart']); 324 325 $timestamp2 = date('Y-m-d',$timestamp); 325 $date_time = date('H:i:s',$timestamp); 326 $date_time = date('H:i:s',$timestamp); 326 327 $prev_time[$cnt3]= $date_time; 327 $('#save').attr('value','UPDATE');328 ?>328 ?> 329 $('#save').attr('value','UPDATE'); 329 330 var targetView = document.getElementById("Data"); 330 331 // CREATE ELEMENT … … 332 333 var list = $(".datalisting").length; 333 334 var newlist = list+1; 334 335 335 336 var cctr=$('.dataTable tr').length; 336 ctr=cctr+1;337 337 ctr=cctr+1; 338 338 339 var newdiv = document.createElement("div"); 339 340 newdiv.setAttribute("id","list_"+newlist); … … 347 348 newtable.setAttribute("cellspacing","0"); 348 349 newtable.setAttribute("cellpadding","0"); 350 349 351 350 352 var newInnertable = document.createElement("table"); … … 353 355 newInnertable.setAttribute("border","1"); 354 356 355 newInnertable.setAttribute("cellspacing","0");356 newInnertable.setAttribute("cellpadding","0");357 newInnertable.setAttribute("cellspacing","0"); 358 newInnertable.setAttribute("cellpadding","0"); 357 359 358 360 var newtd_c1 = document.createElement("td"); … … 373 375 input_data.onclick = function(){ 374 376 addRowClone1("list_<?php echo $cnt+1; ?>"); 375 }376 );377 <?php378 379 $observations = mysql_query("SELECT * FROM schedule WHERE fStart = '$timestamp'");380 381 while($rows = mysql_fetch_array($observations))382 {383 $scheduleId = $rows['fScheduleID'];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 <?php394 $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 <?php405 }406 ?>407 selection.setAttribute('id','measure'),408 selection.setAttribute('class','measure')409 );410 newtd_c2.setAttribute("width","115");411 newtd_c2.setAttribute("align","center");412 newtd_c2.appendChild(413 input_data = document.createElement("input"),414 input_data.setAttribute("type","button"),415 input_data.setAttribute("value","+"),416 input_data.onclick = function(){417 return addRow(newtr<?php echo $cnt; ?>);418 ctr++;419 });420 var newtd_c3 = document.createElement("td");421 newtd_c3.setAttribute("width","98");422 newtd_c3.setAttribute("align","center");423 newtd_c3.appendChild(424 selection = document.createElement("select"),425 <?php426 $select = mysql_query("SELECT * FROM source");427 while($rowsource = mysql_fetch_array($select))428 {429 ?>430 selection.appendChild(431 option = document.createElement("option"),432 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),433 <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo "option.setAttribute('selected',true),"; } ?>434 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))435 ),436 <?php437 }438 ?>439 440 selection.setAttribute('id','source'), // End of retrieving441 selection.setAttribute('class','source') // End of retrieving442 );443 var newtd_c4 = document.createElement("td");444 newtd_c4.setAttribute("width","119");445 newtd_c4.setAttribute("align","center");446 newtd_c4.appendChild(447 input_data = document.createElement("input"),448 input_data.setAttribute("type","text"),449 input_data.setAttribute("class","selected"),450 input_data.setAttribute("size","12"),451 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),452 input_data.setAttribute("placeholder","Value")453 );454 var newtd_c5 = document.createElement("td");455 newtd_c5.setAttribute("width","115");456 newtd_c5.setAttribute("align","center");457 newtd_c5.setAttribute("width","115");458 newtd_c5.setAttribute("align","center");459 newtd_c5.appendChild(460 input_data = document.createElement("input"),461 input_data.setAttribute("type","button"),462 input_data.setAttribute("value","Delete"),463 input_data.onclick = function(){ return clearNode(newtr<?php echo $cnt; ?>);464 }465 );466 467 newtr<?php echo $cnt; ?>.appendChild(newtd_c2);468 newtr<?php echo $cnt; ?>.appendChild(newtd_c3);469 newtr<?php echo $cnt; ?>.appendChild(newtd_c4);470 newtr<?php echo $cnt; ?>.appendChild(newtd_c5);471 newInnertable.appendChild(newtr<?php echo $cnt; ?>);472 <?php473 }474 ?>475 var newtd_c6 = document.createElement("td");476 newtd_c6.appendChild(newInnertable);477 478 var newtd_c7 = document.createElement("td");479 newtd_c7.setAttribute("width","115");480 newtd_c7.setAttribute("align","center");481 newtd_c7.appendChild(482 input_data = document.createElement("input"),483 input_data.setAttribute("type","button"),484 input_data.setAttribute("value","Delete Main"),485 input_data.onclick = function(){ return clearNode(newdiv); }486 );487 488 var newOutertr = document.createElement("tr");489 490 newtable.appendChild(newtd_c1);491 newtable.appendChild(newtd_c6);492 newtable.appendChild(newtd_c7);493 494 newdiv.appendChild(newtable);495 496 if(nextrow != null){497 var doc = document.getElementById(nextrow);498 $(doc).after(newdiv);499 } else {500 targetView.appendChild(newdiv);501 //$(targetView).after(newtr<?php echo $cnt; ?>);502 377 } 503 504 <?php 505 $cnt++; 506 $prevtimestamp = $timestamp; 507 } 508 if(mysql_num_rows($fetch)<1) 378 ); 379 380 var newtr<?php echo $cnt; ?> = document.createElement("tr"); 381 newtr<?php echo $cnt; ?>.setAttribute('class','tr'); 382 383 var newtd_c2 = document.createElement("td"); 384 newtd_c2.setAttribute("width","138"); 385 newtd_c2.setAttribute("align","center"); 386 newtd_c2.appendChild( 387 selection = document.createElement("select"), 388 <?php 389 $selectm = mysql_query("SELECT * FROM measurement"); 390 while($rowmeasure = mysql_fetch_array($selectm)) 509 391 { 510 392 ?> 511 $('#save').attr('value','SAVE'); 512 addRowClone1(); 393 selection.appendChild( 394 option = document.createElement("option"), 395 option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"), 396 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?> 397 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>")) 398 ), 399 <?php 400 } 401 ?> 402 403 404 selection.setAttribute('id','measure'), 405 selection.setAttribute('class','measure') 406 ); 407 newtd_c2.setAttribute("width","115"); 408 newtd_c2.setAttribute("align","center"); 409 newtd_c2.appendChild( 410 input_data = document.createElement("input"), 411 input_data.setAttribute("type","button"), 412 input_data.setAttribute("value","+"), 413 input_data.onclick = function(){ 414 return addRow(newtr<?php echo $cnt; ?>); 415 ctr++; 416 }); 417 var newtd_c3 = document.createElement("td"); 418 newtd_c3.setAttribute("width","98"); 419 newtd_c3.setAttribute("align","center"); 420 newtd_c3.appendChild( 421 selection = document.createElement("select"), 513 422 <?php 514 } 515 ?> 423 $select = mysql_query("SELECT * FROM source"); 424 while($rowsource = mysql_fetch_array($select)) 425 { 426 ?> 427 selection.appendChild( 428 option = document.createElement("option"), 429 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'), 430 <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){ echo "option.setAttribute('selected',true),"; } ?> 431 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>")) 432 ), 433 <?php 434 } 435 ?> 436 437 selection.setAttribute('id','source'), // End of retrieving 438 selection.setAttribute('class','source') // End of retrieving 439 ); 440 var newtd_c4 = document.createElement("td"); 441 newtd_c4.setAttribute("width","119"); 442 newtd_c4.setAttribute("align","center"); 443 newtd_c4.appendChild( 444 input_data = document.createElement("input"), 445 input_data.setAttribute("type","text"), 446 input_data.setAttribute("class","selected"), 447 input_data.setAttribute("size","12"), 448 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"), 449 input_data.setAttribute("placeholder","Value") 450 ); 451 var newtd_c5 = document.createElement("td"); 452 newtd_c5.setAttribute("width","115"); 453 newtd_c5.setAttribute("align","center"); 454 newtd_c5.setAttribute("width","115"); 455 newtd_c5.setAttribute("align","center"); 456 newtd_c5.appendChild( 457 input_data = document.createElement("input"), 458 input_data.setAttribute("type","button"), 459 input_data.setAttribute("value","Delete"), 460 input_data.onclick = function(){ return clearNode(newtr<?php echo $cnt; ?>); 461 } 462 ); 463 464 newtr<?php echo $cnt; ?>.appendChild(newtd_c2); 465 newtr<?php echo $cnt; ?>.appendChild(newtd_c3); 466 newtr<?php echo $cnt; ?>.appendChild(newtd_c4); 467 newtr<?php echo $cnt; ?>.appendChild(newtd_c5); 468 newInnertable.appendChild(newtr<?php echo $cnt; ?>); 469 470 var newtd_c6 = document.createElement("td"); 471 newtd_c6.appendChild(newInnertable); 472 473 var newtd_c7 = document.createElement("td"); 474 newtd_c7.setAttribute("width","115"); 475 newtd_c7.setAttribute("align","center"); 476 newtd_c7.appendChild( 477 input_data = document.createElement("input"), 478 input_data.setAttribute("type","button"), 479 input_data.setAttribute("value","Delete Main"), 480 input_data.onclick = function(){ return clearNode(newdiv); } 481 ); 482 483 var newOutertr = document.createElement("tr"); 484 485 newtable.appendChild(newtd_c1); 486 newtable.appendChild(newtd_c6); 487 newtable.appendChild(newtd_c7); 488 489 newdiv.appendChild(newtable); 490 491 if(nextrow != null){ 492 var doc = document.getElementById(nextrow); 493 $(doc).after(newdiv); 494 } else { 495 targetView.appendChild(newdiv); 496 //$(targetView).after(newtr<?php echo $cnt; ?>); 497 } 498 <?php 499 //$rows = mysql_fetch_array($fetch); 500 501 $cnt++; 502 $prevtimestamp = $timestamp; 503 } 504 505 506 if(mysql_num_rows($fetch)<1) 507 { 508 ?> 509 $('#save').attr('value','SAVE'); 510 addRowClone1(); 511 <?php 516 512 } 513 514 ?> 515 516 517 } 518 517 519 </script> 518 520
Note:
See TracChangeset
for help on using the changeset viewer.