完善了邀请专家的功能

This commit is contained in:
Li Jianxuan 2011-10-10 09:26:05 +00:00
parent d106f93670
commit 4b6e27cb9a
3 changed files with 50 additions and 14 deletions

View File

@ -203,7 +203,7 @@ class Admin_ReviewController extends Zend_Controller_Action
}//在审元数据 }//在审元数据
function inviteAction(){ function inviteAction(){//邀请
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
if(empty($id)) if(empty($id))
@ -229,14 +229,52 @@ class Admin_ReviewController extends Zend_Controller_Action
where s.id='$id'"; where s.id='$id'";
$rs = $this -> db -> query($sql); $rs = $this -> db -> query($sql);
$md = $rs -> fetchAll(); $md = $rs -> fetch();
$uuid = $md['uuid']; $uuid = $md['uuid'];
foreach ($exps as $v) foreach ($exps as $v)
{ {
$sql = "select id from mdexpertreview where uuid='$uuid' and "; $sql = "select m.id,u.realname,u.email from mdexpertreview m
$sql = "insert into mdexpertreview "; 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')";
try{
if($this->db->exec($sql)>0)
{
$subject = "西部数据中心";
$email = "la5c@qq.com";
$mail=new WestdcMailer($this->view->config->smtp);
$body="尊敬的西部数据中心用户:";
$mail->setBodyText($body);
$mail->setFrom($this->view->config->service->email,'西部数据中心服务组');
$mail->addTo($email);
$mail->setSubject($subject);
if($mail->send())
{
$this->messenger->addMessage('成功邀请专家:'.$rows['realname']);
}else
{
$this->messenger->addMessage('邀请专家:'.$rows['realname'].'的邮件发送失败,请尝试手动发送邀请邮件');
}
}
}catch(Exception $e){
$this->messenger->addMessage('邀请失败:'.$e->getMessage());
}
}//不存在原来的记录
$this->_redirect("/admin/review/invite/?id=$id");
} }
} }
else else
@ -245,8 +283,6 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->_redirect("/admin/review/invite/?id=$id"); $this->_redirect("/admin/review/invite/?id=$id");
} }
} }
$searchjoin = ""; $searchjoin = "";
if(!empty($search) && !empty($keyword)) if(!empty($search) && !empty($keyword))
{ {
@ -257,7 +293,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$this->view->keyword = $keyword; $this->view->keyword = $keyword;
} }
$sql = "select u.id,u.username,u.realname,u.unit,u.phone,u.email from users u $sql = "select me.id,u.username,u.realname,u.unit,u.phone,u.email from users u
right join mdexperts me on u.id=me.id right join mdexperts me on u.id=me.id
$searchjoin"; $searchjoin";
$re = $this->db->query($sql); $re = $this->db->query($sql);
@ -278,7 +314,7 @@ class Admin_ReviewController extends Zend_Controller_Action
$title = $re->fetch(); $title = $re->fetch();
$this->view->md=$title; $this->view->md=$title;
} }//邀请专家
function addonAction(){ function addonAction(){

View File

@ -38,9 +38,9 @@
<table> <table>
<tr style="color:#FFF;background:#0a3e68;line-height:30px;"> <tr style="color:#FFF;background:#0a3e68;line-height:30px;">
<td width='500'>元数据标题</td> <td width='600'>元数据标题</td>
<td width='150'>状态</td> <td width='120'>管理员</td>
<td width='200'>操作</td> <td width='120'>操作</td>
</tr> </tr>
<?php if (count($this->paginator)): ?> <?php if (count($this->paginator)): ?>
<?php $autoindex=0;?> <?php $autoindex=0;?>

View File

@ -40,8 +40,8 @@
<input type="hidden" name="id" value='<?php echo $this->id;?>' /> <input type="hidden" name="id" value='<?php echo $this->id;?>' />
<input type="hidden" name="submit" value="1" /> <input type="hidden" name="submit" value="1" />
<table> <table>
<tr style="color:#FFF;background:#0a3e68;line-height:30px;"> <tr style="color:#FFF;background:#0a3e68;line-height:30px;text-align:center;">
<td width="50">选择</td> <td width="30">选择</td>
<td width='80'>用户ID</td> <td width='80'>用户ID</td>
<td width='100'>用户名</td> <td width='100'>用户名</td>
<td width='100'>姓名</td> <td width='100'>姓名</td>
@ -54,7 +54,7 @@
<?php foreach ($this->paginator as $item): ?> <?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?> <?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>> <tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td><input type="checkbox" name="exps[]" value="<?php echo $item['id']; ?>" /></td> <td style="text-align:center;"><input type="checkbox" name="exps[]" value="<?php echo $item['id']; ?>" /></td>
<td><?php echo $item['id']; ?></td> <td><?php echo $item['id']; ?></td>
<td><?php echo $item['username']; ?></td> <td><?php echo $item['username']; ?></td>
<td><?php echo $item['realname']; ?></td> <td><?php echo $item['realname']; ?></td>