From d9d6177a912d9ed9c64fab70cc5fac95d9708e1e Mon Sep 17 00:00:00 2001 From: wlx Date: Sat, 29 Jun 2013 16:15:23 +0000 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0doi=E7=9A=84=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DataController.php | 5 +++-- application/models/data/Doi.php | 21 +++++++++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 9d2655a3..78e428e5 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -3626,7 +3626,8 @@ class Admin_DataController extends Zend_Controller_Action { $ac = $this->_getParam('ac'); $submit = $this->_getParam('submit'); - $uuid = $this->_getParam('uuid'); + $uuid = $this->_getParam('uuid'); + $q=$this->_getParam('q'); include_once("data/Doi.php"); $doi = new Doi($this->db); @@ -3636,7 +3637,7 @@ class Admin_DataController extends Zend_Controller_Action { if(empty($uuid)) { - $rows = $doi->fetch(); + $rows = $doi->fetch(0,$q); view::addPaginator($rows,$this->view,$this->_request); }else{ $this->_redirect('/admin/data/doi/ac/edit/?uuid='.$uuid); diff --git a/application/models/data/Doi.php b/application/models/data/Doi.php index 2b47d4c0..31e6eeae 100644 --- a/application/models/data/Doi.php +++ b/application/models/data/Doi.php @@ -12,16 +12,25 @@ class Doi extends Zend_Controller_Plugin_Abstract $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)) { - $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{ - $sql = "SELECT doi.* FROM ".$this->tbl_doi." doi - LEFT JOIN mdauthor a ON doi.uuid=a.uuid - WHERE a.userid=".$uid." AND a.status>0 - ORDER BY ts_published desc,ts_submitted desc,ts_created DESC + $sql = "SELECT d.* FROM ".$this->tbl_doi." d + LEFT JOIN mdauthor a ON d.uuid=a.uuid + WHERE a.userid=".$uid." AND a.status>0 and ".$wheresql." + ORDER BY d.ts_published desc,d.ts_submitted desc,d.ts_created DESC "; } $rs = $this->db->query($sql);