后台我负责的评审中增加了按专题搜索
This commit is contained in:
parent
34ccbd15f9
commit
a19a57a512
|
@ -580,21 +580,27 @@ class Admin_ReviewController extends Zend_Controller_Action
|
|||
function myreviewAction(){
|
||||
|
||||
include_once("data/Review.php");
|
||||
include_once("data/Source.php");
|
||||
include_once("helper/view.php");
|
||||
|
||||
$search=$this->_request->getParam('search');
|
||||
$keyword = $this->_request->getParam('keyword');
|
||||
$filter['keyword'] = $this->_request->getParam('keyword');
|
||||
$filter['code'] = $this->_request->getParam('code');
|
||||
|
||||
$review = new Review($this->db);
|
||||
if(!empty($search) && !empty($keyword))
|
||||
if(!empty($search) && !empty($filter))
|
||||
{
|
||||
$rows = $review->adminReviews($keyword);
|
||||
$this->view->keyword = $keyword;
|
||||
$rows = $review->adminReviews($filter);
|
||||
$this->view->keyword = $filter['keyword'];
|
||||
$this->view->code = $filter['code'];
|
||||
}else{
|
||||
$rows = $review->adminReviews();
|
||||
}
|
||||
|
||||
$source = new Source($this->db);
|
||||
$this->view->source = $source->Fetch();
|
||||
|
||||
view::addPaginator($rows,$this->view,$this->_request);
|
||||
view::addPaginator($rows,$this,NULL,15);
|
||||
return true;
|
||||
}//我管理的元数据
|
||||
|
||||
|
|
|
@ -26,12 +26,26 @@ table thead tr th {background:#EBF2F6;color:#444;}
|
|||
<?php endforeach;endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<form action="" method="get" class="search input-append">
|
||||
<input type="hidden" name="search" value='1' />
|
||||
<input type="text" class="q" name="keyword" value="<?php echo $this->keyword; ?>" />
|
||||
<button type="submit" class="btn">搜索</button>
|
||||
</form>
|
||||
|
||||
<form method="get" id="search">
|
||||
<input type="hidden" name="search" value='1' />
|
||||
<input type="hidden" name="code" id="code" value="<?php echo $this->code; ?>" />
|
||||
<div class="input-append">
|
||||
<input type="text" class="q" name="keyword" value="<?php echo $this->keyword; ?>" tabindex="1" />
|
||||
<div class="btn-group">
|
||||
<button tabindex="-1" class="btn" type="submit">搜索</button>
|
||||
<button tabindex="-1" data-toggle="dropdown" class="btn dropdown-toggle">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu">
|
||||
<li><a href="javascript:void(0);" onclick="$('#code').val('');$('#search').submit()">所有专题</a></li>
|
||||
<?php if(!empty($this->source)) { ?>
|
||||
<?php foreach($this->source as $v) { ?>
|
||||
<li><a href="javascript:void(0);" onclick="$('#code').val('<?= $v['id'] ?>');$('#search').submit()"><?= $v['code'] ?></a></li>
|
||||
<?php } }?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -64,7 +64,7 @@ class Review extends Zend_Controller_Plugin_Abstract
|
|||
}
|
||||
|
||||
//后台我负责的评审
|
||||
function adminReviews($keyword = "",$order="")
|
||||
function adminReviews($filter = "",$order="")
|
||||
{
|
||||
include_once('helper/view.php');
|
||||
$uid = view::User('id');
|
||||
|
@ -74,9 +74,13 @@ class Review extends Zend_Controller_Plugin_Abstract
|
|||
$wheresql[] = " m.status in (1,2,3,4) ";
|
||||
$wheresql[] = " u.id=$uid ";
|
||||
|
||||
if(!empty($keyword))
|
||||
if(isset($filter['keyword']) && !empty($filter['keyword']))
|
||||
{
|
||||
$wheresql[] = " md.title like '%$keyword%' ";
|
||||
$wheresql[] = " md.title like '%".$filter['keyword']."%' ";
|
||||
}
|
||||
if(isset($filter['code']) && !empty($filter['code']))
|
||||
{
|
||||
$wheresql[] = " s.id=".$filter['code']." ";
|
||||
}
|
||||
|
||||
if(count($wheresql)>0)
|
||||
|
@ -91,6 +95,7 @@ class Review extends Zend_Controller_Plugin_Abstract
|
|||
right join metadata md on md.uuid=m.uuid
|
||||
left join geonetworkmetadata g on m.uuid=g.uuid
|
||||
left join users u on u.id=m.userid
|
||||
left join datasource s on s.uuid=md.uuid
|
||||
$wheresql
|
||||
order by m.status desc,m.ts_accepted desc";
|
||||
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
class Source
|
||||
{
|
||||
private $db; //传入PDO对象.
|
||||
|
||||
//使用到的公共变量
|
||||
public $tbl_source = "source";
|
||||
public $tbl_datasource = "datasource";
|
||||
|
||||
function __construct($db)
|
||||
{
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
function Fetch()
|
||||
{
|
||||
$sql = "SELECT * FROM ".$this->tbl_source."";
|
||||
$rs = $this->db->query($sql);
|
||||
return $rs->fetchAll();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue