85 lines
3.0 KiB
PHP
85 lines
3.0 KiB
PHP
<?php
|
|
class HaiheController extends DataController
|
|
{
|
|
private $limit=20;
|
|
|
|
function preDispatch()
|
|
{
|
|
parent::preDispatch();
|
|
$this->debug = 1;
|
|
$acName = $this->_request->getActionName();
|
|
$this->view->pageID = "haihe-".$acName;
|
|
//$this->_helper->layout->setLayout('heihe');
|
|
}
|
|
|
|
function indexAction()
|
|
{
|
|
$archive = new Archive($this->db);
|
|
$this->view->info = $archive->getOneArchive('海河流域多尺度地表通量与气象要素观测数据集','about');
|
|
}
|
|
|
|
function documentAction()
|
|
{
|
|
$page=(int)$this->_request->getParam('page');
|
|
if (empty($page)) $page=1;
|
|
$offset=$this->limit*($page-1);
|
|
$row=$this->db->fetchAll("select count(*) from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') ))");
|
|
$sum=$row[0]['count'];
|
|
$sql="select * from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') )) order by reference limit ? offset ?";
|
|
$this->view->refs=$this->db->fetchAll($sql,array($this->limit,$offset));
|
|
$this->view->page=new Pagination($sum,$page,$this->limit,"文献");
|
|
$this->view->offset=$offset+1;
|
|
}
|
|
|
|
function daxingAction()
|
|
{
|
|
$this->getmd(array('大兴区'),'place');
|
|
$this->_helper->viewRenderer('base');
|
|
}
|
|
|
|
function miyunAction()
|
|
{
|
|
$this->getmd(array('密云'),'place');
|
|
$this->_helper->viewRenderer('base');
|
|
}
|
|
|
|
function guantaoAction()
|
|
{
|
|
$this->getmd(array('馆陶县'),'place');
|
|
$this->_helper->viewRenderer('base');
|
|
}
|
|
|
|
function viewAction()
|
|
{
|
|
parent::viewAction();
|
|
$this->_helper->viewRenderer('haihe/view');
|
|
}
|
|
|
|
private function getmd($keyword,$type='theme')
|
|
{
|
|
$page=(int)$this->_request->getParam('page');
|
|
if (empty($page)) $page=1;
|
|
$offset=$this->limit*($page-1);
|
|
if (!is_array($keyword))
|
|
{
|
|
$keyword=array($keyword);
|
|
}
|
|
$key="(";
|
|
foreach($keyword as $k)
|
|
{
|
|
$key.="'".$k."',";
|
|
}
|
|
$key=substr($key,0,-1);
|
|
$key.=")";
|
|
$keyword=$key;
|
|
|
|
$state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='haihe' and m.id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.")");
|
|
$row=$state->fetchAll();
|
|
$sum=$row[0]['count'];
|
|
//@todo: add order with title
|
|
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='haihe') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by title limit ? offset ?";
|
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
|
$this->view->offset=$offset+1;
|
|
}
|
|
} |