From 31dcf2bf107d5d4ea64d1d8d9b1f5ec8d9dc5984 Mon Sep 17 00:00:00 2001 From: Li Jianxuan Date: Fri, 16 Sep 2011 10:09:29 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E6=B8=85=E7=90=86=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E8=AE=B0=E5=BD=95=E7=9A=84=E5=90=8C=E6=97=B6?= =?UTF-8?q?=E5=B0=86=E5=88=A0=E9=99=A4=E7=94=B3=E8=AF=B7=E8=AE=B0=E5=BD=95?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/controllers/DownController.php | 47 +++++++++++++------ .../admin/views/scripts/down/offline.phtml | 6 ++- 2 files changed, 37 insertions(+), 16 deletions(-) diff --git a/application/admin/controllers/DownController.php b/application/admin/controllers/DownController.php index ab7c3153..03315cae 100644 --- a/application/admin/controllers/DownController.php +++ b/application/admin/controllers/DownController.php @@ -185,6 +185,7 @@ class Admin_DownController extends Zend_Controller_Action $down=(int)$this->_getParam('down'); $update=$this->_getParam('update'); $show=$this->_getParam('show'); + $undelete=$this->_getParam('undelete'); if ($add) { $form=new OfflinelogForm(); @@ -244,7 +245,29 @@ class Admin_DownController extends Zend_Controller_Action $this->messenger->addMessage($e->getMessage()); } $this->_redirect("/admin/down/offline"); - } elseif ($down) { + }else if($undelete){ + $sql="delete from offlineapp where id='$undelete'"; + $sql2="delete from dataorder where offlineappid='$undelete'"; + + if($this->db->exec($sql)>0) + { + if($this->db->exec($sql2)>0) + { + $this->messenger->addMessage('成功删除了数据服务记录,并且删除了关联的申请记录'); + $this->_redirect("/admin/down/offline"); + } + else + { + $this->messenger->addMessage('成功删除了数据服务记录,但并未找到关联的申请记录'); + $this->_redirect("/admin/down/offline"); + } + } + else { + $this->messenger->addMessage('删除失败'); + $this->_redirect("/admin/down/offline"); + } + } + elseif ($down) { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(); $sql="select * from offlineapp where ts_approved is not null and pdflink is not null order by ts_created desc"; @@ -366,19 +389,16 @@ class Admin_DownController extends Zend_Controller_Action if(empty($show)) { $select=$this->db->select(); - $select->from('dataorder as o','count(o.id) as num') - ->join('users as u', 'u.id = o.userid', array('realname','id as uid','unit')) - ->where('o.userid = u.id') - ->where('o.status=0 or o.status=5'); + $select->from('onlineapp as o','count(o.id) as num') + ->join('users as u', 'u.id = o.userid', array('realname','id as uid')) + ->where('o.userid = u.id'); if(!empty($search) && !empty($keyword)) { $select ->Where('u.realname like ? or u.unit like ? ','%'.$keyword.'%'); - $select ->orWhere('u.unit like ? ','%'.$keyword.'%'); $this->view->title='“'.$keyword.'”的搜索结果 :'; } $select ->group('uid') - ->group('realname') - ->group('unit') + ->group('realname') ->order('num desc'); $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); @@ -394,11 +414,9 @@ class Admin_DownController extends Zend_Controller_Action elseif($show) { $select=$this->db->select(); - $select->from('dataorder as o',array('id','ts_created','userid','offlineappid')) - ->joinLeft('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) - ->joinLeft('users as u','u.id=o.userid',array('realname as username')) + $select->from('onlineapp as o',array('id','username','ts_created','userid')) + ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) ->where('o.userid = ?', $show) - ->where('o.status=0 or o.status=5') ->order('o.id desc'); $paginator = Zend_Paginator::factory($select); $paginator->setCurrentPageNumber($this->_getParam('page')); @@ -431,8 +449,7 @@ class Admin_DownController extends Zend_Controller_Action ->where('o.uuid = m.uuid and (o.status=0 or o.status=5)'); if(!empty($search) && !empty($keyword)) { - $select ->Where('m.title like ?','%'.$keyword.'%'); - $select ->Where('m.title_en like ?','%'.$keyword.'%'); + $select ->Where('m.title like ? ','%'.$keyword.'%'); $this->view->title='“'.$keyword.'”的搜索结果 :'; } $select ->group('m.title') @@ -453,7 +470,7 @@ class Admin_DownController extends Zend_Controller_Action elseif($show) { $select=$this->db->select(); - $select->from('dataorder as o',array('id','ts_created','offlineappid')) + $select->from('dataorder as o',array('ts_created')) ->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid')) ->join('users as u', 'o.userid=u.id',array('id as userid','username','realname')) ->where('m.uuid = ? and (o.status=0 or o.status=5)', $show) diff --git a/application/admin/views/scripts/down/offline.phtml b/application/admin/views/scripts/down/offline.phtml index 37a1e811..7e47f39b 100644 --- a/application/admin/views/scripts/down/offline.phtml +++ b/application/admin/views/scripts/down/offline.phtml @@ -49,7 +49,11 @@ - 编辑 | 删除| PDF | 查看详细 + 编辑 | + 删除| + PDF | + 查看详细 +
清理记录