source: schedule/Module/control.php@ 20115

Last change on this file since 20115 was 17558, checked in by tose, 11 years ago
Modified enabling/disabling for current schedule
File size: 32.7 KB
Line 
1<script>
2'use strict';
3var ctr;
4var transPrevNight = 1;
5
6 function clearNode(node){
7 var child = node.childNodes[0];
8 while(child != null)
9 {
10 node.removeChild(child);
11 child = node.childNodes[0];
12 }
13 }
14
15 function addRow(table){
16 var targetView = table;
17 var cctr=$('.dataTable tr').length;
18 ctr=cctr+1;
19 var input_data;
20 var select;
21 var option;
22 var selection;
23 // CREATE ELEMENT
24 var newtr = document.createElement("tr");
25 newtr.setAttribute("class","tr");
26 newtr.setAttribute("width", "100%");
27 var newtd_c1 = document.createElement("td");
28 //newtd_c1.setAttribute("width","120");
29 newtd_c1.setAttribute("align","center");
30 newtd_c1.appendChild(
31 input_data = document.createElement("input"),
32 input_data.setAttribute("type","time"),
33 input_data.setAttribute("size","10"),
34 input_data.setAttribute("autofocus","true"),
35 input_data.setAttribute("hidden","true")
36 );
37 var newtd_c2 = document.createElement("td");
38 newtd_c2.setAttribute("width","20%");
39 newtd_c2.setAttribute("align","center");
40 newtd_c2.appendChild(
41 select = document.createElement("select"),
42 select.setAttribute("style", "width=100px"),
43 select.setAttribute("class","measure"),
44 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
45 type:"post",
46 url:"Transaction/measurement.php",
47 success:function(data){
48 var obj=$.parseJSON(data);
49 $.each(obj,function(){
50 select.appendChild(
51 option = document.createElement("option"),
52 option.setAttribute('value',this['fMeasurementKey']),
53 option.appendChild(document.createTextNode(this['fMeasurement']))
54 )
55 })
56 }
57 }) // End of retrieving
58 );
59 newtd_c2.setAttribute("align","center");
60 newtd_c2.appendChild(
61 input_data = document.createElement("input"),
62 input_data.setAttribute("type","button"),
63 input_data.setAttribute("value","+"),
64 input_data.onclick = function(){ return addRow(newtr);
65 ctr++;
66 }
67 );
68 var newtd_c3 = document.createElement("td");
69 newtd_c3.setAttribute("width","20%");
70 newtd_c3.setAttribute("align","center");
71 newtd_c3.appendChild(
72 selection = document.createElement("select"),
73 selection.setAttribute("style", "width=100px"),
74 selection.setAttribute("class","source"),
75 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
76 type:"post",
77 url:"Transaction/source.php",
78 success:function(data)
79 {
80 var obj = $.parseJSON(data);
81 selection.appendChild(
82 option = document.createElement('option'),
83 option.setAttribute('value', 0),
84 option.appendChild(document.createTextNode("---"))
85 );
86 $.each(obj,function(){
87 selection.appendChild(
88 option=document.createElement('option'),
89 option.setAttribute('value',this['fSourceKEY']),
90 option.appendChild(document.createTextNode(this['fSourceName']))
91 )
92 });
93 }
94 }) // End of retrieving
95 );
96 var newtd_c4 = document.createElement("td");
97 newtd_c4.setAttribute("width","50%");
98 newtd_c4.setAttribute("align","center");
99 newtd_c4.appendChild(
100 input_data = document.createElement("input"),
101 input_data.setAttribute("type","text"),
102 input_data.setAttribute("class","selected"),
103 input_data.setAttribute("size","50"),
104 input_data.setAttribute("placeholder","Value")
105 );
106 var newtd_c5 = document.createElement("td");
107 newtd_c5.setAttribute("align","center");
108 newtd_c5.setAttribute("width", "10%");
109 newtd_c5.appendChild(
110 input_data = document.createElement("input"),
111 input_data.setAttribute("type","button"),
112 input_data.setAttribute("value","Delete"),
113 input_data.onclick = function(){ return clearNode(newtr); }
114 );
115
116 newtr.appendChild(newtd_c2);
117 newtr.appendChild(newtd_c3);
118 newtr.appendChild(newtd_c4);
119 newtr.appendChild(newtd_c5);
120
121 $(targetView).after(newtr);
122 }
123<?php
124$cnt=0;
125$pastdate = 'false';
126$day=0;
127if(isset($_GET['days']))
128{
129 $day = $_GET['days'];
130?> addRowClone(); <?php
131}
132else
133{
134 $day =date("Y-m-d");
135}
136if(isset($_GET['prev']))
137{
138 $prevday = $_GET['prev'];
139}
140else
141{
142 $prevday = 'false';
143}
144
145/*$prev = mysql_query("SELECT date(fStart) AS PrevDate FROM schedule WHERE (date(fStart) < '2014-01-26') ORDER BY date(fStart) DESC LIMIT 1");
146$prevnight = mysql_fetch_array($prev);
147 if(mysql_num_rows($prevnight) > 0) {
148 $prevday = date('Y-m-d', $prevnight['PrevDate']);
149 } else {
150 $prevday = date ('Y-m-d');
151 }
152$prevday = date('Y-m-d', strtotime($day .' -1 day'));
153$prev_time = array();*/
154?>
155
156function addRowCloneNew(nextrow){
157 var targetView = document.getElementById("Data");
158targetView.setAttribute("width", "100%");
159 // CREATE ELEMENT
160 // COUNT LIST
161 var list = $(".datalisting").length;
162 var newlist = list+1;
163 var cctr=$('.dataTable tr').length;
164 ctr=cctr+1;
165 var input_data;
166 var select;
167 var option;
168 var selection;
169 var newdiv = document.createElement("div");
170 newdiv.setAttribute("id","list_"+newlist);
171 newdiv.setAttribute("class","datalisting");
172 newdiv.setAttribute("style","margin:5px 0;");
173 newdiv.setAttribute("width", "100%");
174 var newtable = document.createElement("table");
175 newtable.setAttribute("class","dataTable");
176 newtable.setAttribute("width","100%");
177 newtable.setAttribute("border","1");
178 newtable.setAttribute("cellspacing","0");
179 newtable.setAttribute("cellpadding","0");
180 var newInnertable = document.createElement("table");
181 newInnertable.setAttribute("class","dataTable");
182 newInnertable.setAttribute("width","100%");
183 newInnertable.setAttribute("border","1");
184 newInnertable.setAttribute("cellspacing","0");
185 newInnertable.setAttribute("cellpadding","0");
186
187 var newtr = document.createElement("tr");
188 newtr.setAttribute('class','tr');
189 newtr.setAttribute("width", "100%");
190 var newtd_c1 = document.createElement("td");
191 newtd_c1.setAttribute("width","15%");
192 newtd_c1.setAttribute("align","center");
193 newtd_c1.setAttribute("valign", "top");
194 newtd_c1.appendChild(
195 input_data = document.createElement("input"),
196 input_data.setAttribute("type","time"),
197 input_data.setAttribute("class","time"),
198 //input_data.setAttribute("width", "50%"),
199 input_data.setAttribute("size","5"),
200 input_data.setAttribute("autofocus","true")
201 );
202 newtd_c1.appendChild(
203 input_data = document.createElement("input"),
204 input_data.setAttribute("type","button"),
205 input_data.setAttribute("value","+"),
206 input_data.onclick = function(){
207 addRowCloneNew("list_"+newlist);
208 }
209 );
210 var newtd_c2 = document.createElement("td");
211
212 newtd_c2.setAttribute("width","20%");
213 newtd_c2.setAttribute("align","center");
214 newtd_c2.appendChild(
215 select = document.createElement("select"),
216 select.setAttribute("class","measure"),
217 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
218 type:"post",
219 url:"Transaction/measurement.php",
220 success:function(data){
221 var obj=$.parseJSON(data);
222 $.each(obj,function(){
223 select.appendChild(
224 option = document.createElement("option"),
225 option.setAttribute('value',this['fMeasurementKey']),
226 option.appendChild(document.createTextNode(this['fMeasurement']))
227 )
228 })
229
230 }
231 }) // End of retrieving
232
233 );
234 newtd_c2.appendChild(
235 input_data = document.createElement("input"),
236 input_data.setAttribute("type","button"),
237 input_data.setAttribute("value","+"),
238 input_data.onclick = function(){
239 return addRow(newtr);
240 ctr++;
241 });
242 var newtd_c3 = document.createElement("td");
243 newtd_c3.setAttribute("width","20%");
244 newtd_c3.setAttribute("align","center");
245 newtd_c3.appendChild(
246 selection = document.createElement("select"),
247 selection.setAttribute("class","source"),
248 $.ajax({ //Retrieving Measurement name and id in Database september 13,2013 modify by Jaypee Tanio
249 type:"post",
250 url:"Transaction/source.php",
251 success:function(data)
252 {
253 var obj = $.parseJSON(data);
254 selection.appendChild(
255 option = document.createElement('option'),
256 option.setAttribute('value', 0),
257 option.appendChild(document.createTextNode("---"))
258 );
259 $.each(obj,function(){
260 selection.appendChild(
261 option=document.createElement('option'),
262 option.setAttribute('value',this['fSourceKEY']),
263 option.appendChild(document.createTextNode(this['fSourceName']))
264 )
265 });
266 }
267 }) // End of retrieving
268 );
269 var newtd_c4 = document.createElement("td");
270 newtd_c4.setAttribute("width","50%");
271 newtd_c4.setAttribute("align","center");
272 newtd_c4.appendChild(
273 input_data = document.createElement("input"),
274 input_data.setAttribute("type","text"),
275 input_data.setAttribute("class","selected"),
276 //input_data.setAttribute("width", "100%"),
277 input_data.setAttribute("size","50"),
278 input_data.setAttribute("placeholder","Value")
279 );
280 var newtd_c5 = document.createElement("td");
281 newtd_c5.setAttribute("width", "10%");
282 newtd_c5.setAttribute("align","center");
283 newtd_c5.appendChild(
284 input_data = document.createElement("input"),
285 input_data.setAttribute("type","button"),
286 input_data.setAttribute("value","Delete"),
287 input_data.onclick = function(){ return clearNode(newtr);
288 }
289 );
290 newtr.appendChild(newtd_c2);
291 newtr.appendChild(newtd_c3);
292 newtr.appendChild(newtd_c4);
293 newtr.appendChild(newtd_c5);
294 newInnertable.appendChild(newtr);
295 var newtd_c6 = document.createElement("td");
296 newtd_c6.appendChild(newInnertable);
297
298 var newtd_c7 = document.createElement("td");
299 newtd_c7.setAttribute("width", "10%");
300 newtd_c7.setAttribute("align","center");
301 newtd_c7.setAttribute("valign", "top");
302 newtd_c7.appendChild(
303 input_data = document.createElement("input"),
304 input_data.setAttribute("type","button"),
305 input_data.setAttribute("value","Delete Main"),
306 input_data.onclick = function(){ return clearNode(newdiv); }
307 );
308
309 var newOutertr = document.createElement("tr");
310
311 newtable.appendChild(newtd_c1);
312 newtable.appendChild(newtd_c6);
313 newtable.appendChild(newtd_c7);
314
315 newdiv.appendChild(newtable);
316 if(nextrow != null){
317 var doc = document.getElementById(nextrow);
318 $(doc).after(newdiv);
319 }else{
320 targetView.appendChild(newdiv);
321 }
322}
323
324function addRowClone(nextrow){
325<?php
326$fetch = mysql_query("SELECT * FROM schedule WHERE date(fStart) = '$day' ORDER BY fScheduleID ASC, fMeasurementID ASC") or die(mysql_error());
327$observationsTime = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE date(fStart) = '$day' ORDER BY fScheduleID ASC");
328$cnt3=0;
329$cnt2=0;
330$cnt4 = 0;
331$cnt5 = 0;
332$cnt = 0;
333$cntrow = 0;
334$pastdate = 'false';
335$pasttime = 'true';
336date_default_timezone_set("UTC");
337 while($times = mysql_fetch_array($observationsTime))
338 {
339 $timestamp=strtotime($times['fStart']);
340 $testdate = date('Y-m-d H:i:s', $times['fStart']);
341 $testing = date('Y-m-d H:i', $timestamp);
342 $curSchedId = $times['fScheduleID'];
343 $actualtime = date('Y-m-d H:i:s', $timestamp);
344
345 if($prevday == 'false') {
346 if(strtotime(date('Y-m-d H:i', $timestamp)) < strtotime(date('Y-m-d H:i', time()))) {
347 $pastdate = 'true';
348 }
349 else {
350 $pastdate = 'false';
351 }
352 }
353
354
355 if(strtotime(date('Y-m-d', $timestamp)) == strtotime(date('Y-m-d', time()))) {
356 $fetch_next = mysql_query("SELECT DISTINCT fStart FROM schedule WHERE (fStart > '$testing' AND date(fStart) = '$day') ORDER BY fScheduleID ASC LIMIT 1");
357 $next_data = mysql_fetch_array($fetch_next);
358 if ($pasttime == 'true') {
359 if (mysql_num_rows($fetch_next) > 0) {
360 $next_date = strtotime($next_data['fStart']);
361 $test = date('H:i', $next_date);
362 if(strtotime(date('H:i', $next_date)) < strtotime(date('H:i', time()))) {
363 $pasttime = 'true';
364 } else {
365 $pasttime = 'false';
366 }
367 } else {
368 $pasttime = 'false';
369 }
370 }
371 if((strtotime(date('Hi', $timestamp)) >= strtotime('0000')) && (strtotime(date('Hi', $timestamp)) <= strtotime('0800'))) {
372 $pastdate = 'false';
373 }
374 }
375 else if(strtotime(date('Y-m-d', $timestamp)) < strtotime(date('Y-m-d', time()))) {
376 $pasttime = 'true';
377 $pastdate = 'true';
378 } else {
379 $pasttime = 'false';
380 $pastdate = 'false';
381 }
382
383 if($prevday == 'true') {
384 $pastdate = 'false';
385 $pasttime = 'false';
386 }
387 $date_time = date('H:i', $timestamp);
388 $prev_time[$cnt3]= $date_time;
389
390 ?>
391 $('#save').attr('value','UPDATE');
392 var targetView = document.getElementById("Data");
393 // CREATE ELEMENT
394 // COUNT LIST
395 var list = $(".datalisting").length;
396 var newlist = list+1;
397 <?php $cnt++;?>
398
399 var cctr=$('.dataTable tr').length;
400 ctr=cctr+1;
401 var select;
402 var input_data;
403 var option;
404 var selection;
405
406 var newdiv<?php echo $cnt; ?> = document.createElement("div");
407 newdiv<?php echo $cnt; ?>.setAttribute("id", "list_<?php echo $cnt; ?>");
408 newdiv<?php echo $cnt; ?>.setAttribute("class","datalisting");
409 newdiv<?php echo $cnt; ?>.setAttribute("style","margin:5px 0;");
410
411 var newtable = document.createElement("table");
412 newtable.setAttribute("class","dataTable");
413 newtable.setAttribute("width","100%");
414 newtable.setAttribute("border","1");
415 newtable.setAttribute("cellspacing","0");
416 newtable.setAttribute("cellpadding","0");
417
418
419 var newInnertable = document.createElement("table");
420 newInnertable.setAttribute("class","dataTable");
421 newInnertable.setAttribute("width","100%");
422 newInnertable.setAttribute("border","1");
423
424 newInnertable.setAttribute("cellspacing","0");
425 newInnertable.setAttribute("cellpadding","0");
426
427 var newtd_c1 = document.createElement("td");
428 newtd_c1.setAttribute("width","15%");
429 newtd_c1.setAttribute("align","center");
430 newtd_c1.setAttribute("valign", "top");
431 <?php if ($pastdate == 'true') { ?>
432 newtd_c1.appendChild(
433 input_data = document.createElement("input"),
434 input_data.setAttribute("type","time"),
435 input_data.setAttribute("class","time"),
436 input_data.setAttribute("size","5"),
437 input_data.setAttribute("value","<?php echo $date_time; ?>"),
438 input_data.setAttribute("autofocus","true"),
439 input_data.setAttribute("disabled", "disabled")
440 );
441 <?php } else { ?>
442 newtd_c1.appendChild(
443 input_data = document.createElement("input"),
444 input_data.setAttribute("type","time"),
445 input_data.setAttribute("class","time"),
446 input_data.setAttribute("size","5"),
447 input_data.setAttribute("value","<?php echo $date_time; ?>"),
448 input_data.setAttribute("autofocus","true")
449 );
450 <?php }
451 if($pasttime == 'true') { ?>
452 newtd_c1.appendChild(
453 input_data = document.createElement("input"),
454 input_data.setAttribute("type","button"),
455 input_data.setAttribute("value","+"),
456 input_data.setAttribute("disabled", "disabled"),
457 input_data.onclick = function(){
458 addRowCloneNew("list_<?php echo $cnt; ?>");
459 }
460 );
461 <?php } else { /*if ($pastdate == 'true') { ?>
462 newtd_c1.appendChild(
463 input_data = document.createElement("input"),
464 input_data.setAttribute("type","button"),
465 input_data.setAttribute("value","+"),
466 input_data.setAttribute("disabled", "disabled"),
467 input_data.onclick = function(){
468 addRowCloneNew("list_<?php echo $cnt; ?>");
469 }
470 );
471 <?php } else { ?>*/ ?>
472 newtd_c1.appendChild(
473 input_data = document.createElement("input"),
474 input_data.setAttribute("type","button"),
475 input_data.setAttribute("value","+"),
476 input_data.onclick = function(){
477 addRowCloneNew("list_<?php echo $cnt; ?>");
478 }
479 );
480 <?php }
481 $observations = mysql_query("SELECT * FROM schedule WHERE fStart = '$actualtime'");
482
483 while($rows = mysql_fetch_array($observations))
484 {
485 $cntrow++;
486 ?>
487
488 var newtr<?php echo $cntrow; ?> = document.createElement("tr");
489 newtr<?php echo $cntrow; ?>.setAttribute('class','tr');
490
491 <?php if ($pastdate == 'true') { ?>
492 var newtd_c2 = document.createElement("td");
493 newtd_c2.setAttribute("width","20%");
494 newtd_c2.setAttribute("align","center");
495 <?php
496 $cur_measurement = $rows[fMeasurementTypeKey];
497 $selectm = mysql_query("SELECT * FROM measurement WHERE fMeasurementKey = '$cur_measurement'");
498 $rowmeasure = mysql_fetch_array($selectm);
499 ?>
500 newtd_c2.appendChild(
501 selection = document.createElement("select"),
502 selection.appendChild(
503 option = document.createElement("option"),
504 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>")),
505 option.setAttribute("value", "<?php echo $rowmeasure['fMeasurementKey']; ?>"),
506 option.setAttribute('selected', true)
507 ),
508 selection.setAttribute('id', 'measure'),
509 selection.setAttribute('class','measure'),
510 selection.setAttribute('disabled', 'disabled'),
511 selection.setAttribute("style", "width:100px")
512 );
513 newtd_c2.appendChild(
514 input_data = document.createElement("input"),
515 input_data.setAttribute("type","button"),
516 input_data.setAttribute("value","+"),
517 input_data.setAttribute("disabled", "disabled"),
518 input_data.onclick = function(){
519 return addRow(newtr<?php echo $cntrow; ?>);
520 ctr++;
521 });
522
523 var newtd_c3 = document.createElement("td");
524 newtd_c3.setAttribute("width","20%");
525 newtd_c3.setAttribute("align","center");
526 <?php
527 $cur_source = $rows['fSourceKey'];
528 $select = mysql_query("SELECT * FROM source WHERE fSourceKey = '$cur_source'");
529 if(mysql_num_rows($select)<1) {
530 $sourcename = '---';
531 $sourcekey = 0;
532 }
533 else {
534 $rowsource = mysql_fetch_array($select);
535 $sourcename = $rowsource['fSourceName'];
536 $sourcekey = $rowsource['fSourceKey'];
537 }?>
538 newtd_c3.appendChild(
539 selection = document.createElement("select"),
540 selection.appendChild(
541 option = document.createElement("option"),
542 option.appendChild(document.createTextNode("<?php echo $sourcename; ?>")),
543 option.setAttribute("value", "<?php echo $sourcekey; ?>"),
544 option.setAttribute('selected', true)
545 ),
546 selection.setAttribute('id', 'source'),
547 selection.setAttribute('class','source'),
548 selection.setAttribute('disabled', 'disabled'),
549 selection.setAttribute("style", "width:120px")
550
551 );
552
553 var newtd_c4 = document.createElement("td");
554 newtd_c4.setAttribute("width","50%");
555 newtd_c4.setAttribute("align","center");
556 newtd_c4.appendChild(
557 input_data = document.createElement("input"),
558 input_data.setAttribute("type","text"),
559 input_data.setAttribute("class","selected"),
560 input_data.setAttribute("size","50"),
561 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),
562 input_data.setAttribute("placeholder","Value"),
563 input_data.setAttribute("disabled", "disabled")
564 );
565
566 var newtd_c5 = document.createElement("td");
567 newtd_c5.setAttribute("width", "10%");
568 newtd_c5.setAttribute("align","center");
569 newtd_c5.appendChild(
570 input_data = document.createElement("input"),
571 input_data.setAttribute("type","button"),
572 input_data.setAttribute("value","Delete"),
573 input_data.setAttribute("disabled", "disabled"),
574 input_data.onclick = function(){
575 return clearNode(newtr<?php echo $cntrow; ?>);
576 }
577 );
578 <?php } else { ?>
579 var newtd_c2 = document.createElement("td");
580 newtd_c2.setAttribute("width","20%");
581 newtd_c2.setAttribute("align","center");
582 newtd_c2.appendChild(
583 selection = document.createElement("select"),
584 <?php
585 $selectm = mysql_query("SELECT * FROM measurement");
586 while($rowmeasure = mysql_fetch_array($selectm))
587 {
588 ?>
589 selection.appendChild(
590 option = document.createElement("option"),
591 option.setAttribute("value","<?php echo $rowmeasure['fMeasurementKey']; ?>"),
592 <?php if($rows['fMeasurementTypeKey']==$rowmeasure['fMeasurementKey']){ echo "option.setAttribute('selected',true),";} ?>
593 option.appendChild(document.createTextNode("<?php echo $rowmeasure['fMeasurement']; ?>"))
594 ),
595 <?php
596 }
597 ?>
598 selection.setAttribute('id','measure'),
599 selection.setAttribute('class','measure'),
600 selection.setAttribute("style", "width=100px")
601 );
602 newtd_c2.appendChild(
603 input_data = document.createElement("input"),
604 input_data.setAttribute("type","button"),
605 input_data.setAttribute("value","+"),
606 input_data.onclick = function(){
607 return addRow(newtr<?php echo $cntrow; ?>);
608 ctr++;
609 });
610
611 var newtd_c3 = document.createElement("td");
612 newtd_c3.setAttribute("width","20%");
613 newtd_c3.setAttribute("align","center");
614 newtd_c3.appendChild(
615 selection = document.createElement("select"),
616 selection.appendChild(
617 option = document.createElement("option"),
618 option.setAttribute('value', 0),
619 <?php
620 if($rows['fSourceKey'] == 0) { echo "option.setAttribute('selected', true),"; }?>
621 option.appendChild(document.createTextNode("---"))),
622 <?php
623 $select = mysql_query("SELECT * FROM source");
624
625 while($rowsource = mysql_fetch_array($select))
626 {
627 ?>
628 selection.appendChild(
629 option = document.createElement("option"),
630 option.setAttribute('value','<?php echo $rowsource['fSourceKEY']; ?>'),
631 <?php if($rows['fSourceKey'] == $rowsource['fSourceKEY']){
632 echo "option.setAttribute('selected',true),";
633 }?>
634 option.appendChild(document.createTextNode("<?php echo $rowsource['fSourceName']; ?>"))
635 ),
636 <?php
637 }
638 ?>
639 selection.setAttribute('id','source'), // End of retrieving
640 selection.setAttribute('class','source'),
641 selection.setAttribute("style", "width=100px")// End of retrieving
642 );
643
644 var newtd_c4 = document.createElement("td");
645 newtd_c4.setAttribute("width","50%");
646 newtd_c4.setAttribute("align","center");
647 newtd_c4.appendChild(
648 input_data = document.createElement("input"),
649 input_data.setAttribute("type","text"),
650 input_data.setAttribute("class","selected"),
651 input_data.setAttribute("size","50"),
652 input_data.setAttribute("value","<?php echo $rows['fData']; ?>"),
653 input_data.setAttribute("placeholder","Value")
654 );
655
656 var newtd_c5 = document.createElement("td");
657 newtd_c5.setAttribute("width", "10%");
658 newtd_c5.setAttribute("align","center");
659 newtd_c5.appendChild(
660 input_data = document.createElement("input"),
661 input_data.setAttribute("type","button"),
662 input_data.setAttribute("value","Delete"),
663 input_data.onclick = function(){ return clearNode(newtr<?php echo $cntrow; ?>);
664
665 }
666 );
667 <?php } ?>
668 newtr<?php echo $cntrow; ?>.appendChild(newtd_c2);
669 newtr<?php echo $cntrow; ?>.appendChild(newtd_c3);
670 newtr<?php echo $cntrow; ?>.appendChild(newtd_c4);
671 newtr<?php echo $cntrow; ?>.appendChild(newtd_c5);
672 newInnertable.appendChild(newtr<?php echo $cntrow; ?>);
673
674 <?php
675
676 $prevtimestamp = $timestamp;
677 }
678 ?>
679
680 var newtd_c6 = document.createElement("td");
681 newtd_c6.appendChild(newInnertable);
682
683 var newtd_c7 = document.createElement("td");
684 newtd_c7.setAttribute("width", "10%");
685 newtd_c7.setAttribute("align","center");
686 newtd_c7.setAttribute("valign", "top");
687 <?php if ($pastdate == 'true') { ?>
688 newtd_c7.appendChild(
689 input_data = document.createElement("input"),
690 input_data.setAttribute("type","button"),
691 input_data.setAttribute("value","Delete Main"),
692 input_data.setAttribute("disabled", "disabled"),
693 input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
694 );
695 <?php } else { ?>
696 newtd_c7.appendChild(
697 input_data = document.createElement("input"),
698 input_data.setAttribute("type","button"),
699 input_data.setAttribute("value","Delete Main"),
700 input_data.onclick = function(){ return clearNode(newdiv<?php echo $cnt; ?>); }
701 );
702 <?php } ?>
703
704 var newOutertr = document.createElement("tr");
705
706 newtable.appendChild(newtd_c1);
707 newtable.appendChild(newtd_c6);
708 newtable.appendChild(newtd_c7);
709
710 newdiv<?php echo $cnt; ?>.appendChild(newtable);
711 if(nextrow != null){
712 var doc = document.getElementById(nextrow);
713 $(doc).after(newdiv<?php echo $cnt;?>);
714 }else{
715 targetView.appendChild(newdiv<?php echo $cnt;?>);
716 }
717 <?php
718}
719if(mysql_num_rows($fetch)<1)
720{
721 if(strtotime(Date('Y-m-d', strtotime($day))) >= strtotime(Date('Y-m-d'))) {
722?>
723 $('#save').attr('value','SAVE');
724 addRowCloneNew();
725 $('#LoadPrev').removeAttr("disabled");
726 $('#save').removeAttr("disabled");
727<?php
728 }
729 else {?>
730 $('#LoadPrev').attr('disabled', 'disabled');
731 $('#save').attr('disabled', 'disabled');
732<?php }
733}
734?>
735}
736</script>
737
Note: See TracBrowser for help on using the repository browser.