增加了数据和用户的搜索功能

This commit is contained in:
Li Jianxuan 2011-09-15 02:14:06 +00:00
parent c9c0132c12
commit f570cb3c03
3 changed files with 56 additions and 8 deletions

View File

@ -286,15 +286,22 @@ class Admin_DownController extends Zend_Controller_Action
function userAction()
{
$show=(int)$this->_getParam('show');
$show =(int)$this->_getParam('show');
$search = $this->_getParam('search');
$keyword = $this->view->keyword = $this->_getParam('keyword');
if(empty($show))
{
$select=$this->db->select();
$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')
->group('uid')
->where('o.userid = u.id');
if(!empty($search) && !empty($keyword))
{
$select ->Where('u.realname like ? ','%'.$keyword.'%');
$this->view->title='“'.$keyword.'”的搜索结果 :';
}
$select ->group('uid')
->group('realname')
->order('num desc');
$paginator = Zend_Paginator::factory($select);
@ -303,6 +310,9 @@ class Admin_DownController extends Zend_Controller_Action
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator;
$count = count($this->db->fetchAll($select));
$this->view->count=$count;
}//列表
elseif($show)
@ -331,23 +341,34 @@ class Admin_DownController extends Zend_Controller_Action
function dataAction()
{
$show=$this->_getParam('show');
$show = $this->_getParam('show');
$search = $this->_getParam('search');
$keyword = $this->view->keyword = $this->_getParam('keyword');
if(empty($show))
{
$select=$this->db->select();
$select->from('dataorder as o','count(o.id) as num')
->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid'))
->where('o.uuid = m.uuid and (o.status=0 or o.status=5)')
->group('m.title')
->where('o.uuid = m.uuid and (o.status=0 or o.status=5)');
if(!empty($search) && !empty($keyword))
{
$select ->Where('m.title like ? ','%'.$keyword.'%');
$this->view->title='“'.$keyword.'”的搜索结果 :';
}
$select ->group('m.title')
->group('m.uuid')
->order('num desc');
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage($this->view->config->page->max);
$paginator->setItemCountPerPage(20);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$count = count($this->db->fetchAll($select));
$this->view->count=$count;
}//数据下载情况列表
elseif($show)

View File

@ -5,6 +5,7 @@
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台管理首页</a>');
$this->breadcrumb('<a href="/admin/down">申请管理</a>');
$this->breadcrumb('在线下载记录');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
@ -27,6 +28,19 @@
<div id="rightPanel">
<div class="right_title"><?php if(!empty($this->title)) echo $this->title;?><?php echo $this->count;?> 数据下载记录</div>
<div class="search">
<form action="/admin/down/data/" 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;">
<td width='350'>数据</td>

View File

@ -28,6 +28,19 @@
<div id="rightPanel">
<div class="right_title"><?php if(!empty($this->title)) echo $this->title;?><?php echo $this->count;?> 数据下载记录</div>
<div class="search">
<form action="/admin/down/user/" 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;">
<td width='350'>姓名</td>