diff --git a/application/default/controllers/KnowledgeController.php b/application/default/controllers/KnowledgeController.php index dd6baa2e..4ed1b760 100755 --- a/application/default/controllers/KnowledgeController.php +++ b/application/default/controllers/KnowledgeController.php @@ -15,7 +15,7 @@ class KnowledgeController extends Zend_Controller_Action function datacenterAction() { $siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk - $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.id desc"; + $sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.year desc, reference desc"; $sth = $this->db->prepare($sql); $sth->execute(array($siteid)); $rows = $sth->fetchAll(); @@ -26,56 +26,72 @@ class KnowledgeController extends Zend_Controller_Action Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); $this->view->paginator=$paginator; } + function waterAction() + { + $sql="select * from reference where id in (select refid from mdref where uuid in (select uuid from en.normalmetadata)) order by year desc, reference desc"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $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"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $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"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $paginator->setItemCountPerPage(10); - $paginator->setView($this->view); - Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); - $this->view->paginator=$paginator; - } + { + $sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by year desc, reference desc"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $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"; - $sth = $this->db->prepare($sql); - $sth->execute(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $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'); - $source=$this->_request->getParam('searchsource'); - if(preg_match("/\"|'|<|>/",$key)) - { - $data=array('<'=>'<','>'=>'>', "\'"=>'’', "\""=>'”'); + 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 year desc, reference desc"; + $sth = $this->db->prepare($sql); + $sth->execute(); + $rows = $sth->fetchAll(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(10); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml'); + $this->view->paginator=$paginator; + } - $patterns = array(); - $replacements = array(); + 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(); + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $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'); + $author = (int)$this->_request->getParam('author'); + $source=$this->_request->getParam('searchsource'); + if(preg_match("/\"|'|<|>/",$key)) + { + $data=array('<'=>'<','>'=>'>', "\'"=>'’', "\""=>'”'); + $patterns = array(); + $replacements = array(); foreach($data as $k=>$v) { $patterns[]='/'.$k.'/i'; @@ -86,12 +102,15 @@ class KnowledgeController extends Zend_Controller_Action $key=preg_replace($patterns, $replacements, $key); } - if (!empty($key) && $source=='datasource') { + if (!empty($key)) { $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 year desc, reference desc"; + } else if ($author) { + $sql="select * from reference where id in (select a1.id from ref_author a1,ref_author a2 where a1.firstname=a2.firstname and a1.lastname=a2.lastname and a2.id=$author)"; + } $sth = $this->db->prepare($sql); - $sth->execute(); + $sth->execute(); $rows = $sth->fetchAll(); $paginator = Zend_Paginator::factory($rows); $paginator->setCurrentPageNumber($this->_getParam('page')); @@ -102,29 +121,13 @@ class KnowledgeController extends Zend_Controller_Action $this->view->key=$key; $this->view->source=$source; $this->_helper->viewRenderer('search-data'); - } - else if (!empty($key) && $source=='westsource') { - $search=new SimpleSearch($key); - $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(); - $rows = $sth->fetchAll(); - $paginator = Zend_Paginator::factory($rows); - $paginator->setCurrentPageNumber($this->_getParam('page')); - $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"; + $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(); diff --git a/application/default/views/scripts/knowledge/author.phtml b/application/default/views/scripts/knowledge/author.phtml index 88a92cf9..2ed61408 100644 --- a/application/default/views/scripts/knowledge/author.phtml +++ b/application/default/views/scripts/knowledge/author.phtml @@ -5,7 +5,7 @@ $this->headTitle()->setSeparator(' - '); $this->headLink()->appendStylesheet('/css/mdreview.css'); $this->breadcrumb('首页'); $this->breadcrumb('知识积累'); -$this->breadcrumb('数据作者'); +$this->breadcrumb('作者推荐文献库'); $this->breadcrumb()->setSeparator(' > '); $this->headScript()->appendFile('/js/jquery.colorbox-min.js'); $this->headLink()->appendStylesheet('/css/colorbox.css'); @@ -16,20 +16,23 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
-

数据作者文献库

+

作者推荐文献库

- paginator)): ?> -
    - paginator as $item): ?> -
  • - 下载'; - endif; + paginator)): ?> +
      + paginator as $item): ?> +
    1. 查看'; + if (!empty($item['link'])) : + echo ' 下载'; + else : + if (!empty($item['attid'])) echo ' 下载'; + endif; ?> - 相关数据 -
    2. - -
+ 相关数据 + + +
diff --git a/application/default/views/scripts/knowledge/datacenter.phtml b/application/default/views/scripts/knowledge/datacenter.phtml index afbf6bb9..d752644a 100644 --- a/application/default/views/scripts/knowledge/datacenter.phtml +++ b/application/default/views/scripts/knowledge/datacenter.phtml @@ -17,16 +17,19 @@ $this->breadcrumb()->setSeparator(' > ');

数据中心文献库

paginator)): ?> -
    +
      paginator as $item): ?> -
    1. - 下载'; - endif; +
    2. 查看'; + if (!empty($item['link'])) : + echo ' 下载'; + else : + if (!empty($item['attid'])) echo ' 下载'; + endif; ?>
    3. -
+
diff --git a/application/default/views/scripts/knowledge/index.phtml b/application/default/views/scripts/knowledge/index.phtml index 66596a82..a9765cbb 100755 --- a/application/default/views/scripts/knowledge/index.phtml +++ b/application/default/views/scripts/knowledge/index.phtml @@ -10,16 +10,6 @@ $this->breadcrumb()->setSeparator(' > ');
+ \ No newline at end of file