From c1f5c7de566b5d4dd7006d5685dbe8ec07255330 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Mon, 28 Oct 2013 09:45:48 +0000 Subject: [PATCH] =?UTF-8?q?#558=20=E5=A2=9E=E5=8A=A0=E4=BA=86=E4=BB=8E?= =?UTF-8?q?=E8=A1=A8=E4=B8=AD=E8=AF=BB=E5=8F=96=E4=BF=A1=E6=81=AF=E7=9A=84?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controllers/KnowledgeController.php | 120 +++++++++--------- .../default/controllers/ServiceController.php | 18 +++ .../views/scripts/knowledge/paper.phtml | 114 +++++++++++------ 3 files changed, 152 insertions(+), 100 deletions(-) diff --git a/application/default/controllers/KnowledgeController.php b/application/default/controllers/KnowledgeController.php index 3ad91082..dd6baa2e 100755 --- a/application/default/controllers/KnowledgeController.php +++ b/application/default/controllers/KnowledgeController.php @@ -1,17 +1,17 @@ -db=Zend_Registry::get('db'); - $this->view->config = Zend_Registry::get('config'); - $this->messenger=$this->_helper->getHelper('FlashMessenger'); - $this->view->messages = $this->messenger->getMessages(); - $this->view->theme=new Theme(); - } +db=Zend_Registry::get('db'); + $this->view->config = Zend_Registry::get('config'); + $this->messenger=$this->_helper->getHelper('FlashMessenger'); + $this->view->messages = $this->messenger->getMessages(); + $this->view->theme=new Theme(); + } function datacenterAction() { $siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk @@ -24,8 +24,8 @@ class KnowledgeController extends Zend_Controller_Action $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } + $this->view->paginator=$paginator; + } function userAction() { $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by id desc"; @@ -37,8 +37,8 @@ class KnowledgeController extends Zend_Controller_Action $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } + $this->view->paginator=$paginator; + } function authorAction() { $sql="select * from reference where id in (select refid from mdref where reftype=0 and uuid in (select uuid from normalmetadata)) order by id desc"; @@ -50,12 +50,12 @@ class KnowledgeController extends Zend_Controller_Action $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } - - function westplanAction() - { - $sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc"; + $this->view->paginator=$paginator; + } + + function westplanAction() + { + $sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc"; $sth = $this->db->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); @@ -64,11 +64,11 @@ class KnowledgeController extends Zend_Controller_Action $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } - function searchAction() - { - $key=$this->_request->getParam('q'); + $this->view->paginator=$paginator; + } + function searchAction() + { + $key=$this->_request->getParam('q'); $source=$this->_request->getParam('searchsource'); if(preg_match("/\"|'|<|>/",$key)) { @@ -89,7 +89,7 @@ class KnowledgeController extends Zend_Controller_Action if (!empty($key) && $source=='datasource') { $search=new SimpleSearch($key); $where=$search->sql_expr(array("reference")); - $sql="select * from reference where ".$where." order by id desc"; + $sql="select * from reference where ".$where." order by id desc"; $sth = $this->db->prepare($sql); $sth->execute(); $rows = $sth->fetchAll(); @@ -98,14 +98,14 @@ class KnowledgeController extends Zend_Controller_Action $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - $this->view->key=$key; - $this->view->source=$source; + $this->view->paginator=$paginator; + $this->view->key=$key; + $this->view->source=$source; $this->_helper->viewRenderer('search-data'); - } - else if (!empty($key) && $source=='westsource') { + } + else if (!empty($key) && $source=='westsource') { $search=new SimpleSearch($key); - $where=$search->sql_expr(array("c.title","a.author")); + $where=$search->sql_expr(array("c.title","a.author")); $sql="select distinct a.author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 and $where order by ts_created desc"; $sth = $this->db->prepare($sql); $sth->execute(); @@ -115,28 +115,28 @@ class KnowledgeController extends Zend_Controller_Action $paginator->setItemCountPerPage(10); $paginator->setView($this->view); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - $this->view->key=$key; - $this->view->source=$source; - //$this->_helper->viewRenderer('search-data'); - } - } - function paperAction() - { - $id = (int)$this->_request->getParam('id'); - $sql="select * from reference where id=$id"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $this->view->paper = $sth->fetch(); - - $sql="select * from ref_author where id=$id order by place"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $this->view->author = $sth->fetchAll(); - - $sql="select * from ref_tag where id=$id"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $this->view->tag = $sth->fetchAll(); - } + $this->view->paginator=$paginator; + $this->view->key=$key; + $this->view->source=$source; + //$this->_helper->viewRenderer('search-data'); + } + } + function paperAction() + { + $id = (int)$this->_request->getParam('id'); + $sql="select * from reference where id=$id"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $this->view->paper = $sth->fetch(); + + $sql="select * from ref_author where id=$id order by place"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $this->view->author = $sth->fetchAll(); + + $sql="select * from ref_tag where id=$id"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $this->view->tag = $sth->fetchAll(); + } } \ No newline at end of file diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index 446dd0a6..8d2c5af4 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -1453,6 +1453,24 @@ class ServiceController extends Zend_Controller_Action echo ''; echo $pagnation; }//文档页面相关数据 + + function refdatacountAction() + { + if(view::isXmlHttpRequest($this)) + { + $id = (int)$this->_getParam('id'); + if($id < 1){ + echo 0; + return; + } + $sql = "select count(md.id) as total from mdref mr + right join normalmetadata md on md.uuid=mr.uuid + where mr.refid=$id"; + $rs = $this->db->query($sql); + $row = $rs->fetch(); + echo $row['total']; + } + } function tagdatalistAction(){ diff --git a/application/default/views/scripts/knowledge/paper.phtml b/application/default/views/scripts/knowledge/paper.phtml index fe82d450..a0fa71e8 100644 --- a/application/default/views/scripts/knowledge/paper.phtml +++ b/application/default/views/scripts/knowledge/paper.phtml @@ -6,7 +6,7 @@ $this->headLink()->appendStylesheet('/css/mdreview.css'); $this->breadcrumb('首页'); $this->breadcrumb('知识积累'); $this->breadcrumb('文章查看'); -$this->breadcrumb()->setSeparator(' > '); +$this->breadcrumb()->setSeparator(' > '); $this->headScript()->appendFile('/js/jquery.colorbox-min.js'); $this->headLink()->appendStylesheet('/css/colorbox.css'); ?> @@ -16,48 +16,71 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
-

