2011-09-28 07:24:09 +00:00
|
|
|
|
<?php
|
|
|
|
|
class Admin_ReviewController extends Zend_Controller_Action
|
|
|
|
|
{
|
|
|
|
|
function preDispatch()
|
|
|
|
|
{
|
|
|
|
|
$this->db=Zend_Registry::get('db');
|
|
|
|
|
$this->view->config = Zend_Registry::get('config');
|
|
|
|
|
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
|
|
|
|
$this->view->messages = $this->messenger->getMessages();
|
|
|
|
|
}
|
|
|
|
|
function postDispatch()
|
|
|
|
|
{
|
2011-10-18 12:37:07 +00:00
|
|
|
|
//$this->view->messages = $this->messenger->getMessages();
|
2011-09-28 07:24:09 +00:00
|
|
|
|
}
|
|
|
|
|
function indexAction()
|
|
|
|
|
{
|
2011-10-08 01:56:09 +00:00
|
|
|
|
$sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m
|
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
order by m.id desc limit 10 ";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$queue = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
foreach ($queue as $k=>$v)
|
|
|
|
|
{
|
2011-10-15 09:57:23 +00:00
|
|
|
|
$queue[$k]['status']=$this->rewritestatus($v['status']);
|
2011-10-08 01:56:09 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->view->queue = $queue;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
|
if($auth->hasIdentity())
|
|
|
|
|
{
|
|
|
|
|
$user = $auth->getIdentity();
|
|
|
|
|
$userid = $user->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sql = "select m.id,md.title,u.username,u.realname,m.status from mdstatus m
|
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where u.id='$userid'";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$this->view->my = $rows;
|
|
|
|
|
|
|
|
|
|
|
2011-09-28 07:24:09 +00:00
|
|
|
|
}//indexAction
|
|
|
|
|
|
2011-10-15 09:57:23 +00:00
|
|
|
|
function rewritestatus($status){
|
2011-10-08 01:56:09 +00:00
|
|
|
|
if($status==-1)
|
|
|
|
|
{return "取消评审";}
|
|
|
|
|
else if($status==0)
|
|
|
|
|
{return "初始状态";}
|
|
|
|
|
else if($status==1)
|
|
|
|
|
{return "接受元数据评审";}
|
|
|
|
|
else if($status==2)
|
|
|
|
|
{return "开始邀请专家";}
|
|
|
|
|
else if($status==3)
|
|
|
|
|
{return "专家接受邀请";}
|
|
|
|
|
else if($status==4)
|
|
|
|
|
{return "专家反馈";}
|
|
|
|
|
else if($status==5)
|
|
|
|
|
{return "已发布";}
|
|
|
|
|
else
|
|
|
|
|
{return "";}
|
|
|
|
|
}
|
2011-09-30 07:32:21 +00:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*changestatus
|
|
|
|
|
*
|
|
|
|
|
*@param int $id //要更改状态的mdstatus记录的ID
|
|
|
|
|
*@param int $status //状态
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
function changestatus($id,$status){
|
|
|
|
|
$stvalues = array(
|
|
|
|
|
-1, //取消评审
|
|
|
|
|
0, //初始状态
|
|
|
|
|
1, //接受元数据评审,进入评审阶段
|
|
|
|
|
2, //开始邀请专家,送审阶段
|
|
|
|
|
3, //专家接受邀请,在审阶段
|
|
|
|
|
4, //专家反馈,在审
|
|
|
|
|
5 //评审结束,发布
|
|
|
|
|
);
|
2011-10-10 08:21:02 +00:00
|
|
|
|
if(empty($id) || !isset($status) || !in_array($status,$stvalues))
|
2011-09-30 07:32:21 +00:00
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-11 02:25:26 +00:00
|
|
|
|
if($status==1)
|
2011-10-11 04:01:17 +00:00
|
|
|
|
{$sql = "update mdstatus set status='$status',ts_accepted='now()' where id in ($id)"; }
|
2011-10-11 02:25:26 +00:00
|
|
|
|
else if($status==5)
|
2011-10-11 04:01:17 +00:00
|
|
|
|
{$sql = "update mdstatus set status='$status',ts_finished='now()' where id in ($id)";}
|
2011-10-11 02:25:26 +00:00
|
|
|
|
else
|
|
|
|
|
{$sql = "update mdstatus set status='$status' where id in ($id)";}
|
2011-09-30 07:32:21 +00:00
|
|
|
|
try{
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
catch(Exception $e)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}//changestatus 更改状态
|
|
|
|
|
|
2011-09-28 07:24:09 +00:00
|
|
|
|
function acceptAction()
|
|
|
|
|
{
|
2011-09-30 02:32:52 +00:00
|
|
|
|
$search = $this->_request->getParam('search');
|
2011-09-30 07:15:08 +00:00
|
|
|
|
$cancel = $this->_request->getParam('cancel');
|
2011-09-30 07:32:21 +00:00
|
|
|
|
$update = $this->_request->getParam('update');
|
2011-10-08 08:40:07 +00:00
|
|
|
|
$invite = $this->_request->getParam('invite');
|
2011-09-28 07:24:09 +00:00
|
|
|
|
|
2011-09-30 07:15:08 +00:00
|
|
|
|
if($cancel>0)
|
|
|
|
|
{
|
2011-09-30 07:32:21 +00:00
|
|
|
|
if($this->changestatus($cancel,-1))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('操作成功:已取消该数据的评审');
|
|
|
|
|
$this->_redirect("/admin/review/accept");
|
2011-09-30 07:15:08 +00:00
|
|
|
|
}
|
2011-09-30 07:32:21 +00:00
|
|
|
|
else{
|
|
|
|
|
$this->messenger->addMessage('操作失败');
|
2011-09-30 07:15:08 +00:00
|
|
|
|
$this->_redirect("/admin/review/accept");
|
|
|
|
|
}
|
2011-09-30 07:32:21 +00:00
|
|
|
|
}//取消元数据评审
|
2011-09-30 02:32:52 +00:00
|
|
|
|
if($search)
|
|
|
|
|
{
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
if(!empty($keyword))
|
|
|
|
|
{
|
2011-10-11 04:01:17 +00:00
|
|
|
|
$sql = "select m.*,u.username,u.realname from mdstatus m
|
2011-09-30 02:32:52 +00:00
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where m.status=1
|
|
|
|
|
and md.title like '%$keyword%'
|
|
|
|
|
";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
}
|
2011-09-30 07:15:08 +00:00
|
|
|
|
}//搜索
|
2011-09-30 02:32:52 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-11 04:01:17 +00:00
|
|
|
|
$sql = "select m.*,md.title,u.username,u.realname from mdstatus m
|
2011-09-30 02:32:52 +00:00
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where m.status=1";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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
|
|
|
|
|
|
|
|
|
|
function inreviewAction(){
|
|
|
|
|
|
2011-10-09 03:49:20 +00:00
|
|
|
|
$show = $this->_request->getParam('show');
|
|
|
|
|
$search = $this->_request->getParam('search');
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
|
|
|
|
|
if($show>0)
|
|
|
|
|
{
|
|
|
|
|
|
2011-10-11 02:25:26 +00:00
|
|
|
|
$sql = "select m.*,md.*,u.realname from mdstatus m
|
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where m.id=$show
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetch();
|
|
|
|
|
|
|
|
|
|
$sql = "select exp.*,u.* from mdexpertreview exp
|
|
|
|
|
left join users u on u.id=exp.id
|
|
|
|
|
where exp.uuid='{$rows['uuid']}'";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$exps = $rs->fetchAll();
|
|
|
|
|
|
|
|
|
|
$expname = array();
|
|
|
|
|
|
|
|
|
|
foreach ($exps as $k=>$v)
|
|
|
|
|
{
|
|
|
|
|
if($v['id']!='')
|
2011-10-17 08:51:10 +00:00
|
|
|
|
{
|
|
|
|
|
if($v['status']==1)
|
|
|
|
|
{
|
|
|
|
|
$v['status']="接受邀请";
|
|
|
|
|
}else if($v['status']==-1)
|
|
|
|
|
{
|
|
|
|
|
$v['status']="拒绝邀请";
|
|
|
|
|
}else if(empty($v['status']))
|
|
|
|
|
{
|
|
|
|
|
$v['status']="未答复";
|
|
|
|
|
}
|
|
|
|
|
$expname[] = '<li><a href="/admin/user/show/id/'.$v['id'].'">'.$v['realname'].'</a> [状态:'.$v['status'].']
|
2011-10-18 12:37:07 +00:00
|
|
|
|
[<a href="/admin/review/invite/user/'.$v['id'].'/uuid/'.$rows['uuid'].'/id/'.$show.'">再次发送邀请邮件</a>]</li>';
|
2011-10-17 08:51:10 +00:00
|
|
|
|
}
|
2011-10-11 02:25:26 +00:00
|
|
|
|
}
|
|
|
|
|
if(count($expname>0))
|
2011-10-17 08:51:10 +00:00
|
|
|
|
{$rows['exps'] = join('',$expname);}
|
2011-10-11 02:25:26 +00:00
|
|
|
|
|
2011-10-15 09:57:23 +00:00
|
|
|
|
$rows['status'] = $this->rewritestatus($rows['status']);
|
2011-10-11 02:25:26 +00:00
|
|
|
|
|
|
|
|
|
$this->view->info = $rows;
|
2011-10-09 10:15:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->_helper->viewRenderer('inreviewshow');
|
|
|
|
|
|
2011-10-09 03:49:20 +00:00
|
|
|
|
}//查看详细
|
|
|
|
|
else
|
|
|
|
|
{
|
2011-10-11 02:25:26 +00:00
|
|
|
|
|
|
|
|
|
$searchjoin = "";
|
|
|
|
|
if(!empty($search) && !empty($keyword))
|
|
|
|
|
{
|
|
|
|
|
$searchjoin = " and md.title like '%$keyword%'";
|
|
|
|
|
$this->view->keyword = $keyword;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sql = "select m.id,md.title,m.status,m.uuid from mdstatus m
|
2011-10-09 03:49:20 +00:00
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
2011-10-11 02:25:26 +00:00
|
|
|
|
where m.status in (2,3,4) $searchjoin";
|
2011-10-09 03:49:20 +00:00
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetchAll();
|
|
|
|
|
|
|
|
|
|
foreach ($rows as $k=>$v)
|
|
|
|
|
{
|
2011-10-15 09:57:23 +00:00
|
|
|
|
$rows[$k]['status']=$this->rewritestatus($v['status']);
|
2011-10-09 03:49:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
}//列表
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//在审元数据
|
2011-09-30 02:32:52 +00:00
|
|
|
|
|
2011-10-10 09:26:05 +00:00
|
|
|
|
function inviteAction(){//邀请
|
2011-10-08 08:40:07 +00:00
|
|
|
|
|
2011-10-19 04:03:13 +00:00
|
|
|
|
$id = $this->_request->getParam('id');
|
|
|
|
|
$user = $this->_request->getParam('user');
|
2011-10-09 03:49:20 +00:00
|
|
|
|
if(empty($id))
|
|
|
|
|
{
|
|
|
|
|
$this->_redirect("/admin/review");
|
|
|
|
|
}
|
2011-10-08 08:40:07 +00:00
|
|
|
|
$search = $this->_request->getParam('search');
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
$submit = $this->_request->getParam('submit');
|
|
|
|
|
$exps = $this->_request->getParam('exps');
|
|
|
|
|
|
|
|
|
|
$stid = $this->_request->getParam('stid');
|
|
|
|
|
$uid = $this->_request->getParam('uid');
|
|
|
|
|
|
|
|
|
|
$this->view->id = $id;
|
|
|
|
|
|
2011-10-08 09:02:42 +00:00
|
|
|
|
if(!empty($submit))
|
2011-10-08 08:40:07 +00:00
|
|
|
|
{
|
2011-10-08 09:02:42 +00:00
|
|
|
|
if(is_array($exps))
|
|
|
|
|
{
|
2011-10-11 07:10:31 +00:00
|
|
|
|
$sql = "select m.uuid,m.title,s.status from metadata m
|
2011-10-09 03:49:20 +00:00
|
|
|
|
left join mdstatus s on s.uuid=m.uuid
|
|
|
|
|
where s.id='$id'";
|
|
|
|
|
|
|
|
|
|
$rs = $this -> db -> query($sql);
|
2011-10-10 09:26:05 +00:00
|
|
|
|
$md = $rs -> fetch();
|
2011-10-09 03:49:20 +00:00
|
|
|
|
|
|
|
|
|
$uuid = $md['uuid'];
|
|
|
|
|
|
|
|
|
|
foreach ($exps as $v)
|
|
|
|
|
{
|
2011-10-11 01:33:06 +00:00
|
|
|
|
$sql = "select m.id,u.realname,m.uuid,u.email from mdexpertreview m
|
2011-10-10 09:26:05 +00:00
|
|
|
|
left join users u on m.id=u.id
|
|
|
|
|
where m.uuid='$uuid' and m.id='$v'";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetch();
|
|
|
|
|
if($rows['id']!='')
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('已经邀请过专家:'.$rows['realname']);
|
|
|
|
|
}//已经有评审记录
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$sql = "insert into mdexpertreview (id,uuid) values ('$v','$uuid')";
|
2011-10-13 12:58:57 +00:00
|
|
|
|
$expinfo="select realname,email from users where id='$v'";
|
2011-10-13 07:54:02 +00:00
|
|
|
|
$rs = $this->db->query($expinfo);
|
|
|
|
|
$expinfo = $rs->fetch();
|
|
|
|
|
|
2011-10-10 09:26:05 +00:00
|
|
|
|
try{
|
2011-10-11 07:10:31 +00:00
|
|
|
|
if($this->db->exec($sql)>0)
|
2011-10-10 09:26:05 +00:00
|
|
|
|
{
|
2011-10-11 07:10:31 +00:00
|
|
|
|
if($md['status']<2)
|
|
|
|
|
{
|
|
|
|
|
$update = "update mdstatus set status=2 where uuid='$uuid'";
|
2011-10-13 07:54:02 +00:00
|
|
|
|
@$this->db->exec($update);
|
2011-10-11 07:10:31 +00:00
|
|
|
|
}
|
2011-10-13 12:58:57 +00:00
|
|
|
|
//实例化EmailText
|
|
|
|
|
$mailtp=new EmailText($this->db,'invite-expert-review',array('user'=>$expinfo['realname'],'uuid'=>$uuid,'title'=>$md['title']));
|
2011-10-10 09:26:05 +00:00
|
|
|
|
$mail=new WestdcMailer($this->view->config->smtp);
|
2011-10-13 12:58:57 +00:00
|
|
|
|
$mail->setBodyText($mailtp->getBody());
|
2011-10-10 09:26:05 +00:00
|
|
|
|
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
2011-10-13 12:58:57 +00:00
|
|
|
|
$mail->addTo($expinfo['email']);
|
2011-10-14 07:22:15 +00:00
|
|
|
|
$mail->setSubject($mailtp->getSubject());
|
2011-10-17 09:56:55 +00:00
|
|
|
|
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/review/1/uuid/'.$uuid);
|
2011-10-14 07:22:15 +00:00
|
|
|
|
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $md['title'].'.doc');
|
2011-10-10 09:26:05 +00:00
|
|
|
|
if($mail->send())
|
|
|
|
|
{
|
2011-10-13 07:54:02 +00:00
|
|
|
|
$this->messenger->addMessage('成功邀请专家:'.$expinfo['realname']);
|
2011-10-10 09:26:05 +00:00
|
|
|
|
}else
|
|
|
|
|
{
|
2011-10-13 07:54:02 +00:00
|
|
|
|
$this->messenger->addMessage('邀请专家'.$expinfo['realname'].'的邮件发送失败,请尝试手动发送邀请邮件');
|
2011-10-10 09:26:05 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception $e){
|
|
|
|
|
$this->messenger->addMessage('邀请失败:'.$e->getMessage());
|
|
|
|
|
}
|
|
|
|
|
}//不存在原来的记录
|
2011-10-10 09:41:45 +00:00
|
|
|
|
}//循环结束
|
|
|
|
|
$this->_redirect("/admin/review/invite/?id=$id");
|
2011-10-09 03:49:20 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('请选择要邀请的专家');
|
|
|
|
|
$this->_redirect("/admin/review/invite/?id=$id");
|
2011-10-08 09:02:42 +00:00
|
|
|
|
}
|
2011-10-19 04:03:13 +00:00
|
|
|
|
} elseif ($user>0) {
|
|
|
|
|
$uuid=$this->_request->getParam('uuid');
|
|
|
|
|
$sql="update mdexpertreview set ts_modified=now() where id='$user' and uuid='$uuid'";
|
|
|
|
|
$this->db->exec($sql);
|
|
|
|
|
$sql="select realname,email,(select title from metadata where uuid='$uuid') as title from users where id='$user'";
|
|
|
|
|
$row=$this->db->fetchRow($sql);
|
2011-10-18 12:37:07 +00:00
|
|
|
|
//实例化EmailText
|
|
|
|
|
$mailtp=new EmailText($this->db,'invite-expert-review',array('user'=>$row['realname'],'uuid'=>$uuid,'title'=>$row['title']));
|
|
|
|
|
$mail=new WestdcMailer($this->view->config->smtp);
|
|
|
|
|
$mail->setBodyText($mailtp->getBody());
|
|
|
|
|
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
|
|
|
|
$mail->addTo($row['email']);
|
|
|
|
|
$mail->setSubject($mailtp->getSubject());
|
|
|
|
|
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/data/doc/review/1/uuid/'.$uuid);
|
2011-10-21 08:12:04 +00:00
|
|
|
|
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.doc');
|
2011-10-18 12:37:07 +00:00
|
|
|
|
if($mail->send())
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('成功再次邀请专家:'.$row['realname']);
|
2011-10-21 08:12:04 +00:00
|
|
|
|
$this->_redirect("/admin/review/inreview/show/$id");
|
2011-10-18 12:37:07 +00:00
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('邀请专家'.$row['realname'].'的邮件发送失败,请尝试手动发送邀请邮件');
|
2011-10-21 08:12:04 +00:00
|
|
|
|
$this->_redirect("/admin/review/inreview/show/$id");
|
2011-10-19 04:03:13 +00:00
|
|
|
|
}
|
2011-10-08 08:40:07 +00:00
|
|
|
|
}
|
2011-10-09 03:49:20 +00:00
|
|
|
|
$searchjoin = "";
|
|
|
|
|
if(!empty($search) && !empty($keyword))
|
|
|
|
|
{
|
|
|
|
|
$searchjoin = " where u.username like '%$keyword%'
|
|
|
|
|
or u.realname like '%$keyword%'
|
|
|
|
|
or u.unit like '%$keyword%'
|
|
|
|
|
or u.email like '%$keyword%'";
|
|
|
|
|
$this->view->keyword = $keyword;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-10 09:26:05 +00:00
|
|
|
|
$sql = "select me.id,u.username,u.realname,u.unit,u.phone,u.email from users u
|
2011-10-09 03:49:20 +00:00
|
|
|
|
right join mdexperts me on u.id=me.id
|
|
|
|
|
$searchjoin";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
$sql = "select m.title from metadata m
|
|
|
|
|
left join mdstatus s on s.uuid=m.uuid
|
|
|
|
|
where s.id='$id'";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$title = $re->fetch();
|
|
|
|
|
$this->view->md=$title;
|
2011-10-08 09:02:42 +00:00
|
|
|
|
|
2011-10-10 09:26:05 +00:00
|
|
|
|
}//邀请专家
|
2011-10-08 08:40:07 +00:00
|
|
|
|
|
2011-10-12 09:50:04 +00:00
|
|
|
|
function changeadminAction(){
|
|
|
|
|
|
|
|
|
|
$id = $this->_request->getParam('id');
|
|
|
|
|
$uid = $this->_request->getParam('uid');
|
|
|
|
|
if(empty($id))
|
|
|
|
|
{
|
|
|
|
|
$this->_redirect("/admin/review");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->view->id = $id;
|
|
|
|
|
|
|
|
|
|
if(!empty($uid))
|
|
|
|
|
{
|
|
|
|
|
$sql = "update mdstatus set userid='$uid' where id='$id'";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('更改管理员成功');
|
|
|
|
|
$this->_redirect("/admin/review/changeadmin/?id=$id");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql = "select u.* from users u
|
|
|
|
|
where usertype='administrator'";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
}//改变管理员
|
|
|
|
|
|
2011-09-28 07:24:09 +00:00
|
|
|
|
|
2011-09-29 09:31:10 +00:00
|
|
|
|
function addonAction(){
|
|
|
|
|
|
|
|
|
|
$uuid=$this->_request->getParam('uuid');
|
|
|
|
|
|
|
|
|
|
$sql = "select * from mdstatus where uuid='$uuid'";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$row = $re->fetch();
|
|
|
|
|
|
|
|
|
|
if(empty($row['id']))
|
|
|
|
|
{
|
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
|
if($auth->hasIdentity())
|
|
|
|
|
{
|
|
|
|
|
$user = $auth->getIdentity();
|
|
|
|
|
$userid = $user->id;
|
2011-10-10 07:52:42 +00:00
|
|
|
|
$sql = "insert into mdstatus (uuid,userid,ts_scheduled,status) values ('$uuid','$userid','".date("Y-m-d H:i:s")."','0')";
|
2011-09-29 09:31:10 +00:00
|
|
|
|
try{
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('操作成功!该数据已放入评审');
|
2011-10-10 07:52:42 +00:00
|
|
|
|
$this->_redirect("/admin/review/draft");
|
2011-09-29 09:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
}catch( Exception $e){
|
|
|
|
|
$this->messenger->addMessage('操作失败:'.$e->getMessage());
|
2011-10-10 07:52:42 +00:00
|
|
|
|
$this->_redirect("/admin/review/draft");
|
2011-09-29 09:31:10 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('该数据已放入评审');
|
|
|
|
|
$this->_redirect("/admin/data/md");
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-30 02:32:52 +00:00
|
|
|
|
}//将数据放入评审
|
2011-09-29 09:31:10 +00:00
|
|
|
|
|
2011-09-30 03:25:37 +00:00
|
|
|
|
function myreviewAction(){
|
|
|
|
|
|
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
|
if($auth->hasIdentity())
|
|
|
|
|
{
|
|
|
|
|
$user = $auth->getIdentity();
|
|
|
|
|
$userid = $user->id;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$search=$this->_request->getParam('search');
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
|
|
|
|
|
$searchjoin = "";
|
|
|
|
|
if(!empty($search) && !empty($keyword))
|
|
|
|
|
{
|
|
|
|
|
$searchjoin = " and md.title like '%$keyword%'";
|
|
|
|
|
$this->view->keyword = $keyword;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-20 02:05:30 +00:00
|
|
|
|
$sql = "select m.id,md.uuid,md.title,u.username,u.realname,m.status from mdstatus m
|
2011-09-30 03:25:37 +00:00
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where u.id='$userid' $searchjoin";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
|
|
|
$paginator->setItemCountPerPage($this->view->config->page->max);
|
|
|
|
|
$paginator->setView($this->view);
|
|
|
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
2011-09-30 07:15:08 +00:00
|
|
|
|
$this->view->paginator=$paginator;
|
|
|
|
|
}//我管理的元数据
|
2011-09-30 03:25:37 +00:00
|
|
|
|
|
2011-10-21 02:13:27 +00:00
|
|
|
|
function postAction(){
|
|
|
|
|
|
|
|
|
|
$id = $this->_request->getParam('id');
|
|
|
|
|
|
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
|
if($auth->hasIdentity())
|
|
|
|
|
{
|
|
|
|
|
$user = $auth->getIdentity();
|
|
|
|
|
$userid = $user->id;
|
|
|
|
|
|
|
|
|
|
$sql = "select id from mdstatus where userid='$userid'";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$row = $rs->fetch();
|
|
|
|
|
|
|
|
|
|
if(!empty($row['id']))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if($this->changestatus($id,5))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('操作成功:该元数据意见成功发布');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}else{
|
|
|
|
|
$this->messenger->addMessage('操作失败');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
$this->messenger->addMessage('您没有权限操作其他管理员管理的元数据评审');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('权限读取失败');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-10 07:52:42 +00:00
|
|
|
|
function draftAction(){
|
|
|
|
|
|
|
|
|
|
$search=$this->_request->getParam('search');
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
$update = $this->_request->getParam('update');
|
|
|
|
|
|
|
|
|
|
if($update>0 || is_array($update))
|
|
|
|
|
{
|
|
|
|
|
$ids = '';
|
|
|
|
|
if(is_array($update))$ids = join(',',$update);
|
|
|
|
|
else $ids=$update;
|
|
|
|
|
|
2011-10-10 08:21:02 +00:00
|
|
|
|
if($this->changestatus($ids,1))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('操作成功!');
|
2011-10-10 07:52:42 +00:00
|
|
|
|
$this->_redirect("/admin/review/draft");
|
2011-10-10 08:21:02 +00:00
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$this->messenger->addMessage('操作失败');
|
|
|
|
|
$this->_redirect("/admin/review/accept");
|
2011-10-10 07:52:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}//开始评审
|
|
|
|
|
|
|
|
|
|
$searchjoin = "";
|
|
|
|
|
if(!empty($search) && !empty($keyword))
|
|
|
|
|
{
|
|
|
|
|
$searchjoin = " and md.title like '%$keyword%'";
|
|
|
|
|
$this->view->keyword = $keyword;
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-11 04:01:17 +00:00
|
|
|
|
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status,m.ts_created from mdstatus m
|
2011-10-10 07:52:42 +00:00
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where status=0 $searchjoin";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
2011-10-10 08:21:02 +00:00
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
}// draftAction 投稿元数据
|
|
|
|
|
|
|
|
|
|
function canceledAction(){
|
|
|
|
|
|
|
|
|
|
$search=$this->_request->getParam('search');
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
$update = $this->_request->getParam('update');
|
|
|
|
|
|
|
|
|
|
if($update>0 || is_array($update))
|
|
|
|
|
{
|
|
|
|
|
$ids = '';
|
|
|
|
|
if(is_array($update))$ids = join(',',$update);
|
|
|
|
|
else $ids=$update;
|
|
|
|
|
|
|
|
|
|
if($this->changestatus($ids,0))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('操作成功!');
|
|
|
|
|
$this->_redirect("/admin/review/canceled");
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
$this->messenger->addMessage('操作失败'.$ids);
|
|
|
|
|
$this->_redirect("/admin/review/canceled");
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-14 07:22:15 +00:00
|
|
|
|
}//取消评审
|
2011-10-10 08:21:02 +00:00
|
|
|
|
|
|
|
|
|
$searchjoin = "";
|
|
|
|
|
if(!empty($search) && !empty($keyword))
|
2011-10-10 07:52:42 +00:00
|
|
|
|
{
|
2011-10-10 08:21:02 +00:00
|
|
|
|
$searchjoin = " and md.title like '%$keyword%'";
|
|
|
|
|
$this->view->keyword = $keyword;
|
2011-10-10 07:52:42 +00:00
|
|
|
|
}
|
|
|
|
|
|
2011-10-10 08:21:02 +00:00
|
|
|
|
$sql = "select m.id,md.title,md.uuid,u.username,u.realname,m.status from mdstatus m
|
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where status=-1 $searchjoin";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
2011-10-10 07:52:42 +00:00
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
|
2011-10-10 08:21:02 +00:00
|
|
|
|
}//被取消评审的元数据
|
2011-10-10 07:52:42 +00:00
|
|
|
|
|
2011-10-14 07:22:15 +00:00
|
|
|
|
function reviewedAction(){
|
|
|
|
|
|
|
|
|
|
$search=$this->_request->getParam('search');
|
|
|
|
|
$keyword = $this->_request->getParam('keyword');
|
|
|
|
|
|
|
|
|
|
$searchjoin = "";
|
|
|
|
|
if(!empty($search) && !empty($keyword))
|
|
|
|
|
{
|
|
|
|
|
$searchjoin = " and md.title like '%$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
|
|
|
|
|
left join metadata md on md.uuid=m.uuid
|
|
|
|
|
left join users u on u.id=m.userid
|
|
|
|
|
where status=5 $searchjoin";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
}//已结束评审
|
|
|
|
|
|
2011-10-28 02:01:47 +00:00
|
|
|
|
function deleteAction(){
|
|
|
|
|
|
|
|
|
|
$id=$this->_request->getParam('id');
|
|
|
|
|
try{
|
|
|
|
|
$auth = Zend_Auth::getInstance();
|
|
|
|
|
if($auth->hasIdentity())
|
|
|
|
|
{
|
|
|
|
|
$user = $auth->getIdentity();
|
|
|
|
|
$userid = $user->id;
|
|
|
|
|
|
|
|
|
|
$sql = "select id from mdstatus where userid='$userid' and id='$id'";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$row = $rs->fetch();
|
|
|
|
|
|
|
|
|
|
if(!empty($row['id']))
|
|
|
|
|
{
|
|
|
|
|
$sql = "delete from mdstatus where id='$id'";
|
|
|
|
|
if($this->db->exec($sql))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('删除成功');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}else{
|
|
|
|
|
$this->messenger->addMessage('删除失败');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else{
|
|
|
|
|
|
|
|
|
|
$this->messenger->addMessage('您没有权限操作其他管理员管理的元数据评审');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}else
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('权限读取失败');
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}
|
|
|
|
|
}catch(Exception $e){
|
|
|
|
|
$this->messenger->addMessage('删除失败:'.$e->getMessage());
|
|
|
|
|
$this->_redirect("/admin/review/myreview");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2011-09-28 07:24:09 +00:00
|
|
|
|
function expertsAction()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$search = $this->_request->getParam('search');
|
|
|
|
|
$keyword= $this->_request->getParam('keyword');
|
|
|
|
|
$submit = $this->_request->getParam('submit');
|
|
|
|
|
$edit = $this->_request->getParam('edit');
|
|
|
|
|
$del = $this->_request->getParam('del');
|
|
|
|
|
$add = $this->_request->getParam('add');
|
|
|
|
|
|
|
|
|
|
if($add)
|
|
|
|
|
{
|
|
|
|
|
if(!empty($submit))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
foreach($_POST as $k=>$v)
|
|
|
|
|
{
|
|
|
|
|
$$k=$v;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$speciality = $_POST['speciality'];
|
|
|
|
|
|
|
|
|
|
$chars = array(
|
|
|
|
|
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k",
|
|
|
|
|
"l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v",
|
|
|
|
|
"w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G",
|
|
|
|
|
"H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R",
|
|
|
|
|
"S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2",
|
|
|
|
|
"3", "4", "5", "6", "7", "8", "9"
|
|
|
|
|
);
|
|
|
|
|
$charsLen = count($chars) - 1;
|
|
|
|
|
|
|
|
|
|
shuffle($chars);
|
|
|
|
|
|
|
|
|
|
$output = "";
|
|
|
|
|
for ($i=0; $i<8; $i++)
|
|
|
|
|
{
|
|
|
|
|
$output .= $chars[mt_rand(0, $charsLen)];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$password=$output;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$testsql="select id from users where username='$username' or email='$email'";
|
|
|
|
|
$re=$this->db->query($testsql);
|
|
|
|
|
$test=$re->fetch();
|
|
|
|
|
|
|
|
|
|
if(!empty($test['id']))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('用户名或邮箱重复');
|
|
|
|
|
$this->_redirect("/admin/review/experts");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$data = array(
|
|
|
|
|
'username' => $username,
|
|
|
|
|
'realname' => $realname,
|
|
|
|
|
'email' => $email,
|
|
|
|
|
'unit' => $unit,
|
|
|
|
|
'address' => $address,
|
|
|
|
|
'phone' => $phone,
|
|
|
|
|
'project' => $project,
|
|
|
|
|
'password' => md5($password)
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if($this->db->insert('users',$data))
|
|
|
|
|
{
|
2011-10-14 07:22:15 +00:00
|
|
|
|
$mail=new WestdcMailer($this->view->config->smtp);
|
2011-10-13 12:58:57 +00:00
|
|
|
|
$mailtp=new EmailText($this->db,'expert-register',array('user'=>$username,'password'=>$password));
|
|
|
|
|
$mail->setBodyText($mailtp->getBody());
|
2011-09-28 07:24:09 +00:00
|
|
|
|
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
|
|
|
|
|
$mail->addTo($email);
|
2011-10-13 12:58:57 +00:00
|
|
|
|
$mail->setSubject($mailtp->getSubject());
|
2011-09-28 07:24:09 +00:00
|
|
|
|
$mail->send();
|
|
|
|
|
|
|
|
|
|
$sql="select id from users where username='{$data['username']}'";
|
|
|
|
|
$re=$this->db->query($sql);
|
|
|
|
|
$row = $re->fetch();
|
|
|
|
|
|
|
|
|
|
$sql="insert into mdexperts (id,speciality) values ('{$row['id']}','$speciality')";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('成功添加评审专家');
|
|
|
|
|
$this->_redirect("/admin/review/experts");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$this->_helper->viewRenderer('expertsadd');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($del>0)
|
|
|
|
|
{
|
|
|
|
|
$sql="delete from mdexperts where id='$del'";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('删除成功!');
|
|
|
|
|
$this->_redirect('/admin/review/experts');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if($edit>0)
|
|
|
|
|
{
|
|
|
|
|
if(!empty($submit))
|
|
|
|
|
{
|
|
|
|
|
$speciality = $this->_request->getParam('speciality');
|
|
|
|
|
$sql = "update mdexperts set speciality='$speciality',ts_modified='".date("Y-m-d H:i:s",time())."' where id='$edit'";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('编辑成功!');
|
|
|
|
|
$this->_redirect('/admin/review/experts');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql = "select m.*,m.id as mid,u.* from mdexperts m left join users u on u.id=m.id
|
|
|
|
|
where m.id='$edit'";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$row = $re->fetch();
|
|
|
|
|
$this->view->infos = $row;
|
|
|
|
|
$this->view->id=$edit;
|
|
|
|
|
|
|
|
|
|
$this->_helper->viewRenderer('expertsedit');
|
|
|
|
|
}
|
|
|
|
|
}//编辑
|
|
|
|
|
|
|
|
|
|
if($search)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$sql = "select m.*,m.id as mid,u.* from mdexperts m left join users u on u.id=m.id
|
|
|
|
|
where u.realname like '%$keyword%' or m.speciality like '%$keyword%' or u.unit like '%$keyword%'";
|
|
|
|
|
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$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;
|
|
|
|
|
|
|
|
|
|
}//搜索
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql="select m.*,m.id as mid,u.* from mdexperts m left join users u on u.id=m.id";
|
|
|
|
|
$re = $this->db->query($sql);
|
|
|
|
|
$rows = $re->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
|
|
|
$paginator->setItemCountPerPage($this->view->config->page->max);
|
|
|
|
|
$paginator->setView($this->view);
|
|
|
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
|
|
|
$this->view->paginator=$paginator;
|
|
|
|
|
}//列表
|
|
|
|
|
|
|
|
|
|
|
2011-10-19 04:03:13 +00:00
|
|
|
|
}//expertsAction 专家库
|
|
|
|
|
|
|
|
|
|
function commentsAction(){
|
|
|
|
|
|
|
|
|
|
$ac = $this->_request->getParam('ac');
|
|
|
|
|
$uuid = $this->_request->getParam('uuid');
|
|
|
|
|
$id = $this->_request->getParam('id');
|
|
|
|
|
$q = $this->_request->getParam('q');
|
|
|
|
|
$search = $this->_request->getParam('search');
|
|
|
|
|
|
2011-10-19 07:40:15 +00:00
|
|
|
|
if($ac=='view' && !empty($id))
|
2011-10-19 04:03:13 +00:00
|
|
|
|
{
|
2011-10-19 07:40:15 +00:00
|
|
|
|
$redirect = "/admin/review/comments/ac/view/id/$id";
|
2011-10-19 04:03:13 +00:00
|
|
|
|
|
2011-10-19 07:40:15 +00:00
|
|
|
|
if(!is_numeric($id))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('参数不正确,请按正确的步骤进行访问');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
|
2011-11-08 08:00:24 +00:00
|
|
|
|
$sql = "select r.*,md.title,u.realname,u.id as uid from mdreview r
|
2011-10-19 07:40:15 +00:00
|
|
|
|
left join metadata md on md.uuid=r.uuid
|
|
|
|
|
left join users u on u.id=r.userid
|
|
|
|
|
where r.id='$id'
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
|
|
|
|
|
$row = $rs->fetch();
|
|
|
|
|
|
2011-11-08 08:00:24 +00:00
|
|
|
|
$sql = "select att.realname,att.id from attachments att
|
|
|
|
|
left join mdreviewattach ratt on att.id=ratt.attachid
|
|
|
|
|
where ratt.reviewid=$id";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetchAll();
|
|
|
|
|
|
|
|
|
|
$row['attid'] = "";
|
|
|
|
|
if(!empty($rows))
|
2011-10-19 07:40:15 +00:00
|
|
|
|
{
|
2011-11-08 08:00:24 +00:00
|
|
|
|
foreach($rows as $v)
|
|
|
|
|
{
|
|
|
|
|
$row['attid'] .= '<li>'.$v['realname'].'<a href="/admin/data/attachments/down/'.$v['id'].'">下载</a></li>';
|
|
|
|
|
}
|
2011-10-19 07:40:15 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$row['attid'] = '无附件';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$this->view->info = $row;
|
2011-10-19 04:03:13 +00:00
|
|
|
|
|
2011-10-19 07:40:15 +00:00
|
|
|
|
$this->_helper->viewRenderer('commentsview');
|
2011-10-19 04:03:13 +00:00
|
|
|
|
|
|
|
|
|
}//查看单个元数据的评审
|
|
|
|
|
|
|
|
|
|
else if($ac=='list')
|
|
|
|
|
{
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
$redirect = "/admin/review/comments/ac/list/";
|
|
|
|
|
|
|
|
|
|
$wheresql = array();
|
|
|
|
|
|
2011-10-19 09:18:46 +00:00
|
|
|
|
$userid = $this->_request->getParam('userid');
|
|
|
|
|
|
|
|
|
|
if(!empty($userid))
|
|
|
|
|
{
|
|
|
|
|
$redirect.="/uuid/$userid";
|
|
|
|
|
$wheresql[] = " r.userid='$userid' ";
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-19 04:03:13 +00:00
|
|
|
|
if(!empty($uuid))
|
|
|
|
|
{
|
|
|
|
|
$redirect.="/uuid/$uuid";
|
|
|
|
|
$wheresql[] = " md.uuid='$uuid' ";
|
|
|
|
|
}
|
|
|
|
|
|
2011-10-31 08:35:56 +00:00
|
|
|
|
$wheresql[]=' r.status>-1 ';
|
|
|
|
|
|
2011-10-19 04:03:13 +00:00
|
|
|
|
if(!empty($q) && !empty($search))
|
|
|
|
|
{
|
|
|
|
|
if (preg_match("/[<|>|#|$|%|^|*|(|)|{|}|'|\"|;|:]/i",$q) || !is_numeric($search))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('您的输入的搜索条件包含非法请求,请不要输入特殊符号');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
$this->view->q = $q;
|
|
|
|
|
$wheresql[] = " (md.title like '%$q%' or u.realname like '%$q%') ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count($wheresql>0))$wheresql = join(' and ',$wheresql);
|
|
|
|
|
else $wheresql='';
|
|
|
|
|
|
|
|
|
|
if($wheresql!='')
|
|
|
|
|
{
|
|
|
|
|
$wheresql = 'where '.$wheresql;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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 users u on u.id=r.userid
|
|
|
|
|
$wheresql
|
2011-10-19 09:35:18 +00:00
|
|
|
|
order by r.ts_created desc
|
2011-10-19 04:03:13 +00:00
|
|
|
|
";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
|
|
|
$paginator->setItemCountPerPage($this->view->config->page->max);
|
|
|
|
|
$paginator->setView($this->view);
|
|
|
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
|
|
|
$this->view->paginator=$paginator;
|
|
|
|
|
}catch(Exception $e){
|
|
|
|
|
echo $e->getMessage().'<br />';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->_helper->viewRenderer('commentslist');
|
|
|
|
|
}//评审意见列表 or 某条元数据的评审意见列表
|
|
|
|
|
|
2011-10-19 09:18:46 +00:00
|
|
|
|
else if($ac=='listbyuser')
|
|
|
|
|
{
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
$redirect = "/admin/review/comments/ac/list/";
|
|
|
|
|
|
|
|
|
|
$wheresql = array();
|
|
|
|
|
|
2011-10-31 08:35:56 +00:00
|
|
|
|
$wheresql[]=' r.status>-1 ';
|
|
|
|
|
|
2011-10-19 09:18:46 +00:00
|
|
|
|
if(!empty($q) && !empty($search))
|
|
|
|
|
{
|
|
|
|
|
if (preg_match("/[<|>|#|$|%|^|*|(|)|{|}|'|\"|;|:]/i",$q) || !is_numeric($search))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('您的输入的搜索条件包含非法请求,请不要输入特殊符号');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
$this->view->q = $q;
|
|
|
|
|
$wheresql[] = " u.realname like '%$q%' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count($wheresql>0))$wheresql = join(' and ',$wheresql);
|
|
|
|
|
else $wheresql='';
|
|
|
|
|
|
|
|
|
|
if($wheresql!='')
|
|
|
|
|
{
|
|
|
|
|
$wheresql = 'where '.$wheresql;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$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 users u on u.id=r.userid
|
|
|
|
|
$wheresql
|
|
|
|
|
GROUP BY u.id,u.realname
|
|
|
|
|
";
|
|
|
|
|
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
|
|
|
$paginator->setItemCountPerPage($this->view->config->page->max);
|
|
|
|
|
$paginator->setView($this->view);
|
|
|
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
|
|
|
$this->view->paginator=$paginator;
|
|
|
|
|
}catch(Exception $e){
|
|
|
|
|
echo $e->getMessage().'<br />';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$this->_helper->viewRenderer('commentslistbyuser');
|
|
|
|
|
}//按评审用户查看
|
|
|
|
|
|
2011-10-19 08:27:24 +00:00
|
|
|
|
else if($ac=='del' && !empty($id))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$redirect = "/admin/review/comments/ac/list/";
|
|
|
|
|
|
|
|
|
|
if(!is_numeric($id))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('参数不正确,请按正确的步骤进行访问');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sql = "select r.id,att.filename,ratt.attachid as attid from mdreview r
|
|
|
|
|
left join mdreviewattach ratt on ratt.reviewid=r.id
|
|
|
|
|
left join attachments att on att.id=ratt.attachid
|
|
|
|
|
where r.id='$id'";
|
|
|
|
|
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
|
|
|
|
|
$row = $rs->fetch();
|
|
|
|
|
|
|
|
|
|
if(!empty($row['filename']))
|
|
|
|
|
{
|
|
|
|
|
//需要删除文件,通过Zend_Registry::get('upload')获得上传文件的根目录
|
|
|
|
|
$basepath = Zend_Registry::get('upload');
|
|
|
|
|
$filepath = $basepath.$row['filename'];
|
|
|
|
|
|
|
|
|
|
if(unlink($filepath))
|
|
|
|
|
{
|
|
|
|
|
$sql = "delete from mdreview where id='$id'";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('评审意见删除成功!');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
$sql = "delete from mdreview where id='$id'";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('评审意见删除成功!但附件删除失败,请手动删除文件:'.$row['filename']);
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}else{
|
|
|
|
|
$sql = "delete from mdreview where id='$id'";
|
|
|
|
|
if($this->db->exec($sql)>0)
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('评审意见删除成功!');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}//删除评审意见 同时删除附件
|
|
|
|
|
|
2011-10-31 09:08:38 +00:00
|
|
|
|
else if($ac=='rollback' && !empty($id))
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
$redirect = "/admin/review/comments/ac/list/";
|
|
|
|
|
|
|
|
|
|
$sql = "update mdreview set status=-1 where id=$id";
|
|
|
|
|
|
|
|
|
|
try{
|
|
|
|
|
|
|
|
|
|
if($this->db->exec($sql))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('更改成功');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}else{
|
|
|
|
|
$this->messenger->addMessage('更新失败');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}catch(Exception $e){
|
|
|
|
|
$this->messenger->addMessage('更新失败:'.$e->getMessage());
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}//为用户重置为草稿状态
|
|
|
|
|
|
2011-10-19 04:03:13 +00:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
try{
|
|
|
|
|
$redirect = "/admin/review/comments";
|
|
|
|
|
|
|
|
|
|
$wheresql = array();
|
|
|
|
|
|
2011-10-31 08:35:56 +00:00
|
|
|
|
$wheresql[]=' r.status>-1 ';
|
|
|
|
|
|
2011-10-19 04:03:13 +00:00
|
|
|
|
if(!empty($q) && !empty($search))
|
|
|
|
|
{
|
|
|
|
|
if (preg_match("/[<|>|#|$|%|^|*|(|)|{|}|'|\"|;|:]/i",$q) || !is_numeric($search))
|
|
|
|
|
{
|
|
|
|
|
$this->messenger->addMessage('您的输入的搜索条件包含非法请求,请不要输入特殊符号');
|
|
|
|
|
$this->_redirect($redirect);
|
|
|
|
|
}//非法请求过滤
|
|
|
|
|
$this->view->q = $q;
|
|
|
|
|
$wheresql[] = " md.title like '%$q%' ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(count($wheresql>0))$wheresql = join(' and ',$wheresql);
|
|
|
|
|
else $wheresql='';
|
|
|
|
|
|
|
|
|
|
if($wheresql!='')
|
|
|
|
|
{
|
|
|
|
|
$wheresql = 'where '.$wheresql;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$sql = "select md.title,md.uuid,count(r.id) as c from mdreview r
|
|
|
|
|
left join metadata md on md.uuid=r.uuid
|
|
|
|
|
$wheresql
|
|
|
|
|
GROUP BY md.title,md.uuid
|
|
|
|
|
";
|
|
|
|
|
$rs = $this->db->query($sql);
|
|
|
|
|
$rows = $rs->fetchAll();
|
|
|
|
|
|
|
|
|
|
$paginator = Zend_Paginator::factory($rows);
|
|
|
|
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
|
|
|
|
$paginator->setItemCountPerPage($this->view->config->page->max);
|
|
|
|
|
$paginator->setView($this->view);
|
|
|
|
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
|
|
|
|
|
$this->view->paginator=$paginator;
|
|
|
|
|
}catch(Exception $e){
|
|
|
|
|
echo $e->getMessage().'<br />';
|
|
|
|
|
}
|
|
|
|
|
}//列表
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}//commentsAction 查看所有评审意见
|
2011-09-28 07:24:09 +00:00
|
|
|
|
}
|
|
|
|
|
|