fix #268, send email to user and committies.

This commit is contained in:
wlx 2011-12-08 09:22:54 +00:00
parent 0e79c60824
commit 0390c991f9
1 changed files with 22 additions and 7 deletions

View File

@ -49,17 +49,32 @@ class Admin_DownController extends Zend_Controller_Action
$mailtp=new EmailText($this->db,'offline-start',array('user'=>$row['username'],'datalist'=>$datalist)); $mailtp=new EmailText($this->db,'offline-start',array('user'=>$row['username'],'datalist'=>$datalist));
$mail->setBodyText($mailtp->getBody()); $mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject()); $mail->setSubject($mailtp->getSubject());
//收件人邮箱 $mail->addTo($row['email']);
$addrs = array(
$row['email'],
);
$mail->addTo($addrs);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组'); $mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->send(); $mail->send();
$sql="select distinct(res.email) from dataorder d left join role on d.uuid=role.uuid left join responsible res on role.resid=res.id where d.offlineappid=? and role.role in ('pointOfContact','resourceProvider')";
$rows=$this->db->fetchAll($this->db->quoteInto($sql,$start));
$addrs=array();
foreach($rows as $row)
{
$addrs[]=$row['email'];
}
//收件人邮箱
$addrs[] = 'nztong@lzb.ac.cn';
$addrs[] = 'wjian@lzb.ac.cn';
$addrs[] = 'lixin@lzb.ac.cn';
$mailtp=new EmailText($this->db,'offline-start-admin',array('user'=>$row['username'],'datalist'=>$datalist));
$mail->setBodyText($mailtp->getBody());
$mail->setSubject($mailtp->getSubject());
$mail->addTo($addrs);
$mail->addCc($this->view->config->service->email,'西部数据中心服务组');
$filecontent=file_get_contents("http://" . $_SERVER['HTTP_HOST'].'/admin/down/offlineapp/view/'.$start);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, 'offlineapp.pdf');
$mail->send();
//提示信息 //提示信息
$this->messenger->addMessage('提示信息:该离线数据已经开始处理,请在处理完成后点击“完成”。'); $this->messenger->addMessage('提示信息:该离线数据已经开始处理,并发送邮件给申请人以及数据管理委员会,请在处理完成后点击“完成”。');
$this->_redirect('/admin/down/offlineapp/'.$page); $this->_redirect('/admin/down/offlineapp/'.$page);
} elseif ($finish) { } elseif ($finish) {
try { try {