修改关键词展示方式

This commit is contained in:
wlx 2013-04-11 08:14:02 +00:00
parent 34c426ab5c
commit 73f128216a
2 changed files with 44 additions and 11 deletions

View File

@ -23,15 +23,15 @@ class DataController extends Zend_Controller_Action
//关键词
$state=$this->db->query("select keyword,count(*) from keyword where keytype='place' group by keyword order by count desc limit 20");
$k1=$state->fetchAll();
//$state=$db->query("select keyword,count(*) from keyword where keytype='theme' group by keyword order by count desc limit 20");
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword where keytype='theme' group by keyword order by count desc limit 20");
//$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
$k2=$state->fetchAll();
$state=$this->db->query("select keyword,count(*) from keyword where keytype='discipline' group by keyword order by count desc limit 20");
$k3=$state->fetchAll();
$state=$this->db->query("select keyword,count(*) from keyword where keytype='stratum' group by keyword order by count desc limit 20");
$k4=$state->fetchAll();
//$state=$db->query("select keyword,count(*) from keyword where keytype='temporal' group by keyword order by count desc limit 20");
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
$state=$this->db->query("select keyword,count(*) from keyword where keytype='temporal' group by keyword order by count desc limit 20");
//$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='temporal' and (m.uuid in (select uuid from dataorder group by uuid order by count(uuid) desc limit 20)) group by k.keyword order by count(k.keyword) desc limit 20");
$k5=$state->fetchAll();
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
//最新10个入库数据

View File

@ -41,19 +41,52 @@ $this->headTitle()->setSeparator(' - ');
</ul>
</div>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
foreach($this->keywords as $type=>$kcg) :
if (is_array($kcg) && count($kcg)>0 ) :
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
$type='theme';
?>
<div class="span6">
<h4><a href="/data/tag/keytype/<?= $type; ?>"><i class="icon-tags"></i><?php echo $keytypezh[$type]; ?></a></h4>
<h4><a href="/data/tag/keytype/theme"><i class="icon-tags"></i><?php echo $keytypezh[$type]; ?></a></h4>
<ul class="unstyled inline">
<?php foreach($kcg as $cg) : ?>
<?php foreach($this->keywords[$type] as $cg) : ?>
<li><a href='/data/tag/<?php echo $cg['keyword']; ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</div>
<?php endif;endforeach; ?>
</div>
<?php
$type='discipline';
?>
<div class="span6">
<h4><a href="/data/tag/keytype/discipline"><i class="icon-tags"></i><?php echo $keytypezh[$type]; ?></a></h4>
<ul class="unstyled inline">
<?php foreach($this->keywords[$type] as $cg) : ?>
<li><a href='/data/tag/<?php echo $cg['keyword']; ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="row">
<?php
$type='place';
?>
<div class="span6">
<h4><a href="/data/tag/keytype/theme"><i class="icon-tags"></i><?php echo $keytypezh[$type]; ?></a></h4>
<ul class="unstyled inline">
<?php foreach($this->keywords[$type] as $cg) : ?>
<li><a href='/data/tag/<?php echo $cg['keyword']; ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</div>
<?php
$type='temporal';
?>
<div class="span6">
<h4><a href="/data/tag/keytype/discipline"><i class="icon-tags"></i><?php echo $keytypezh[$type]; ?></a></h4>
<ul class="unstyled inline">
<?php foreach($this->keywords[$type] as $cg) : ?>
<li><a href='/data/tag/<?php echo $cg['keyword']; ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="row">
<div class="span6">