增加了在线下载记录的搜索功能,修改了模板

This commit is contained in:
Li Jianxuan 2011-09-14 09:50:39 +00:00
parent 61d8aca034
commit 25cf1963c6
4 changed files with 116 additions and 53 deletions

View File

@ -253,10 +253,8 @@ class Admin_DownController extends Zend_Controller_Action
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator;
$count="select count(id) as total from onlineapp";
$re=$this->db->query($count);
$t=$re->fetch();
$this->view->t=$t;
$count = count($this->db->fetchAll($select));
$this->view->count=$count;
}//列表
elseif($delete)
@ -377,5 +375,41 @@ class Admin_DownController extends Zend_Controller_Action
}//dataAction 数据下载情况
function searchAction()
{
$search = $this->_getParam('search');
$keyword = $this->view->keyword = $this->_getParam('keyword');
$select=$this->db->select();
if(!empty($search) && !empty($keyword))
{
$select ->from('onlineapp as o',array('id','userid','unit','username','ts_created','project'))
->Where('o.username like ? ','%'.$keyword.'%')
->orWhere('o.unit like ? ','%'.$keyword.'%')
->orWhere('o.project like ? ','%'.$keyword.'%')
->orWhere('m.title like ? ','%'.$keyword.'%')
->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid'))
->order('o.id desc');
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('online');
$count = count($this->db->fetchAll($select));
$this->view->count=$count;
$this->view->title='搜索结果 :';
}
else {
$this->_redirect("/admin/down/online");
}
}//searchAction 搜索
}

View File

@ -22,33 +22,39 @@
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div class="right_title">离线数据服务记录</div>
<a href="/admin/down/offline/add/1">添加新的离线服务记录</a> | <a href="/admin/down/offline/down/1">下载所有离线服务记录</a>
<?= $this->paginator; ?>
<?php if (count($this->paginator)): ?>
<table class="offline" cellspacing=0>
<table>
<thead><tr>
<th id="name">姓名</th>
<th id="unit">单位</th>
<th id="addr">地址</th>
<th id="postcode">邮编</th>
<th id="project">用途</th>
<th id="datalist">数据清单</th>
<th id="ts">申请时间</th>
<th id="name">操作</th>
<th width='70'>姓名</th>
<th width='150'>单位</th>
<th width='150'>地址</th>
<th width='50'>邮编</th>
<th width='300'>用途</th>
<th width='300'>数据清单</th>
<th width='120'>申请时间</th>
<th width='100'>操作</th>
</tr></thead>
<tbody>
<?php foreach ($this->paginator as $item): ?>
<tr><td class="name"><?= $item['username']; ?></td>
<td class="unit"><?= $item['unit']; ?></td>
<td class="addr"><?= $item['address']; ?></td>
<td class="postcode"><?= $item['postcode']; ?></td>
<td class="project"><?= $item['project']; ?></td>
<td><?= $item['datalist']; ?></td>
<td class="ts"><?= date('Y-m-d',strtotime($item['ts_created'])); ?></td>
<td class="action">
<a href="/admin/down/offline/edit/<?= $item['id']; ?>">编辑</a> | <a href="/admin/down/offline/delete/<?= $item['id']; ?>">删除</a></td>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td><?= $item['username']; ?></td>
<td><?= $item['unit']; ?></td>
<td><?= $item['address']; ?></td>
<td><?= $item['postcode']; ?></td>
<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['project']; ?></textarea></td>
<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></td>
</tr>
<?php endforeach; ?>
</tbody></table>
<?php endif; ?>
<?php endif; ?>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
</div>

View File

