merge heihedata branch r3771, r3772 to trunk

This commit is contained in:
wlx 2013-07-01 15:11:03 +00:00
parent 9c281d60f8
commit 90f11cd4f4
3 changed files with 20 additions and 10 deletions

View File

@ -3627,6 +3627,7 @@ class Admin_DataController extends Zend_Controller_Action
$ac = $this->_getParam('ac'); $ac = $this->_getParam('ac');
$submit = $this->_getParam('submit'); $submit = $this->_getParam('submit');
$uuid = $this->_getParam('uuid'); $uuid = $this->_getParam('uuid');
$q=$this->_getParam('q');
include_once("data/Doi.php"); include_once("data/Doi.php");
$doi = new Doi($this->db); $doi = new Doi($this->db);
@ -3636,7 +3637,7 @@ class Admin_DataController extends Zend_Controller_Action
{ {
if(empty($uuid)) if(empty($uuid))
{ {
$rows = $doi->fetch(); $rows = $doi->fetch(0,$q);
view::addPaginator($rows,$this->view,$this->_request); view::addPaginator($rows,$this->view,$this->_request);
}else{ }else{
$this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid); $this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid);

View File

@ -503,7 +503,7 @@ class HiwaterController extends DataController
$row=$state->fetchAll(); $row=$state->fetchAll();
$sum=$row[0]['count']; $sum=$row[0]['count'];
//@todo: add order with title //@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='hiwater') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by timebegin,title limit ? offset ?"; $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='hiwater') 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->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit); $this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1; $this->view->offset=$offset+1;
@ -534,7 +534,7 @@ class HiwaterController extends DataController
$row=$state->fetchAll(); $row=$state->fetchAll();
$sum=$row[0]['count']; $sum=$row[0]['count'];
//@todo: add order with title //@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='hiwater') and id in (select id from keyword where keyword='".$limited."') and id in (select id from keyword where keyword in ".$keyword.") order by timebegin,title limit ? offset ?"; $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='hiwater') and id in (select id from keyword where keyword='".$limited."') and id in (select id from keyword where keyword in ".$keyword.") order by title limit ? offset ?";
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset)); $this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit); $this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1; $this->view->offset=$offset+1;

View File

@ -12,16 +12,25 @@ class Doi extends Zend_Controller_Plugin_Abstract
$this->db = $db; $this->db = $db;
} }
function fetch($uid=0) function fetch($uid=0,$keyword='')
{ {
$wheresql=' 1=1 ';
if(!empty($keyword))
{
if(preg_match("/\'/",$keyword))
{
$keyword = preg_replace("/\'/","''",$keyword);
}
$wheresql.=" and d.title like '%$keyword%'";
}
if(empty($uid)) if(empty($uid))
{ {
$sql = "SELECT * FROM ".$this->tbl_doi." ORDER BY ts_published desc,ts_submitted desc,ts_created DESC"; $sql = "SELECT * FROM ".$this->tbl_doi." d where ".$wheresql."ORDER BY d.ts_published desc,d.ts_submitted desc,d.ts_created DESC";
}else{ }else{
$sql = "SELECT doi.* FROM ".$this->tbl_doi." doi $sql = "SELECT d.* FROM ".$this->tbl_doi." d
LEFT JOIN mdauthor a ON doi.uuid=a.uuid LEFT JOIN mdauthor a ON d.uuid=a.uuid
WHERE a.userid=".$uid." AND a.status>0 WHERE a.userid=".$uid." AND a.status>0 and ".$wheresql."
ORDER BY ts_published desc,ts_submitted desc,ts_created DESC ORDER BY d.ts_published desc,d.ts_submitted desc,d.ts_created DESC
"; ";
} }
$rs = $this->db->query($sql); $rs = $this->db->query($sql);