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