使已经收到的离线申请也可以进行重置操作

This commit is contained in:
Li Jianxuan 2012-05-30 01:49:17 +00:00
parent cc6d854aa3
commit f27a31c567
1 changed files with 25 additions and 25 deletions

View File

@ -61,16 +61,16 @@ class Admin_DownController extends Zend_Controller_Action
//对每条数据的管理员用户发送相应的邮件通知,同一用户的邮件需要合并
//需要取出对应数据的标题、uuid以及对应的作者的email一条数据可能有多个作者一次申请可能有多条数据对应同一个作者
//邮件中应提示用户可以选择是否委托给数据中心进行管理(这样以后就不接受相应的管理邮件,但用户仍然可以自主取消此选择)
//邮件中应提示用户可以选择是否委托给数据中心进行管理(这样以后就不接受相应的管理邮件,但用户仍然可以自主取消此选择)
$uuid_done="";
// 0. 处理专题数据集
$sql="select s.admin_email as email,m.title,d.uuid,s.title as sourcetitle from dataorder d left join datasource ds on d.uuid=ds.uuid
left join source s on ds.sourceid=s.id left join metadata m on d.uuid=m.uuid
where d.offlineappid=? and s.admin_status=1 and d.uuid<>all(s.exclude_data)
order by s.admin_email,m.title";
$rows=$this->db->fetchAll($this->db->quoteInto($sql,$start));
// 0. 处理专题数据集
$sql="select s.admin_email as email,m.title,d.uuid,s.title as sourcetitle from dataorder d left join datasource ds on d.uuid=ds.uuid
left join source s on ds.sourceid=s.id left join metadata m on d.uuid=m.uuid
where d.offlineappid=? and s.admin_status=1 and d.uuid<>all(s.exclude_data)
order by s.admin_email,m.title";
$rows=$this->db->fetchAll($this->db->quoteInto($sql,$start));
$tmp_email='';
$data='';
$data='';
$source='';
foreach($rows as $row)
{
@ -84,20 +84,20 @@ class Admin_DownController extends Zend_Controller_Action
$mailtp=new EmailText($this->db,'offline-start-subject',array('user'=>$username,'datalist'=>$data,'source'=>$source));
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
$mail->setSubject($mailtp->getSubject());
$mail_addrs=explode(",",substr($tmp_email,1,-1));
$mail->addTo($mail_addrs);
$mail->addCc($this->view->config->service->email,'西部数据中心服务组');
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'offlineapp.pdf');
$mail->send();
$data="";
$data="";
$source="";
}
$tmp_email=$row['email'];
$tmp_email=$row['email'];
$source=$row['sourcetitle'];
}
$data.=" 数据名称:".$row['title']."\n";
$data.=" \t数据地址http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n";
$data.=" \t数据地址http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n";
$uuid_done.="'".$row['uuid']."',";
}
//发送最后一封邮件
@ -108,19 +108,19 @@ class Admin_DownController extends Zend_Controller_Action
$mailtp=new EmailText($this->db,'offline-start-author',array('user'=>$username,'datalist'=>$data,'source'=>$source));
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
$mail->setSubject($mailtp->getSubject());
$mail_addrs=explode(",",substr($tmp_email,1,-1));
$mail->addTo($mail_addrs);
$mail->addCc($this->view->config->service->email,'西部数据中心服务组');
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'offlineapp.pdf');
$mail->send();
}
}
// 1. 处理有数据作者且自行管理的数据并且未被0处理过的
$sql="select u.email,m.title,d.uuid,a.activation from dataorder d left join mdstatus s on d.uuid=s.uuid left join users u on s.userid=u.id
left join metadata m on m.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid
where d.offlineappid=? and s.status=6 and a.userid=s.userid ";
if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") ";
left join metadata m on m.uuid=d.uuid left join mdauthor a on a.uuid=d.uuid
where d.offlineappid=? and s.status=6 and a.userid=s.userid ";
if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") ";
$sql.=" order by u.email,m.title";
$rows=$this->db->fetchAll($this->db->quoteInto($sql,$start));
$tmp_email='';
@ -150,7 +150,7 @@ class Admin_DownController extends Zend_Controller_Action
$data.=" \t数据地址http://westdc.westgis.ac.cn/data/".$row['uuid']."\n";
$data.=" \t如您不想收到此类数据申请审核的邮件,您可以将该数据委托给数据中心代为审核,委托后您也可以随时撤销此委托以便继续自行管理。\n";
$data.=" \t如想委托给数据中心请访问此网址http://westdc.westgis.ac.cn/author/delegate/uuid/".$row['uuid']."\n";
$data.=" \t撤销委托方法:进入数据中心->数据作者->我的数据,在该数据条上撤销委托。\n\n";
$data.=" \t撤销委托方法:进入数据中心->数据作者->我的数据,在该数据条上撤销委托。\n\n";
$uuid_done.="'".$row['uuid']."',";
}
//发送最后一封邮件
@ -169,17 +169,17 @@ class Admin_DownController extends Zend_Controller_Action
}
// 2. 处理委托数据中心进行管理的数据
$sql="select m.title,d.uuid from dataorder d left join mdstatus s on d.uuid=s.uuid left join metadata m on m.uuid=d.uuid
$sql="select m.title,d.uuid from dataorder d left join mdstatus s on d.uuid=s.uuid left join metadata m on m.uuid=d.uuid
left join datasource ds on ds.uuid=d.uuid left join source on ds.sourceid=source.id
where d.offlineappid=? and (s.status=7 or source.admin_status=2) ";
if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") ";
where d.offlineappid=? and (s.status=7 or source.admin_status=2) ";
if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") ";
$sql.=" order by m.title";
$rows=$this->db->fetchAll($this->db->quoteInto($sql,$start));
$data="";
foreach($rows as $row)
{
$data.=" 数据名称:".$row['title']."\n";
$data.=" \t数据地址http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n";
$data.=" \t数据地址http://westdc.westgis.ac.cn/data/".$row['uuid']."\n\n";
$uuid_done.="'".$row['uuid']."',";
}
if (!empty($data))
@ -205,8 +205,8 @@ class Admin_DownController extends Zend_Controller_Action
//发送管理邮件同时建议用户认证为数据的作者,可以有更多的管理选择,同时邮件中应该有详细的说明为什么会收到此邮件
$sql="select distinct res.email,d.uuid,m.title,role.role from dataorder d left join role on d.uuid=role.uuid left join responsible res on role.resid=res.id
left join metadata m on d.uuid=m.uuid where length(res.email)>4 and d.offlineappid=?
and role.role in ('pointOfContact','custodian','resourceProvider','owner','distributor','publisher','author')";
if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") ";
and role.role in ('pointOfContact','custodian','resourceProvider','owner','distributor','publisher','author')";
if (!empty($uuid_done)) $sql.=" and d.uuid not in (".substr($uuid_done,0,-1).") ";
$sql.=" order by m.title,res.email";
$rows=$this->db->fetchAll($this->db->quoteInto($sql,$start));
unset($addrs);
@ -445,7 +445,7 @@ class Admin_DownController extends Zend_Controller_Action
}
else if($reset > 0)
{
$sql="update dataorder set status='1' where status='3' and offlineappid='$reset'";
$sql="update dataorder set status='1' where (status='3' or status='4') and offlineappid='$reset'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('已经成功对该申请重置');