diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index bcaa20db..fe32c9ac 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -593,17 +593,6 @@ class DataController extends Zend_Controller_Action $sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10"; //$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=?) and kw.id<>? limit 10"; $this->view->related=$this->db->fetchAll($sql,array($id,$id)); - //相关文献 - $sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where ("; - foreach($this->view->keys as $k) - { - if ($k->keytype=='theme') - { - $sql.=" a.title like '%".$k->keyword."%' or "; - } - } - $sql.=" 1<>1) order by a.ts_created desc limit 10"; - $this->view->literature=$this->db->fetchAll($sql); //数据附件 $sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid); $this->view->attachments = $this->db->fetchAll($sql); @@ -619,13 +608,65 @@ class DataController extends Zend_Controller_Action } } + function literatureAction(){ + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + $keyword=$this->_request->getParam("q"); + + $id = (int)$this->_request->getParam('id'); + $sql="select m.id from normalmetadata m left join mdstatus s on m.uuid=s.uuid + left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid where "; + if (empty($id)) { + $uuid = $this->_request->getParam('uuid'); + if (empty($uuid)) exit("读取信息错误"); + $where=$this->db->quoteInto('m.uuid = ?',$uuid); + } else { + $where=$this->db->quoteInto('m.id = ?',$id); + } + $sql.=$where; + $row=$this->db->fetchRow($sql); + if (!$row) exit("读取信息错误"); + $id=$row['id']; + + $keys=$this->db->fetchAll("select * from keyword where id=? order by keytype,ts_created",array($id)); + + $wheresql = array(); + foreach ($keys as $k=>$v) + { + if($v['keytype']=="theme") + $wheresql[] = " a.title like '%".$v['keyword']."%' "; + } + $wheresql[] = " 1<>1 "; + $wheresql = join(" or ",$wheresql); + $sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where ($wheresql) order by a.ts_created desc"; + $rows = $this->db->fetchAll($sql); + + $paginator = Zend_Paginator::factory($rows); + $paginator->setCurrentPageNumber($this->_getParam('page')); + $paginator->setItemCountPerPage(5); + $paginator->setView($this->view); + Zend_View_Helper_PaginationControl::setDefaultViewPartial('data/pagination_ajax.phtml'); + $this->config = Zend_Registry::get('config'); + if ($paginator) + { + foreach($paginator as $c) + { + $u=parse_url($c['url']); + if (@$u['host']=='hdl.handle.net') $c['url'] = $this->config->seekspace->handleurl.$u['path']; + print '