增加了数据文献关联管理中的搜索功能

This commit is contained in:
Li Jianxuan 2011-09-19 09:33:50 +00:00
parent 9b6ea84fd8
commit 83fb46f8d7
3 changed files with 909 additions and 861 deletions

View File

@ -394,6 +394,9 @@ class Admin_DataController extends Zend_Controller_Action
$edit=(int)$this->_getParam('edit'); $edit=(int)$this->_getParam('edit');
$delete=(int)$this->_getParam('delete'); $delete=(int)$this->_getParam('delete');
$uuid=$this->_getParam('uuid'); $uuid=$this->_getParam('uuid');
$search=$this->_getParam('search');
$keyword=$this->_getParam('keyword');
if ($add) { if ($add) {
$form=new ReferenceForm(); $form=new ReferenceForm();
if ($this->_request->isPost()) { if ($this->_request->isPost()) {
@ -463,7 +466,31 @@ class Admin_DataController extends Zend_Controller_Action
$this->messenger->addMessage($e->getMessage()); $this->messenger->addMessage($e->getMessage());
} }
$this->_redirect("/admin/data/reference"); $this->_redirect("/admin/data/reference");
} } else if($search){
if(!empty($keyword))
{
$sql="select rf.id as mdid,rf.refid,m.*,r.* from mdref rf
left join metadata m on m.uuid=rf.uuid
left join reference r on r.id=rf.refid
where m.title like '%$keyword%'
order by m.title";
$re=$this->db->query($sql);
$row=$re->fetchAll();
$paginator = Zend_Paginator::factory($row);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(30);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->messenger->addMessage($keyword.' 的搜索结果');
}
else
{
$this->messenger->addMessage('请输入搜索关键字');
$this->_redirect("/admin/data/reference");
}
}else{
$select=$this->db->select(); $select=$this->db->select();
$select->from('mdref',array('id as mdid','refid')) $select->from('mdref',array('id as mdid','refid'))
->join('metadata','metadata.uuid=mdref.uuid') ->join('metadata','metadata.uuid=mdref.uuid')
@ -475,6 +502,8 @@ class Admin_DataController extends Zend_Controller_Action
$paginator->setView($this->view); $paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml'); Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator; $this->view->paginator=$paginator;
}
} }
/* /*
* 删除元数据,删除前有确认 * 删除元数据,删除前有确认

View File

@ -1,4 +1,5 @@
<ul> <ul>
<li class="title">数据管理</li>
<li><a href="/admin/data/md">元数据管理</a></li> <li><a href="/admin/data/md">元数据管理</a></li>
<li><a href="/admin/data/comment">数据反馈管理</a></li> <li><a href="/admin/data/comment">数据反馈管理</a></li>
<li><a href="/admin/data/reference">数据文献关联管理</a></li> <li><a href="/admin/data/reference">数据文献关联管理</a></li>

View File

@ -6,7 +6,7 @@
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>'); $this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>'); $this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('数据文献关联管理</a>'); $this->breadcrumb('数据文献关联管理');
$this->breadcrumb()->setSeparator(' > '); $this->breadcrumb()->setSeparator(' > ');
?> ?>
<div id="leftPanel"> <div id="leftPanel">
@ -22,7 +22,24 @@
<?php endforeach;endif; ?> <?php endforeach;endif; ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<a href="/admin/data/reference/add/1">添加新的数据文献</a><?= $this->paginator; ?>
<div class="right_title">数据文献关联管理</div>
<div class="search">
<form action="" method="get">
<input type="hidden" name="search" value='1' />
<ul>
<li><label>搜索关键字</label><input type="text" name="keyword" value="<?php echo $this->keyword; ?>" /></li>
<li><input type="submit" class="searchbtn" value="搜索" /></li>
</ul>
</form>
</div><!-- search DIV -->
<div class="controlplan">
<a href="/admin/data/reference/add/1">添加新的数据文献</a>
</div>
<?php if (count($this->paginator)): ?> <?php if (count($this->paginator)): ?>
<div id="datasetcd"> <div id="datasetcd">
<?php <?php
@ -43,4 +60,5 @@ echo '</ul>';
?> ?>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?= $this->paginator; ?>
</div> </div>