source: schedule/function/function.php@ 15964

Last change on this file since 15964 was 15809, checked in by tanio, 12 years ago
File size: 1.5 KB
Line 
1 <script type="text/javascript">
2
3 <?php
4 if($_GET['day'] || $_GET['month'] || $_GET['year']){
5
6 ?>
7
8 var day = <?php echo $_GET['day']; ?>
9 var month = <?php echo $_GET['month']; ?>
10 var year = <?php echo $_GET['year']; ?>
11 var fullday=day+'-'+month+'-'+year;
12
13
14
15 <?php
16
17
18 }else{
19
20 ?>
21
22 $(document).ready(function(){
23 var currentDate = new Date();
24 var day = currentDate.getDate();
25 var month = currentDate.getMonth() + 1;
26 var year = currentDate.getFullYear();
27 var fullday=day+'-'+month+'-'+year;
28 <?php } ?>
29 <?php
30
31
32
33 $cntsource=mysql_query("SELECT COUNT(*) as `SourceID` FROM source");
34 $rowcnt=mysql_fetch_array($cntsource);
35 $Total= $rowcnt['SourceID'];
36 ?>
37 $('#save').click(function(){
38 var InputValue = [];
39 var selectedSource = [];
40 var selectedTime = [];
41 var selectedMeasurement = [];
42 var Time;
43 var Source;
44 var measure;
45 var value;
46 for(var i=1;i<<?php echo $Total; ?>;i++)
47 {
48 if($('#Time'+i).val()||$('#Time'+i).val()>0)
49 {
50 Time=$('#Time'+i).val();
51 Source=$('select[id="source'+i+'"]').val();
52 measure=$('select[id="measurement'+i+'"]').val();
53 value=$('#txtData'+i).val();
54 selectedMeasurement.push(measure);
55 selectedSource.push(Source);
56 selectedTime.push(Time);
57 InputValue.push(value);
58 }
59 }
60 window.location = 'Transaction/insert.php?Time='+selectedTime+'&Source='+selectedSource+'&measure='+selectedMeasurement+'&Data='+InputValue+'&Date='+fullday;
61 });
62
63 });
64 </script>
Note: See TracBrowser for help on using the repository browser.