From 24ab7b677c9244868289cb0993bb752f14bfeea6 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Wed, 19 Oct 2011 08:27:24 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=AF=84=E5=AE=A1?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E7=9A=84=E5=88=A0=E9=99=A4=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/ReviewController.php | 54 +++++++++++++++++++ .../views/scripts/review/commentsview.phtml | 8 ++- 2 files changed, 60 insertions(+), 2 deletions(-) diff --git a/application/admin/controllers/ReviewController.php b/application/admin/controllers/ReviewController.php index 6f64d2ef..91287133 100644 --- a/application/admin/controllers/ReviewController.php +++ b/application/admin/controllers/ReviewController.php @@ -903,6 +903,60 @@ class Admin_ReviewController extends Zend_Controller_Action $this->_helper->viewRenderer('commentslist'); }//评审意见列表 or 某条元数据的评审意见列表 + else if($ac=='del' && !empty($id)) + { + + $redirect = "/admin/review/comments/ac/list/"; + + if(!is_numeric($id)) + { + $this->messenger->addMessage('参数不正确,请按正确的步骤进行访问'); + $this->_redirect($redirect); + } + + $sql = "select r.id,att.filename,ratt.attachid as attid from mdreview r + left join mdreviewattach ratt on ratt.reviewid=r.id + left join attachments att on att.id=ratt.attachid + where r.id='$id'"; + + $rs = $this->db->query($sql); + + $row = $rs->fetch(); + + if(!empty($row['filename'])) + { + //需要删除文件,通过Zend_Registry::get('upload')获得上传文件的根目录 + $basepath = Zend_Registry::get('upload'); + $filepath = $basepath.$row['filename']; + + if(unlink($filepath)) + { + $sql = "delete from mdreview where id='$id'"; + if($this->db->exec($sql)>0) + { + $this->messenger->addMessage('评审意见删除成功!'); + $this->_redirect($redirect); + } + } + else + { + $sql = "delete from mdreview where id='$id'"; + if($this->db->exec($sql)>0) + { + $this->messenger->addMessage('评审意见删除成功!但附件删除失败,请手动删除文件:'.$row['filename']); + $this->_redirect($redirect); + } + } + }else{ + $sql = "delete from mdreview where id='$id'"; + if($this->db->exec($sql)>0) + { + $this->messenger->addMessage('评审意见删除成功!'); + $this->_redirect($redirect); + } + } + }//删除评审意见 同时删除附件 + else { try{ diff --git a/application/admin/views/scripts/review/commentsview.phtml b/application/admin/views/scripts/review/commentsview.phtml index 424855f3..d887ad0a 100644 --- a/application/admin/views/scripts/review/commentsview.phtml +++ b/application/admin/views/scripts/review/commentsview.phtml @@ -49,10 +49,14 @@

-
- info['attid'];?> + info['attid'];?>

+
+ + + +
\ No newline at end of file