From ed6d450d4a013187bc979375e60667a678f5fc35 Mon Sep 17 00:00:00 2001 From: wlx Date: Tue, 14 Jan 2014 02:16:49 +0000 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E4=B8=BA=E5=88=86=E6=A0=8F?= =?UTF-8?q?=E7=9B=AE=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../default/controllers/HaiheController.php | 60 ++++++++++++++++--- .../default/views/scripts/haihe/base.phtml | 30 ++++++++++ .../views/scripts/haihe/document.phtml | 5 +- .../default/views/scripts/haihe/index.phtml | 6 +- .../default/views/scripts/haihe/navi.phtml | 38 ++++++++++++ 5 files changed, 130 insertions(+), 9 deletions(-) create mode 100644 application/default/views/scripts/haihe/base.phtml create mode 100644 application/default/views/scripts/haihe/navi.phtml 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'=>'海河流域观测数据集'); +?> +render('breadcrumbs.phtml'); ?> +
+
+ partial('haihe/navi.phtml'); ?> +
+
+ info) : ?> +
+ info['body'])) echo $this->info['body'];?> +
+ + metadata) : ?> + page->getNavigation(); ?> +
+
    + metadata as $md) : ?> +
  1. + +
+
+ +
+
\ No newline at end of file diff --git a/application/default/views/scripts/haihe/document.phtml b/application/default/views/scripts/haihe/document.phtml index 643f3411..370b05ff 100644 --- a/application/default/views/scripts/haihe/document.phtml +++ b/application/default/views/scripts/haihe/document.phtml @@ -10,8 +10,11 @@ $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集'); ?> render('breadcrumbs.phtml'); ?>
-
+
+ partial('haihe/navi.phtml'); ?> +
+

数据相关文献

refs) : ?> page->getNavigation(); ?> diff --git a/application/default/views/scripts/haihe/index.phtml b/application/default/views/scripts/haihe/index.phtml index 47590f84..11407b57 100644 --- a/application/default/views/scripts/haihe/index.phtml +++ b/application/default/views/scripts/haihe/index.phtml @@ -7,7 +7,11 @@ $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集'); ?> render('breadcrumbs.phtml'); ?>
-
+
+ partial('haihe/navi.phtml'); ?> +
+ +

info['title'])) echo $this->info['title']; ?>

diff --git a/application/default/views/scripts/haihe/navi.phtml b/application/default/views/scripts/haihe/navi.phtml new file mode 100644 index 00000000..ad49c1a3 --- /dev/null +++ b/application/default/views/scripts/haihe/navi.phtml @@ -0,0 +1,38 @@ + \ No newline at end of file