修改后台元数据评审功能

This commit is contained in:
Li Jianxuan 2013-07-15 03:44:50 +00:00
parent b7b62a9960
commit 0a2f5cc4d1
5 changed files with 140 additions and 11 deletions

View File

@ -123,6 +123,24 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
}//changestatus 更改状态 }//changestatus 更改状态
function editorAction()
{
include_once("helper/view.php");
include_once("data/Review.php");
$this->view->keyword = $keyword = $this->_request->getParam('keyword');
$review = new Review();
if(!empty($keyword))
{
$filter['keyword'] = $keyword;
$data = $review->needEditor($filter);
}else{
$data = $review->needEditor();
}
\view::addPaginator($data,$this,NULL,20);
}
/* /*
* acceptAction()待审元数据 * acceptAction()待审元数据
@ -191,16 +209,12 @@ class Admin_ReviewController extends Zend_Controller_Action
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m $sql = "select m.*,md.title,u.username,u.realname from mdstatus m
right join metadata md on md.uuid=m.uuid right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid left join users u on u.id=m.userid
where m.status in (1,2,3,4) order by m.ts_created desc"; where m.status in (1,2,3,4)
order by m.ts_created desc";
$re = $this->db->query($sql); $re = $this->db->query($sql);
$rows = $re->fetchAll(); $rows = $re->fetchAll();
$paginator = Zend_Paginator::factory($rows); \view::addPaginator($rows,$this,NULL,20);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}//列表 }//列表
}//acceptAction }//acceptAction

View File

@ -48,7 +48,7 @@ table thead tr th {background:#EBF2F6;color:#444;}
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td> <td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td> <td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td> <td>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">分配编辑</a> <a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">更改责任编辑</a>
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -0,0 +1,60 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('元数据评审');
$this->breadcrumb()->setSeparator(' > ');
?>
<style>
table thead tr th {background:#EBF2F6;color:#444;}
.high{background:#444;color:#FFF;}
</style>
<div class="row-fluid">
<div class="span3">
<?= $this->partial('review/left.phtml'); ?>
</div>
<div class="span9">
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<form action="" method="get" class="search input-append">
<input type="hidden" name="search" value='1' />
<input type="text" name="keyword" class="q" value="<?php echo $this->keyword; ?>" />
<button type="submit" class="btn">搜索</button>
</form>
<table class="table table-bordered table-hover"><thead>
<tr>
<th width='600'>元数据标题</th>
<th width='120'>责任编辑</th>
<th width='120'>接收时间</th>
<th width='180'>操作</th>
</tr></thead>
<?php if (count($this->paginator)): ?>
<tbody id="list">
<?php foreach ($this->paginator as $item): ?>
<tr>
<td><a href="/data/<?php echo $item['uuid'];?>"><?= $item['title']?></a></td>
<td><?php echo $item['realname'].'['.$item['username'].']'; ?></td>
<td><?php echo date("Y-m-d H:i",strtotime($item['ts_accepted']));?></td>
<td>
<a href="/admin/review/changeadmin/?id=<?php echo $item['id'];?>">分配编辑</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
<?php endif; ?>
</table>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div><!-- span9 -->
</div>

View File

@ -1,6 +1,7 @@
<ul class="nav nav-pills nav-stacked well"> <ul class="nav nav-pills nav-stacked well">
<span class="label"><h4>元数据评审</h4></span> <span class="label"><h4>元数据评审</h4></span>
<li id="Nav-review-draft"><a href="/admin/review/draft">投稿元数据</a></li> <li id="Nav-review-draft"><a href="/admin/review/draft">投稿元数据</a></li>
<li id="Nav-review-editor"><a href="/admin/review/editor">分配责任编辑</a></li>
<li id="Nav-review-accept"><a href="/admin/review/accept">待审元数据</a></li> <li id="Nav-review-accept"><a href="/admin/review/accept">待审元数据</a></li>
<!-- <li id="Nav-review-inreview"><a href="/admin/review/inreview">在审元数据</a></li> --> <!-- <li id="Nav-review-inreview"><a href="/admin/review/inreview">在审元数据</a></li> -->
<li id="Nav-review-myreview"><a href="/admin/review/myreview">我负责的元数据</a></li> <li id="Nav-review-myreview"><a href="/admin/review/myreview">我负责的元数据</a></li>

View File

@ -9,9 +9,14 @@ class Review extends Zend_Controller_Plugin_Abstract
public $tbl_mdreview = "mdreview"; public $tbl_mdreview = "mdreview";
public $tbl_user = "users"; public $tbl_user = "users";
function __construct($db) function __construct($db = NULL)
{ {
$this->db = $db; if(empty($db))
{
$this->db = Zend_Registry::get('db');
}else{
$this->db = $db;
}
} }
public function events(Zend_EventManager_EventCollection $events = NULL) public function events(Zend_EventManager_EventCollection $events = NULL)
@ -63,6 +68,56 @@ class Review extends Zend_Controller_Plugin_Abstract
return $reviews; return $reviews;
} }
//需要分配责任编辑的元数据评审
function needEditor($filter = "")
{
$wheresql = array();
$ordersql = array();
$wheresql[] = " m.status in (1,2,3,4) ";
$wheresql[] = " (m.userid IS NULL OR u.usertype != 'administrator') ";
if(isset($filter['keyword']) && !empty($filter['keyword']))
{
$wheresql[] = " (md.title like '%".$filter['keyword']."%' OR u.username LIKE '%".$filter['keyword']."%' OR u.realname LIKE '%".$filter['keyword']."%') ";
}
if(count($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
if(isset($filter['order']) && !empty($filter['order']))
{
$sort = "DESC";
if(isset($filter['sort']) && !empty($filter['sort']) && in_array( strtolower($filter['sort']),array('desc','asc')))
{
$sort = $filter['sort'];
}
$ordersql[] = " {$filter['order']} $sort ";
}
if(count($ordersql)>0)
{
$ordersql = " ORDER BY ".join(',',$ordersql);
}else{
$ordersql = " ORDER BY m.ts_created desc ";
}
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m
right join metadata md on md.uuid=m.uuid
left join users u on u.id=m.userid
$wheresql
$ordersql";
$re = $this->db->query($sql);
$rows = $re->fetchAll();
return $rows;
}
//后台我负责的评审 //后台我负责的评审
function adminReviews($filter = "") function adminReviews($filter = "")
{ {
@ -91,7 +146,6 @@ class Review extends Zend_Controller_Plugin_Abstract
$sort = $filter['sort']; $sort = $filter['sort'];
} }
$ordersql[] = " {$filter['order']} $sort "; $ordersql[] = " {$filter['order']} $sort ";
} }
if(count($wheresql)>0) if(count($wheresql)>0)