实现关键词的分类浏览
This commit is contained in:
parent
fbb3f3f7f7
commit
d360fd8eff
|
@ -191,12 +191,17 @@ class DataController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
$id = (int)$this->_request->getParam('id');
|
$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');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$limit=10;
|
$limit=10;
|
||||||
$offset=$limit*($page-1);
|
$offset=$limit*($page-1);
|
||||||
$state=$this->db->query('select keyword,count(*),keytype from keyword group by keyword,keytype order by keytype,keyword,count desc');
|
$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();
|
$this->view->keywords=$state->fetchAll();
|
||||||
|
|
||||||
if ($id>0 or !empty($key)) {
|
if ($id>0 or !empty($key)) {
|
||||||
if (empty($key)) {
|
if (empty($key)) {
|
||||||
$where=$this->db->quoteInto('id = ?',$id);
|
$where=$this->db->quoteInto('id = ?',$id);
|
||||||
|
@ -205,6 +210,7 @@ class DataController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
$this->view->codename=$key;
|
$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);
|
$state=$this->db->query($sql);
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
|
|
Loading…
Reference in New Issue