2014-06-11 08:12:05 +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__);
|
|
|
|
}
|
|
|
|
|
|
|
|
public $subset;
|
|
|
|
|
|
|
|
public function switchDataset()
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getData()
|
|
|
|
{
|
|
|
|
$sql = "SELECT * FROM data_sands
|
|
|
|
ORDER BY
|
|
|
|
year ASC,
|
|
|
|
month ASC
|
|
|
|
";
|
|
|
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
return $rs;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
public function outPut()
|
|
|
|
{
|
|
|
|
$this->switchDataset();
|
|
|
|
|
|
|
|
$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
|
|
|
}
|