2013-05-03 06:41:06 +00:00
|
|
|
<?php
|
|
|
|
class Review extends Zend_Controller_Plugin_Abstract
|
|
|
|
{
|
|
|
|
private $db; //传入PDO对象.
|
|
|
|
private $auth = NULL; //Zend_Auth 对象
|
|
|
|
|
|
|
|
//使用到的公共变量
|
2013-05-10 08:53:24 +00:00
|
|
|
public $tbl_reviewexp = "mdexpertreview";
|
|
|
|
public $tbl_mdreview = "mdreview";
|
|
|
|
public $tbl_user = "users";
|
2013-05-03 06:41:06 +00:00
|
|
|
|
|
|
|
function __construct($db)
|
|
|
|
{
|
|
|
|
$this->db = $db;
|
|
|
|
}
|
|
|
|
|
|
|
|
//接受或者拒绝评审
|
|
|
|
function invite($id,$uuid,$uid,$status)
|
|
|
|
{
|
|
|
|
if(empty($id) || empty($uuid) || !is_numeric($id) ||!preg_match("/^[0-9A-Za-z]{8}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{4}-[0-9A-Za-z]{12}$/",$uuid))
|
|
|
|
{
|
|
|
|
return"参数错误";
|
|
|
|
}
|
|
|
|
|
|
|
|
if($id != $uid)
|
|
|
|
{
|
|
|
|
return "您无权使用此通知";
|
|
|
|
}//非本人操作
|
|
|
|
|
|
|
|
try{
|
2013-05-10 08:53:24 +00:00
|
|
|
$sql = "update ".$this->tbl_reviewexp." set status=$status where id='$id' and uuid='$uuid'";
|
2013-05-03 06:41:06 +00:00
|
|
|
if($this->db->exec($sql))
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}else{
|
|
|
|
return "您无权限进行此操作";
|
|
|
|
}
|
|
|
|
}catch(Exception $e){
|
|
|
|
return "处理中出现错误";
|
|
|
|
}
|
2013-05-10 08:53:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//根据UUID获得评审意见
|
|
|
|
function getReviews($uuid)
|
|
|
|
{
|
|
|
|
$sql = "SELECT mr.*,u.username,u.realname FROM ".$this->tbl_mdreview." mr
|
|
|
|
LEFT JOIN ".$this->tbl_user." u ON mr.userid = u.id
|
|
|
|
WHERE mr.uuid = '$uuid'";
|
|
|
|
|
|
|
|
$sth = $this->db->query($sql);
|
|
|
|
$reviews = $sth->fetchAll();
|
2013-05-03 06:41:06 +00:00
|
|
|
|
2013-05-10 08:53:24 +00:00
|
|
|
return $reviews;
|
2013-05-03 06:41:06 +00:00
|
|
|
}
|
2013-05-14 08:57:30 +00:00
|
|
|
|
|
|
|
//后台我负责的评审
|
|
|
|
function adminReviews($keyword = "",$order="")
|
|
|
|
{
|
|
|
|
include_once('helper/view.php');
|
|
|
|
$uid = view::User('id');
|
|
|
|
|
|
|
|
$wheresql = array();
|
|
|
|
|
|
|
|
$wheresql[] = " m.status in (0,1,2,3,4) ";
|
|
|
|
$wheresql[] = " u.id=$uid ";
|
|
|
|
|
|
|
|
if(!empty($keyword))
|
|
|
|
{
|
|
|
|
$wheresql[] = " md.title like '%$keyword%' ";
|
|
|
|
}
|
|
|
|
|
|
|
|
if(count($wheresql)>0)
|
|
|
|
{
|
|
|
|
$wheresql = " WHERE ".join(" AND ",$wheresql);
|
|
|
|
}else{
|
|
|
|
$wheresql = "";
|
|
|
|
}
|
|
|
|
|
2013-05-24 00:35:07 +00:00
|
|
|
$sql = "select m.id,g.id as gid, md.uuid,md.title,u.username,u.realname,m.status,md.id as mdid,md.author,m.ts_accepted
|
2013-05-14 08:57:30 +00:00
|
|
|
FROM mdstatus m
|
2013-05-24 00:35:07 +00:00
|
|
|
right join metadata md on md.uuid=m.uuid
|
|
|
|
left join geonetworkmetadata g on m.uuid=g.uuid
|
2013-05-14 08:57:30 +00:00
|
|
|
left join users u on u.id=m.userid
|
|
|
|
$wheresql
|
|
|
|
order by m.status desc,m.ts_accepted desc";
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
return $rows;
|
|
|
|
}
|
2013-05-03 06:41:06 +00:00
|
|
|
}
|