添加重新邀请专家功能

This commit is contained in:
wlx 2011-10-18 12:37:07 +00:00
parent 1802c69b14
commit c73c2d9168
1 changed files with 26 additions and 4 deletions

View File

@ -10,7 +10,7 @@ class Admin_ReviewController extends Zend_Controller_Action
} }
function postDispatch() function postDispatch()
{ {
$this->view->messages = $this->messenger->getMessages(); //$this->view->messages = $this->messenger->getMessages();
} }
function indexAction() function indexAction()
{ {
@ -211,7 +211,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$v['status']="未答复"; $v['status']="未答复";
} }
$expname[] = '<li><a href="/admin/user/show/id/'.$v['id'].'">'.$v['realname'].'</a> [状态:'.$v['status'].'] $expname[] = '<li><a href="/admin/user/show/id/'.$v['id'].'">'.$v['realname'].'</a> [状态:'.$v['status'].']
[<a href="/admin/review/invite/'.$show.'">再次发送邀请邮件</a>]</li>'; [<a href="/admin/review/invite/user/'.$v['id'].'/uuid/'.$rows['uuid'].'/id/'.$show.'">再次发送邀请邮件</a>]</li>';
} }
} }
if(count($expname>0)) if(count($expname>0))
@ -260,6 +260,7 @@ class Admin_ReviewController extends Zend_Controller_Action
function inviteAction(){//邀请 function inviteAction(){//邀请
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
$user = $this->_request->getParam('user');
if(empty($id)) if(empty($id))
{ {
$this->_redirect("/admin/review"); $this->_redirect("/admin/review");
@ -302,7 +303,6 @@ class Admin_ReviewController extends Zend_Controller_Action
{ {
$sql = "insert into mdexpertreview (id,uuid) values ('$v','$uuid')"; $sql = "insert into mdexpertreview (id,uuid) values ('$v','$uuid')";
$expinfo="select realname,email from users where id='$v'"; $expinfo="select realname,email from users where id='$v'";
$rs = $this->db->query($expinfo); $rs = $this->db->query($expinfo);
$expinfo = $rs->fetch(); $expinfo = $rs->fetch();
@ -344,6 +344,28 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->messenger->addMessage('请选择要邀请的专家'); $this->messenger->addMessage('请选择要邀请的专家');
$this->_redirect("/admin/review/invite/?id=$id"); $this->_redirect("/admin/review/invite/?id=$id");
} }
} 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);
//实例化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);
$mail->createAttachment($filecontent,'application/octet-stream',Zend_Mime::DISPOSITION_ATTACHMENT, Zend_Mime::ENCODING_BASE64, $row['title'].'.doc');
if($mail->send())
{
$this->messenger->addMessage('成功再次邀请专家:'.$row['realname']);
}else
{
$this->messenger->addMessage('邀请专家'.$row['realname'].'的邮件发送失败,请尝试手动发送邀请邮件');
}
} }
$searchjoin = ""; $searchjoin = "";
if(!empty($search) && !empty($keyword)) if(!empty($search) && !empty($keyword))