westdc-zf1/application/module/Westdc/Visual/Reader/Sc.php

71 lines
1.1 KiB
PHP
Raw Normal View History

2014-05-12 06:53:21 +00:00
<?php
//含沙量
//Sediment Concentration
namespace Westdc\Visual\Reader;
use Westdc\Visual\Record;
use Westdc\Visual\RecordInterface;
class Sc extends Record implements RecordInterface
{
function __construct()
{
parent::__construct(__CLASS__);
}
2014-05-21 09:26:15 +00:00
public $subset;
public function switchDataset()
2014-05-12 06:53:21 +00:00
{
2014-05-21 09:26:15 +00:00
if(empty($this->subset))
{
$this->subset = "avg_sand";
return;
}
switch($this->subset){
case "avg":
$this->subset = "avg_sand";
break;
case "max" :
$this->subset = "max_sand";
break;
case "min" :
$this->subset = "min_sand";
break;
}
2014-05-12 06:53:21 +00:00
2014-05-21 09:26:15 +00:00
return;
2014-05-12 06:53:21 +00:00
}
2014-05-21 09:57:28 +00:00
public function getData()
{
$sql = "SELECT * FROM data_sands
2014-05-21 09:57:28 +00:00
ORDER BY
year ASC,
month ASC
";
$rs = $this->db->query($sql);
return $rs;
}
2014-05-21 09:26:15 +00:00
public function outPut()
2014-05-12 06:53:21 +00:00
{
2014-05-21 09:26:15 +00:00
$this->switchDataset();
2014-05-12 06:53:21 +00:00
2014-05-21 09:26:15 +00:00
$rs = $this->getData();
$data = array();
while($row = $rs->fetch())
{
$row['utctime'] = $this->utcMsTime(mktime(0,0,0,$row['month'],0,$row['year']));
$data[] = array($row['utctime'],$row[$this->subset]);
}
return $data;
2014-05-12 06:53:21 +00:00
}
2014-05-21 09:26:15 +00:00
2014-05-12 06:53:21 +00:00
}