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'];