添加我负责的元数据获取

This commit is contained in:
Jack Freeman 2015-02-07 10:31:39 +08:00
parent d209a34b80
commit c6e6b2bcec
1 changed files with 70 additions and 2 deletions

View File

@ -275,7 +275,75 @@ class Review extends AbstractEventManager implements ServiceManagerAwareInterfac
return $select;
}//accept()
}//getAccept()
/**
* 获得我负责的元数据
* @param string $filter
* @return null
*/
public function getAdminReviews($filter = "")
{
$authService = $this->serviceManager->get('Auth');
$user_id = $authService->getIdentity('id');
if(empty($user_id))
return false;
$wheresql = array();
$ordersql = array();
$wheresql[] = " m.status in (1,2,3,4) ";
$wheresql[] = " u.id=$user_id ";
if(isset($filter['keyword']) && !empty($filter['keyword']))
{
$wheresql[] = " md.title like '%".$filter['keyword']."%' ";
}
if(isset($filter['code']) && !empty($filter['code']))
{
$wheresql[] = " s.sourceid=".$filter['code']." ";
}
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($wheresql)>0)
{
$wheresql = " WHERE ".join(" AND ",$wheresql);
}else{
$wheresql = "";
}
if(count($ordersql)>0)
{
$ordersql = " ORDER BY ".join(',',$ordersql);
}else{
$ordersql = " ORDER BY m.status desc,m.ts_accepted desc ";
}
$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,count(r.id) as reviews
FROM mdstatus m
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
left join mdreview r ON r.uuid=md.uuid
$wheresql
GROUP BY m.id,g.id, md.uuid,md.title,u.username,u.realname,m.status,md.id,md.author,m.ts_accepted
$ordersql";
$re = $this->db->query($sql);
$rows = $re->fetchAll();
return $rows;
}//getAdminReviews
/**
* 取消评审
@ -372,7 +440,7 @@ class Review extends AbstractEventManager implements ServiceManagerAwareInterfac
$this->getEventManager()->trigger('review.reset', $this, compact('id'));
return true;
}
}//reset()
/**
* 更改mdstatus中的status字段