增加doi的搜索功能

This commit is contained in:
wlx 2013-06-29 16:15:23 +00:00
parent 734327fa82
commit d9d6177a91
2 changed files with 18 additions and 8 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

@ -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);