增加了申请记录重置功能

This commit is contained in:
Li Jianxuan 2011-09-16 03:21:19 +00:00
parent d41e029f99
commit 3f1a01352a
2 changed files with 36 additions and 2 deletions

View File

@ -26,6 +26,8 @@ class Admin_DownController extends Zend_Controller_Action
$cancel=(int)$this->_getParam('cancel');
$deny=(int)$this->_getParam('deny');
$page=(int)$this->_getParam('page');
$reset=(int)$this->_getParam('reset');
if (!$page) $page=1;
if ($view) {
//查看此次申请的pdf
@ -129,7 +131,35 @@ class Admin_DownController extends Zend_Controller_Action
$this->db->query($sql,array($deny));
$this->messenger->addMessage('提示信息:已拒绝该用户离线申请。');
$this->_redirect('/admin/down/offlineapp/'.$page);
}
} else if($reset){
if($reset < 1)
{
$fortime = date('Y-m-d',(time()-24*3600*365));
$sql="update dataorder set status=1 where ts_created < '$fortime'";
if($this->db->exec($sql)>0)
{
$this->messenger->addMessage('已经成功重置了 '.$fortime.' 前的所有申请');
$this->_redirect('/admin/down/offlineapp/');
}
}
else if($reset > 0)
{
$sql="update dataorder set status='1' where offlineappid='$reset'";
if($this->db->exec($sql)<1)
{
$this->messenger->addMessage('已经成功对该申请重置');
$this->_redirect('/admin/down/offlineapp/');
}
else {
$this->messenger->addMessage('没有找到对应数据,无法进行重置,可能是旧记录没有匹配数据造成的');
$this->_redirect('/admin/down/offlineapp/');
}
}//elseif
//if
}//reset
$select=$this->db->select();
$select->from('offlineapp')->where('ts_approved is null')->where('pdflink is not null and status>=0')->order('ts_created desc');
$paginator = Zend_Paginator::factory($select);

View File

@ -26,6 +26,8 @@
<div class="right_title">离线数据申请管理</div>
<a href="/admin/down/offlineapp/reset/-1" onclick="return confirm('是否重置该申请?')">重置1年前的所有未收到申请表的记录</a>
<?php if (count($this->paginator)): ?>
<table>
<thead><tr>
@ -54,7 +56,9 @@
<a href="/admin/down/offlineapp/start/<?= $item['id']; ?>" onclick="return confirm('确定收到该申请?')">收到</a>
<a href="/admin/down/offlineapp/finish/<?= $item['id']; ?>" onclick="return confirm('确定确定通过该申请?')">通过</a>
<a href="/admin/down/offlineapp/cancel/<?= $item['id']; ?>" onclick="return confirm('确定将此记录删除?')">删除</a>
<a href="/admin/down/offlineapp/deny/<?= $item['id']; ?>" onclick="return confirm('确定拒绝该申请?')">拒绝</a></td>
<a href="/admin/down/offlineapp/deny/<?= $item['id']; ?>" onclick="return confirm('确定拒绝该申请?')">拒绝</a>
<a href="/admin/down/offlineapp/reset/<?= $item['id']; ?>" onclick="return confirm('是否重置该申请?')">重置</a>
</td>
</tr>
<?php endforeach; ?>
</tbody></table>