@ -13,7 +13,7 @@
<?= $this->partial('down/left.phtml'); ?>
</div>
<div id="rightPanel">
<?= $this->paginator; ?>
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
@ -23,34 +23,43 @@
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div class="right_title">离线数据申请管理</div>
<?php if (count($this->paginator)): ?>
<table class="offline" cellspacing=0>
<table>
<thead><tr>
<th id="name">姓名</th>
<th id="unit">单位</th>
<th id="addr">地址</th>
<th id="postcode">邮编</th>
<th id="project">用途</th>
<th id="datalist">数据清单</th>
<th id="ts">申请时间</th>
<th id="name">操作</th>
<th width='70'>姓名</th>
<th width='150'>单位</th>
<th width='150'>地址</th>
<th width='50'>邮编</th>
<th width='300'>用途</th>
<th width='300'>数据清单</th>
<th width='80'>申请时间</th>
<th width='60'>操作</th>
</tr></thead>
<tbody>
<?php foreach ($this->paginator as $item): ?>
<tr><td class="name"><a href="/admin/down/offlineapp/view/<?= $item['id']; ?>"><?= $item['username']; ?></a></td>
<td class="unit"><?= $item['unit']; ?></td>
<td class="addr"><?= $item['address']; ?></td>
<td class="postcode"><?= $item['postcode']; ?></td>
<td class="project"><?= $item['project']; ?></td>
<td><?= $item['datalist']; ?></td>
<td class="ts"><?= date('Y-m-d',strtotime($item['ts_created'])); ?></td>
<td class="action">
<a href="/admin/down/offlineapp/start/<?= $item['id']; ?>">收到</a>
<a href="/admin/down/offlineapp/finish/<?= $item['id']; ?>">通过</a>
<a href="/admin/down/offlineapp/cancel/<?= $item['id']; ?>">删除</a>
<a href="/admin/down/offlineapp/deny/<?= $item['id']; ?>">拒绝</a></td>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td><a href="/admin/down/offlineapp/view/<?= $item['id']; ?>"><?= $item['username']; ?></a></td>
<td><?= $item['unit']; ?></td>
<td><?= $item['address']; ?></td>
<td><?= $item['postcode']; ?></td>
<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['project']; ?></textarea></td>
<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/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>
</tr>
<?php endforeach; ?>
</tbody></table>
<?php endif; ?>
<?php endif; ?>
<div style="width:50%;">
<?= $this->paginator; ?>
</div>
</div>

View File

@ -24,9 +24,22 @@
<div id="rightPanel">
<div style="font-size:16px;line-height:30px;">共有 <?php echo $this->t['total'];?> 条在线下载记录</div>
<div class="right_title"><?php if(!empty($this->title)) echo $this->title;?>共有 <?php echo $this->count;?> 条在线下载记录</div>
<div class="search">
<form action="/admin/down/search/" method="get">
<input type="hidden" name="search" value='1' />
<ul>
<li><label>搜索关键字</label><input type="text" name="keyword" value="<?php echo $this->keyword; ?>" /></li>
<li><input type="submit" class="searchbtn" value="搜索" /></li>
</ul>
</form>
</div><!-- search DIV -->
<table>
<tr style="color:#FFF;background:#0a3e68;line-height:30px;">
<thead>
<tr>
<td width='100'>姓名</td>
<td width='150'>单位</td>
<td width='350'>数据</td>
@ -34,15 +47,16 @@
<td width='120'>下载时间</td>
<td width='100'>操作</td>
</tr>
</thead>
<?php if (count($this->paginator)): ?>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td><a href="/admin/user/show/id/<?php echo $item['userid'];?>"><img src="/images/user.gif" /></a> <a href="/admin/down/user/show/<?php echo $item['userid'];?>"><?= $item['username']?></a> </td>
<td><a href="/admin/user/show/id/<?php echo $item['userid'];?>"><img src="/images/user.gif" /></a><a href="/admin/down/user/show/<?php echo $item['userid'];?>"><?= $item['username']?></a> </td>
<td><?= $item['unit']?></td>
<td><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><img src="/images/data.gif" /></a><a href="/admin/down/data/show/<?php echo $item['uuid'];?>"><?php echo $item['title'];?></a></td>
<td><textarea readonly="readonly" style="width:300px;height:100px;border:none;font-size:12px;"><?php echo $item['project']; ?></textarea></td>
<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;'; ?>"><?php echo $item['project']; ?></textarea></td>
<td><?php echo date('Y-m-d H:i:s', strtotime($item['ts_created'])); ?></td>
<td>
<a href='/admin/down/online/show/<?php echo $item['id'];?>'>详细</a>