From 153a43956e8f7631ce8370c43d920bc64c8c1523 Mon Sep 17 00:00:00 2001 From: wlx Date: Wed, 11 Jun 2014 13:13:58 +0000 Subject: [PATCH] add viewed field --- application/default/controllers/DataController.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/application/default/controllers/DataController.php b/application/default/controllers/DataController.php index 954e958b..19915175 100755 --- a/application/default/controllers/DataController.php +++ b/application/default/controllers/DataController.php @@ -127,7 +127,7 @@ class DataController extends Zend_Controller_Action if (empty($page)) $page=1; $limit=10; $offset=$limit*($page-1); - $sql='select keyword,count(*),keytype from keyword right join normalmetadata on keyword.id=normalmetadata.id '; + $sql="select keyword,count(*),keytype from keyword right join $this->submd m on keyword.id=m.id "; 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); @@ -140,13 +140,15 @@ 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 $this->submd m,keyword k where m.id=k.id and k.keyword=?",$key); $state=$this->db->query($sql); $row=$state->fetchAll(); $sum=$row[0]['count']; $select=$this->db->select(); - $select->from('normalmetadata','*')->join('keyword','normalmetadata.id=keyword.id')->where('keyword.keyword=?',$key)->order('normalmetadata.title')->limitPage($page,$limit); + $select->from($this->submd.' as m','*') + ->join('keyword','m.id=keyword.id') + ->join('mdstat as ms','ms.uuid=m.uuid','viewed')->where('keyword.keyword=?',$key)->order('m.title')->limitPage($page,$limit); //$sql=$db->quoteInto('select m.* from metadata m,keyword k where m.id=k.id and k.keyword=?',$key); //$state=$db->query($sql); $this->view->metadata=$this->db->fetchAll($select);