Add initial review function for CARD.

This commit is contained in:
wlx 2014-05-10 05:45:25 +00:00
parent 56680eff56
commit 0e6e907cc6
1 changed files with 37 additions and 37 deletions

View File

@ -16,8 +16,8 @@ class Admin_ReviewController extends Zend_Controller_Action
*/ */
function indexAction() function indexAction()
{ {
$sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.title,u.username,u.realname,m.status from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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
order by m.id desc limit 10 "; order by m.id desc limit 10 ";
$re = $this->db->query($sql); $re = $this->db->query($sql);
@ -38,8 +38,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$userid = $user->id; $userid = $user->id;
} }
$sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.title,u.username,u.realname,m.status from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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 u.id='$userid'"; where u.id='$userid'";
@ -105,11 +105,11 @@ class Admin_ReviewController extends Zend_Controller_Action
else else
{ {
if($status==1) if($status==1)
{$sql = "update mdstatus set status='$status',ts_accepted='now()' where id in ($id)"; } {$sql = "update en.mdstatus set status='$status',ts_accepted='now()' where id in ($id)"; }
else if($status==5) else if($status==5)
{$sql = "update mdstatus set status='$status',ts_finished='now()' where id in ($id)";} {$sql = "update en.mdstatus set status='$status',ts_finished='now()' where id in ($id)";}
else else
{$sql = "update mdstatus set status='$status' where id in ($id)";} {$sql = "update en.mdstatus set status='$status' where id in ($id)";}
try{ try{
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
@ -168,7 +168,7 @@ class Admin_ReviewController extends Zend_Controller_Action
//update search document //update search document
$search=new Search(); $search=new Search();
//create search view in xunsearch //create search view in xunsearch
$sql="select uuid from mdstatus where id=?"; $sql="select uuid from en.mdstatus where id=?";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($cancel)); $sth->execute(array($cancel));
$data = $sth->fetch(); $data = $sth->fetch();
@ -187,8 +187,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$keyword = $this->_request->getParam('keyword'); $keyword = $this->_request->getParam('keyword');
if(!empty($keyword)) if(!empty($keyword))
{ {
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m $sql = "select m.*,md.title,u.username,u.realname from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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) where m.status in (1,2,3,4)
and md.title like '%$keyword%' and md.title like '%$keyword%'
@ -206,8 +206,8 @@ class Admin_ReviewController extends Zend_Controller_Action
}//搜索 }//搜索
else else
{ {
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m $sql = "select m.*,md.title,u.username,u.realname from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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) where m.status in (1,2,3,4)
order by m.ts_created desc"; order by m.ts_created desc";
@ -239,8 +239,8 @@ class Admin_ReviewController extends Zend_Controller_Action
if($show>0) if($show>0)
{ {
$sql = "select m.*,md.*,u.realname from mdstatus m $sql = "select m.*,md.*,u.realname from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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.id=$show where m.id=$show
"; ";
@ -295,8 +295,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->keyword = $keyword; $this->view->keyword = $keyword;
} }
$sql = "select m.id,md.title,m.status,m.uuid,u.username,u.realname from mdstatus m $sql = "select m.id,md.title,m.status,m.uuid,u.username,u.realname from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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 (2,3,4) $searchjoin order by m.ts_accepted desc"; where m.status in (2,3,4) $searchjoin order by m.ts_accepted desc";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
@ -358,8 +358,8 @@ class Admin_ReviewController extends Zend_Controller_Action
{ {
if(is_array($exps)) if(is_array($exps))
{ {
$sql = "select m.uuid,m.title,s.status from metadata m $sql = "select m.uuid,m.title,s.status from en.metadata m
left join mdstatus s on s.uuid=m.uuid left join en.mdstatus s on s.uuid=m.uuid
where s.id='$id'"; where s.id='$id'";
$rs = $this -> db -> query($sql); $rs = $this -> db -> query($sql);
@ -513,7 +513,7 @@ class Admin_ReviewController extends Zend_Controller_Action
if(!empty($uid)) if(!empty($uid))
{ {
$sql = "update mdstatus set userid='$uid' where id='$id'"; $sql = "update en.mdstatus set userid='$uid' where id='$id'";
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
include_once('helper/view.php'); include_once('helper/view.php');
@ -549,7 +549,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$uuid=$this->_request->getParam('uuid'); $uuid=$this->_request->getParam('uuid');
$userid=Zend_Auth::getInstance()->getIdentity()->id; $userid=Zend_Auth::getInstance()->getIdentity()->id;
$sql = "select * from mdstatus where uuid='$uuid'"; $sql = "select * from en.mdstatus where uuid='$uuid'";
$re = $this->db->query($sql); $re = $this->db->query($sql);
$row = $re->fetch(); $row = $re->fetch();
@ -557,7 +557,7 @@ class Admin_ReviewController extends Zend_Controller_Action
if(empty($row['id'])) if(empty($row['id']))
{ {
$sql = "insert into mdstatus (uuid,userid,status) values ('$uuid','$userid','0')"; $sql = "insert into en.mdstatus (uuid,userid,status) values ('$uuid','$userid','0')";
try{ try{
if($this->db->exec($sql)>0) if($this->db->exec($sql)>0)
{ {
@ -569,7 +569,7 @@ class Admin_ReviewController extends Zend_Controller_Action
return true; return true;
} }
} else if ($row['status']==5){ } else if ($row['status']==5){
$sql="update mdstatus set status=1,ts_accepted=now() where status=5 and id=".$row['id']; $sql="update en.mdstatus set status=1,ts_accepted=now() where status=5 and id=".$row['id'];
$this->db->query($sql); $this->db->query($sql);
view::Post($this,array("content"=>'操作成功!该数据已重新放入评审','url'=>'/admin/review/accept')); view::Post($this,array("content"=>'操作成功!该数据已重新放入评审','url'=>'/admin/review/accept'));
return true; return true;
@ -637,7 +637,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$id = $this->view->id = $this->_request->getParam('id'); $id = $this->view->id = $this->_request->getParam('id');
$sql="select m.title,m.uuid,array_to_string(array(select distinct(email) from role r left join responsible rs on r.resid=rs.id where r.uuid=m.uuid and length(rs.email)>4),',') as emails from mdstatus s left join metadata m on s.uuid=m.uuid where s.id=?"; $sql="select m.title,m.uuid,array_to_string(array(select distinct(email) from en.role r left join en.responsible rs on r.resid=rs.id where r.uuid=m.uuid and length(rs.email)>4),',') as emails from en.mdstatus s left join en.metadata m on s.uuid=m.uuid where s.id=?";
$res=$this->db->fetchRow($this->db->quoteInto($sql,$id)); $res=$this->db->fetchRow($this->db->quoteInto($sql,$id));
$rv=explode(',',$res['emails']); $rv=explode(',',$res['emails']);
$rows = array(); $rows = array();
@ -749,7 +749,7 @@ class Admin_ReviewController extends Zend_Controller_Action
//update search document //update search document
$search=new Search(); $search=new Search();
//create search view in xunsearch //create search view in xunsearch
$sql="select * from xunsearch where uuid in (select uuid from mdstatus where id in (".$ids."))"; $sql="select * from en.xunsearch where uuid in (select uuid from en.mdstatus where id in (".$ids."))";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
while ($data = $sth->fetch()) while ($data = $sth->fetch())
@ -760,7 +760,7 @@ class Admin_ReviewController extends Zend_Controller_Action
//仅对单条数据发送email信息 //仅对单条数据发送email信息
if (is_numeric($ids)) if (is_numeric($ids))
{ {
$sql="select distinct u.email,m.title,m.uuid from mdstatus s left join metadata m on s.uuid=m.uuid $sql="select distinct u.email,m.title,m.uuid from mdstatus s left join en.metadata m on s.uuid=m.uuid
right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email"; right join mdauthor a on s.uuid=a.uuid left join users u on a.userid=u.id where s.id=? order by u.email";
$rs=$this->db->query($sql,array($ids)); $rs=$this->db->query($sql,array($ids));
$rows=$rs->fetchAll(); $rows=$rs->fetchAll();
@ -805,10 +805,10 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->keyword = $keyword; $this->view->keyword = $keyword;
} }
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created,gn.id as gnid from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created,gn.id as gnid from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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
left join geonetworkmetadata gn on m.uuid=gn.uuid left join en.geonetworkmetadata gn on m.uuid=gn.uuid
where status=0 $searchjoin order by m.ts_created desc"; where status=0 $searchjoin order by m.ts_created desc";
$re = $this->db->query($sql); $re = $this->db->query($sql);
@ -867,8 +867,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->keyword = $keyword; $this->view->keyword = $keyword;
} }
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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 status=-1 $searchjoin"; where status=-1 $searchjoin";
@ -907,8 +907,8 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->keyword = $keyword; $this->view->keyword = $keyword;
} }
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_finished from mdstatus m $sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_finished from en.mdstatus m
right join metadata md on md.uuid=m.uuid right join en.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 status=5 $searchjoin order by m.ts_finished desc"; where status=5 $searchjoin order by m.ts_finished desc";
@ -945,13 +945,13 @@ class Admin_ReviewController extends Zend_Controller_Action
$user = $auth->getIdentity(); $user = $auth->getIdentity();
$userid = $user->id; $userid = $user->id;
$sql = "select id from mdstatus where userid='$userid' and id='$id'"; $sql = "select id from en.mdstatus where userid='$userid' and id='$id'";
$rs = $this->db->query($sql); $rs = $this->db->query($sql);
$row = $rs->fetch(); $row = $rs->fetch();
if(!empty($row['id'])) if(!empty($row['id']))
{ {
$sql = "delete from mdstatus where id='$id'"; $sql = "delete from en.mdstatus where id='$id'";
if($this->db->exec($sql)) if($this->db->exec($sql))
{ {
view::Post($this,array("content"=>'删除成功','url'=>"/admin/review/myreview")); view::Post($this,array("content"=>'删除成功','url'=>"/admin/review/myreview"));
@ -1282,7 +1282,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select md.title,md.uuid,u.realname,r.id,r.ts_created,r.is_expert from mdreview r $sql = "select md.title,md.uuid,u.realname,r.id,r.ts_created,r.is_expert from mdreview r
left join metadata md on md.uuid=r.uuid left join en.metadata md on md.uuid=r.uuid
left join users u on u.id=r.userid left join users u on u.id=r.userid
$wheresql $wheresql
order by r.ts_created desc order by r.ts_created desc
@ -1333,7 +1333,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select u.id,u.realname as title,count(r.id) as c from mdreview r $sql = "select u.id,u.realname as title,count(r.id) as c from mdreview r
left join metadata md on md.uuid=r.uuid left join en.metadata md on md.uuid=r.uuid
left join users u on u.id=r.userid left join users u on u.id=r.userid
$wheresql $wheresql
GROUP BY u.id,u.realname GROUP BY u.id,u.realname
@ -1463,7 +1463,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
$sql = "select md.title,md.uuid,count(r.id) as c from mdreview r $sql = "select md.title,md.uuid,count(r.id) as c from mdreview r
left join metadata md on md.uuid=r.uuid left join en.metadata md on md.uuid=r.uuid
$wheresql $wheresql
GROUP BY md.title,md.uuid GROUP BY md.title,md.uuid
"; ";