#197 添加了评审意见反馈功能

This commit is contained in:
Li Jianxuan 2012-11-29 08:02:10 +00:00
parent c7828e79a9
commit c6426e0c3e
3 changed files with 194 additions and 37 deletions

View File

@ -1471,5 +1471,83 @@ class Admin_ReviewController extends Zend_Controller_Action
}//commentsAction 查看所有评审意见
//replyAction() 数据评审信息反馈
function replyAction(){
$uuid = $this->_getParam('uuid');
$send = $this->_getParam('send');
if(empty($uuid))
{
$jump_url = $this->view->jump_url = 'javascript:history.go(-1);';
$this->view->msg = "参数错误,<a href='$jump_url'>如果页面没有跳转请点击这里</a>";
return true;
}
$this->view->uuid = $uuid;
$sql = "SELECT mr.*,u.username,u.realname FROM mdreview mr
LEFT JOIN users u ON mr.userid = u.id
WHERE mr.uuid = '$uuid'";
$sth = $this->db->query($sql);
$reviews = $sth->fetchAll();
$this->view->review = $reviews;
if(!empty($send))
{
$sql = "SELECT md.title,u.email FROM metadata md
LEFT JOIN mdauthor a ON md.uuid=a.uuid
WHERE md.uuid='$uuid'";
$sth = $this->db->query($sql);
$rows = $sth->fetchAll();
$emails = array();
foreach($rows as $v);
{
if(!empty($v['email']))
{
$emails[] = $v['email'];
}
}
if(count($emails)<1)
{
$jump_url = $this->view->jump_url = 'javascript:history.go(-1);';
$this->view->msg = "该元数据未指派作者,<a href='$jump_url'>如果页面没有跳转请点击这里</a>";
return true;
}
$title = $rows[0]['title'];
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$body = "元数据《$title》的作者您好\r\n
您的元数据《$title》有反馈信息。\r\n";
foreach($reviews as $k=>$v)
{
$body .= $v['username'].":".$v['mdcomment']."\r\n";
}
$body .= "\r\n           西部数据中心服务组";
$mail=new WestdcMailer($this->view->config->smtp);
$mail->setBodyText($body);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
foreach($emails as $v)
{
$mail->addTo($v);
}
$mail->setSubject("您的元数据《$title》有新的反馈");
$mail->send();
}
}//replyAction()
}

View File

@ -55,6 +55,7 @@
<a href="/admin/review/changeadmin/id/<?php echo $item['id'];?>">更改管理员</a>
<a href="/admin/review/inreview/show/<?php echo $item['id'];?>">查看详细</a>
<a href="/admin/review/comments/ac/list/uuid/<?php echo $item['uuid'];?>">查看评审意见</a>
<a href="/admin/review/reply/uuid/<?php echo $item['uuid'];?>">意见反馈</a>
<a href='/admin/review/accept/cancel/<?php echo $item['id'];?>' onclick="return confirm('是否确定取消评审')">取消评审</a>
<a href="/admin/review/checkmail/id/<?php echo $item['id'];?>" style="color:#6C0">发布</a>
<a href="/admin/review/delete/id/<?php echo $item['id'];?>" style="color:#F00" onclick="return confirm('是否确定删除?该操作不可逆')">删除</a>

View File

@ -0,0 +1,78 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台首页</a>');
$this->breadcrumb('评审意见反馈');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('review/left.phtml'); ?>
</div>
<div id="rightPanel">
<?php
if(!empty($this->msg))
{
?>
<div class="box box-error"><?= $this->msg;?></div>
<?php if(!empty($this->jump_url)) {?>
<script language="javascript">setTimeout("history.go(-1)",3000);</script>
<?php } ?>
<?php } else{?>
<?php if(empty($this->review))
{ echo "此数据尚无反馈信息";
}else{?>
<div id="datalist">
<ul>
<?php foreach($this->review as $v)
{?>
<li><?= empty($v['realname']) ? $v['username'] : $v['realname']?> <?= $v['mdcomment']?></li>
<?php }?>
</ul>
</div>
<button type="button" onclick="send()" id="submit" class="btn btn-green">反馈给元数据作者</button>
<script>
function send(){
var dom = "#submit";
var html = $(dom).html();
$.ajax({
'type':"POST",
'url':'/admin/review/reply/',
'data':'uuid=<?= $this->uuid?>&send=1',
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(typeof(data.msg)!='undefined')
{Alert(data.msg);}
if(typeof(data.invited)!='undefined')
{$('#expert_name_'+id).val('');$('#expert_email_'+id).val('');}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){
Alert('处理中出现错误,请刷新页面后重试');
},
'beforeSend':function(){
$(dom).html('<img src="/images/ajax-load-small.gif" />处理中...');
$(dom).attr("disabled","disabled")
},
'complete':function(){
$(dom).html(html);$(dom).removeAttr("disabled");dom = null;
}
});
}
</script>
<?php }?>
<?php } ?>
</div>