westdc-zf1/application/default/controllers/HaiheController.php

39 lines
1.5 KiB
PHP
Raw Normal View History

2014-01-09 14:25:27 +00:00
<?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 viewAction()
{
parent::viewAction();
$this->_helper->viewRenderer('haihe/view');
}
}