paper['title']; ?>

-
    - author as $a) : ?> -
  • - -
- paper['abstract']) : ?> - 摘要: - paper['abstract']; endif; if ($this->tag) : ?> - 关键词: -
    - tag as $t) : ?> -
  • - -
- - - paper['reference']; ?> - + paper['title'])){ ?> +

paper['title']; ?>

+
+ + author) > 0) {?> +

作者

+
    + author as $a) : ?> +
  • + +
+
+ + + paper['abstract']){ ?> +

摘要

+

paper['abstract']; ?>

+
+ + + tag) > 0) { ?> +

关键词

+
    + tag as $t) : ?> +
  • + +
+
+ + + paper['reference'])) { ?> +

引用方式

+
+ paper['reference']; ?> +
+
+ -
- paper['link'])) - { - if(!empty($this->paper[‘attid’])) - echo 'PDF下载'; - }else{ - echo 'PDF下载'; - } - - if (!empty($item['link'])) : - echo ' 下载'; - endif; - ?> - 相关数据(共?条) - -
+
+ paper['link'])) + { + if(!empty($this->paper['attid'])) + { + echo 'PDF下载'; + } + }else{ + echo 'PDF下载'; + } + + + if (!empty($item['link'])) : + echo ' 下载'; + endif; + ?> + 相关数据(共条) +
+ +
- - + + \ No newline at end of file