add search function with thumb browse.
This commit is contained in:
parent
79e12c9797
commit
2992dd673d
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
class ReviewController extends Zend_Controller_Action
|
||||
{
|
||||
{
|
||||
private $limit=10;
|
||||
function preDispatch()
|
||||
{
|
||||
$this->view->config = Zend_Registry::get('config');
|
||||
|
@ -482,7 +483,25 @@ class ReviewController extends Zend_Controller_Action
|
|||
|
||||
echo $stringbuffer.'<div class="paginator">'.$paginator.'</div>';
|
||||
|
||||
}//allreviewAction()
|
||||
|
||||
}//allreviewAction()
|
||||
|
||||
function searchAction()
|
||||
{
|
||||
$key=$this->_request->getParam('q');
|
||||
if (!empty($key)) {
|
||||
$search=new Search($key);
|
||||
$where=$search->sql_expr(array("m.title","m.description"));
|
||||
$page=@(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $page=1;
|
||||
$offset=$this->limit*($page-1);
|
||||
$row=$this->db->fetchAll("select count(s.*) from mdstatus s left join normalmetadata m on s.uuid=m.uuid where s.status>0 and ".$where);
|
||||
$sum=$row[0]['count'];
|
||||
$sql="select m.uuid,m.title,m.id,m.description,s.status,g.id as gid,t.filename from mdstatus s left join normalmetadata m on s.uuid=m.uuid left join geonetworkmetadata g on g.uuid=m.uuid left join thumbnail t on t.id=m.id where s.status>0 and ".$where." order by s.ts_created desc,m.title limit ? offset ?";
|
||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||
$this->view->key=$key;
|
||||
$this->view->offset=$offset+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->review);
|
||||
$this->headTitle('快速搜索');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/mdreview.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/review">'.$this->config->title->review.'</a>');
|
||||
$this->breadcrumb('快速搜索');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('/js/pubfunc.js');
|
||||
?>
|
||||
<div id='sidebar'>
|
||||
<div id='leftnavi'>
|
||||
<?= $this->partial('review/navi.phtml',array('key'=>$this->key)); ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (!empty($this->metadata)) : ?>
|
||||
<div id='mdlist'>
|
||||
<?php echo $this->page->getNavigation(); ?>
|
||||
<hr />
|
||||
<?php foreach($this->metadata as $md) :
|
||||
$thumburl='/gndata/'.sprintf('%05d',floor(($md['gid']+0.1)/100)*100).'-'.sprintf('%05d',ceil(($md['gid']+0.1)/100)*100-1)."/".$md['gid'];
|
||||
$thumburl.='/public/'.str_replace('_s.','.',$md['filename']);
|
||||
?>
|
||||
<div class="thumbmd">
|
||||
<div class="thumbtitle">
|
||||
<a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']); ?> </a>
|
||||
<?php if ($md['status']!=5) : ?>
|
||||
<a href="/review/review/uuid/<?php echo $md['uuid'];?>"><img src="/images/review.png" alt="查看评审页" title="进行数据评审"></a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<img class="thumbimg" src="/service/thumb/id/<?php echo $md['id'];?>" alt="<?php echo $this->escape($md['title']);?>" title="<?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?>"
|
||||
onclick="fnCreate('<?php echo $thumburl; ?>')" />
|
||||
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<hr class="clear"/>
|
||||
<?php echo $this->page->getNavigation();
|
||||
else :
|
||||
?>
|
||||
<div>
|
||||
<p>您的搜索结果为空,请尝试其他关键词进行查询。</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
Loading…
Reference in New Issue