From d360fd8eff5c53a5ff5b3de4c68dcd872beb8961 Mon Sep 17 00:00:00 2001 From: wlx Date: Thu, 11 Apr 2013 08:31:05 +0000 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E5=85=B3=E9=94=AE=E8=AF=8D?= =?UTF-8?q?=E7=9A=84=E5=88=86=E7=B1=BB=E6=B5=8F=E8=A7=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/default/controllers/DataController.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 66df1dd6..d9338256 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -190,13 +190,18 @@ class DataController extends Zend_Controller_Action function tagAction() { $id = (int)$this->_request->getParam('id'); - $key = $this->_request->getParam('key'); + $key = $this->_request->getParam('key'); + $keytype = $this->_request->getParam('keytype'); $page=(int)$this->_request->getParam('page'); if (empty($page)) $page=1; $limit=10; - $offset=$limit*($page-1); - $state=$this->db->query('select keyword,count(*),keytype from keyword group by keyword,keytype order by keytype,keyword,count desc'); + $offset=$limit*($page-1); + $sql='select keyword,count(*),keytype from keyword '; + if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" where keytype='".$keytype."'"; + $sql.=' group by keyword,keytype order by keytype,keyword,count desc'; + $state=$this->db->query($sql); $this->view->keywords=$state->fetchAll(); + if ($id>0 or !empty($key)) { if (empty($key)) { $where=$this->db->quoteInto('id = ?',$id); @@ -204,7 +209,8 @@ class DataController extends Zend_Controller_Action $key=$row->name; } $this->view->codename=$key; - $sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key); + $sql=$this->db->quoteInto('select count(m.id) from normalmetadata m,keyword k where m.id=k.id and k.keyword=?',$key); + $state=$this->db->query($sql); $row=$state->fetchAll(); $sum=$row[0]['count'];