diff --git a/application/default/controllers/HaiheController.php b/application/default/controllers/HaiheController.php index 106b6287..d1aed6a2 100644 --- a/application/default/controllers/HaiheController.php +++ b/application/default/controllers/HaiheController.php @@ -20,20 +20,66 @@ class HaiheController extends DataController 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']; + $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; + $this->view->page=new Pagination($sum,$page,$this->limit,"文献"); + $this->view->offset=$offset+1; + } + + function daxingAction() + { + $this->getmd(array('大兴区')); + $this->_helper->viewRenderer('base'); } + function miyunAction() + { + $this->getmd(array('密云')); + $this->_helper->viewRenderer('base'); + } + + function guantaoAction() + { + $this->getmd(array('馆陶县')); + $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; + } } \ No newline at end of file diff --git a/application/default/views/scripts/haihe/base.phtml b/application/default/views/scripts/haihe/base.phtml new file mode 100644 index 00000000..4c53ca20 --- /dev/null +++ b/application/default/views/scripts/haihe/base.phtml @@ -0,0 +1,30 @@ +headTitle($this->config->title->site); +$this->headTitle($this->config->title->data); +$this->headTitle()->setSeparator(' - '); +$this->headLink()->appendStylesheet('/css/water.css'); +$this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集'); +?> += $this->render('breadcrumbs.phtml'); ?> +