Changeset 17488 for schedule/Module
- Timestamp:
- 01/07/14 10:53:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
schedule/Module/control.php
r17487 r17488 1 1 <script language="javascript"> 2 3 2 var ctr; 4 3 … … 146 145 $days = Date('Y-m-d',strtotime($day)); 147 146 $prev_time = array(); 147 $previousData = "false"; 148 $transaction = "save"; 149 148 150 ?> 149 151 function addRowCloneNew(nextrow){ … … 212 214 ) 213 215 }) 214 215 216 } 216 217 }) // End of retrieving … … 303 304 } 304 305 305 306 306 function addRowClone(nextrow){ 307 307 <?php 308 $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error()); 308 if($previousData == "true") { 309 $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) < '$days' ORDER BY date(fStart) DESC, fScheduleID ASC, fMeasurementID ASC") or die(mysql_error()); 310 $firstRecord = mysql_fetch_array($fetch); 311 if($firstRecord != null) { 312 $firstRecordDate = strtotime($firstRecord['fStart']); 313 $days = date('Y-m-d', $firstRecordDate); 314 } 315 $previousData = "false"; 316 } 317 else { 318 $fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$days' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error()); 319 $transaction = "update"; 320 } 321 309 322 $observationsCount = mysql_query("SELECT COUNT(DISTINCT fStart) FROM schedule WHERE date(fStart) = '$days'"); 310 323 $observationsTime = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE date(fStart) = '$days'"); … … 320 333 $prev_time[$cnt3]= $date_time; 321 334 ?> 322 $('#save').attr('value','UPDATE');323 335 var targetView = document.getElementById("Data"); 324 336 // CREATE ELEMENT … … 399 411 } 400 412 ?> 401 402 403 413 selection.setAttribute('id','measure'), 404 414 selection.setAttribute('class','measure') … … 501 511 } 502 512 503 if(mysql_num_rows($fetch)<1) 504 { 513 if((mysql_num_rows($fetch)<1) || ($transaction == "save")) 514 { 515 $transaction = "save"; 505 516 ?> 506 $('#save').attr('value','SAVE'); 517 $('#save').attr('value','SAVE'); 507 518 addRowCloneNew(); 508 519 <?php 520 } 521 else { 522 ?> 523 $('#save').attr('value','UPDATE'); 524 <?php 509 525 } 510 526 ?> 511 512 527 } 513 528 529 function loadPreviousData(){ 530 <?php $previousData = "true"; ?> 531 addRowClone(); 532 } 514 533 </script> 515 534
Note:
See TracChangeset
for help on using the changeset viewer.