From b9a9e44746849ebd9346ad2e73a33b70aedd66f6 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Sun, 25 May 2014 02:18:41 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=B3=A8=E9=87=8A=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Westdc/Visual/Reader/SoilMoisture.php | 161 +++++++++--------- 1 file changed, 80 insertions(+), 81 deletions(-) diff --git a/application/module/Westdc/Visual/Reader/SoilMoisture.php b/application/module/Westdc/Visual/Reader/SoilMoisture.php index bd63fe3e..0b363a0e 100644 --- a/application/module/Westdc/Visual/Reader/SoilMoisture.php +++ b/application/module/Westdc/Visual/Reader/SoilMoisture.php @@ -1,82 +1,81 @@ -subset)) - { - $this->subset = "20cm"; - return; - } - - switch($this->subset){ - case "10cm": - $this->subset = "vwc_avg10"; - break; - case "20cm" : - $this->subset = "vwc_avg20"; - break; - case "30cm" : - $this->subset = "vwc_avg30"; - break; - case "40cm" : - $this->subset = "vwc_avg40"; - break; - case "50cm" : - $this->subset = "vwc_avg50"; - break; - } - - return; - } - - public function getData() - { - $this->switchDataset(); - - $sql = "SELECT * FROM data_watercontent - WHERE - $this->subset > 0 - ORDER BY - extract(year from \"timestamp\") ASC, - extract(month from \"timestamp\") ASC, - extract(day from \"timestamp\") ASC, - extract(hour from \"timestamp\") ASC - "; - //exit($sql); - $rs = $this->db->query($sql); - return $rs; - - } - - public function outPut() - { - - $rs = $this->getData(); - - $data = array(); - - while($row = $rs->fetch()) - { - $row['utctime'] = $this->utcMsTime(strtotime($row['timestamp'])); - $data[] = array($row['utctime'],$row[$this->subset]); - } - - return $data; - } - +subset)) + { + $this->subset = "20cm"; + return; + } + + switch($this->subset){ + case "10cm": + $this->subset = "vwc_avg10"; + break; + case "20cm" : + $this->subset = "vwc_avg20"; + break; + case "30cm" : + $this->subset = "vwc_avg30"; + break; + case "40cm" : + $this->subset = "vwc_avg40"; + break; + case "50cm" : + $this->subset = "vwc_avg50"; + break; + } + + return; + } + + public function getData() + { + $this->switchDataset(); + + $sql = "SELECT * FROM data_watercontent + WHERE + $this->subset > 0 + ORDER BY + extract(year from \"timestamp\") ASC, + extract(month from \"timestamp\") ASC, + extract(day from \"timestamp\") ASC, + extract(hour from \"timestamp\") ASC + "; + //exit($sql); + $rs = $this->db->query($sql); + return $rs; + + } + + public function outPut() + { + + $rs = $this->getData(); + + $data = array(); + + while($row = $rs->fetch()) + { + $row['utctime'] = $this->utcMsTime(strtotime($row['timestamp'])); + $data[] = array($row['utctime'],$row[$this->subset]); + } + + return $data; + } + } \ No newline at end of file