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

71 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2014-05-23 07:41:52 +00:00
<?php
//含沙量
//Sediment Concentration
namespace Westdc\Visual\Reader;
use Westdc\Visual\Record;
use Westdc\Visual\RecordInterface;
class Sc2009 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_sands2009
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;
}
}