添加了记录清理功能,删除服务记录的同时将删除申请记录。

This commit is contained in:
Li Jianxuan 2011-09-16 10:09:29 +00:00
parent c708a1c457
commit 31dcf2bf10
2 changed files with 37 additions and 16 deletions

View File

@ -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')
->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)

View File

@ -49,7 +49,11 @@
<td><textarea readonly="readonly" style="width:300px;height:100px;border:none;font-size:12px;<?php if($autoindex%2 == 0) echo 'background:#CCCCCC;'; else echo 'background:#FFF;'; ?>"><?= $item['datalist']; ?></textarea></td>
<td><?= date('Y-m-d',strtotime($item['ts_created'])); ?></td>
<td>
<a href="/admin/down/offline/edit/<?= $item['id']; ?>">编辑</a> | <a href="/admin/down/offline/delete/<?= $item['id']; ?>" onclick="return confirm('确定将此记录删除?')">删除</a>| <a href="/admin/down/offlineapp/view/<?= $item['id']; ?>">PDF</a> | <a href="/admin/down/offline/show/<?= $item['id']; ?>">查看详细</a>
<a href="/admin/down/offline/edit/<?= $item['id']; ?>">编辑</a> |
<a href="/admin/down/offline/delete/<?= $item['id']; ?>" onclick="return confirm('确定将此记录删除?')">删除</a>|
<a href="/admin/down/offlineapp/view/<?= $item['id']; ?>">PDF</a> |
<a href="/admin/down/offline/show/<?= $item['id']; ?>">查看详细</a>
<br /><a href="/admin/down/offline/undelete/<?= $item['id']; ?>" title="该操作将删除此记录并且删除与此记录有关的申请记录!请谨慎操作" onclick="return confirm('请仅删除测试用途的离线服务记录!')">清理记录</a>
</td>
</tr>
<?php endforeach; ?>