修复了会员管理,增加了带参数分页模板

This commit is contained in:
Li Jianxuan 2011-09-14 02:34:15 +00:00
parent 68b62c02fd
commit ddda398779
8 changed files with 173 additions and 112 deletions

View File

@ -14,22 +14,79 @@ class Admin_UserController extends Zend_Controller_Action
}
function indexAction()
{
//其他连接
}
$sql="select count(id) as total from users";
$uq=$this->db->query($sql);
$row=$uq->fetch();
$sqlt="select count(id) as total from users where usertype='administrator'";
$uqt=$this->db->query($sqlt);
$adminrow=$uqt->fetch();
$this->view->su=$row;
$this->view->suadmin=$adminrow;
}//indexAction
function listAction()
{
$select=$this->db->select();
$select->from('users')
$select=$this->db->select();
$select->from('users')
->where('usertype = ?', 'member')
->order('users.id desc');
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(30);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination.phtml');
$this->view->paginator=$paginator;
}
}//listAction
function searchAction()
{
$search = $this->_getParam('search');
$realname = $this->_getParam('realname');
$unit = $this->_getParam('unit');
$project = $this->_getParam('project');
$select=$this->db->select();
if(!empty($search) && ( !empty($realname) || !empty($unit) || !empty($project) ))
{
$this->messenger->addMessage('搜索结果');
$select->from('users');
if(!empty($realname))
$select->where('realname like ? ', '%'.$realname.'%');
if(!empty($unit))
$select->where('unit like ? ', '%'.$unit.'%');
if(!empty($project))
$select->where('project like ? ', '%'.$project.'%');
$select->order('users.id desc');
$paginator = Zend_Paginator::factory($select);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(30);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('list');
}
else {
$this->_redirect("/admin/user/list");
}
}//searchAction
function deleteAction()
{

View File

@ -1,4 +1,5 @@
<ul>
<li class="title">申请管理与在线下载记录</li>
<li><a href="/admin/down/offlineapp">离线数据申请管理</a></li>
<li><a href="/admin/down/offline">离线数据服务记录</a></li>
<li><a href="/admin/down/online">在线数据下载记录从20110908开始</a></li>

View File

@ -2,17 +2,17 @@
<div class="paginationControl">
<!-- Previous page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->previous)); ?>">&lt; Previous</a> |
<a href="<?= $this->url(array('page' => $this->previous)); ?>">&lt; Previous</a>
<?php else: ?>
<span class="disabled">&lt; Previous</span> |
<span class="disabled">&lt; Previous</span>
<?php endif; ?>
<!-- Numbered page links -->
<?php foreach ($this->pagesInRange as $page): ?>
<?php if ($page != $this->current): ?>
<a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a> |
<a href="<?= $this->url(array('page' => $page)); ?>"><?= $page; ?></a>
<?php else: ?>
<?= $page; ?> |
<?= $page; ?>
<?php endif; ?>
<?php endforeach; ?>

View File

@ -0,0 +1,26 @@
<?php if ($this->pageCount): ?>
<div class="paginationControl">
<!-- Previous page link -->
<?php if (isset($this->previous)): ?>
<a href="<?= $this->url(array('page' => $this->previous)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>">&lt; Previous</a>
<?php else: ?>
<span class="disabled">&lt; Previous</span>
<?php endif; ?>
<!-- Numbered page links -->
<?php foreach ($this->pagesInRange as $page): ?>
<?php if ($page != $this->current): ?>
<a href="<?= $this->url(array('page' => $page)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>"><?= $page; ?></a>
<?php else: ?>
<span class="current"><?= $page; ?></span>
<?php endif; ?>
<?php endforeach; ?>
<!-- Next page link -->
<?php if (isset($this->next)): ?>
<a href="<?= $this->url(array('page' => $this->next)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>">Next &gt;</a>
<?php else: ?>
<span class="disabled">Next &gt;</span>
<?php endif; ?>
</div>
<?php endif; ?>

View File

@ -10,16 +10,17 @@
<div id="divContent">
<div id="leftPanel">
用户管理工具:
<ul>
<li class="title">用户管理</li>
<li><a href="/admin/user/list">普通用户列表</a></li>
<li><a href="/admin/user/adminlist">管理员列表</a></li>
</ul>
</div>
<div id="rightPanel">
<div style="font-size:16px;line-height:30px;">管理员列表</div>
<table>
<thead>
<tr>
<td width='150'>用户名</td>
<td width='250'>电子邮箱</td>
@ -28,9 +29,12 @@
<td width='150'>电话</td>
<td width='150'>操作</td>
</tr>
</thead>
<?php if (count($this->paginator)): ?>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<tr>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td><?= $item['username']?></td>
<td><?= $item['email']; ?></td>
<td><?= $item['usertype']; ?></td>

View File

@ -4,89 +4,35 @@
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台管理首页</a>');
$this->breadcrumb('<a href="/admin/stat">统计</a>');
$this->breadcrumb('在线下载记录');
$this->breadcrumb('后台管理首页');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<ul>
<li><a href="/admin/onlineapp">所有在线下载记录 <?php if(!empty($this->t['total'])) echo "(共".$this->t['total']."条)";?></a></li>
<li><a href="/admin/onlineapp/datas">数据下载记录统计</a></li>
<li><a href="/admin/onlineapp/users">用户下载记录统计</a></li>
<li class="title">用户管理</li>
<li><a href="/admin/user/list">普通用户列表</a></li>
<li><a href="/admin/user/adminlist">管理员列表</a></li>
</ul>
</div>
<?php if ($this->msg or $this->messages) :?>
<div id="message">
<?php if ($this->msg) : ?>
<p><?php echo $this->msg; ?></p>
<?php endif; if ($this->messages): foreach($this->messages as $msg): ?>
<p><?php echo $msg; ?></p>
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div id="rightPanel">
<div style="font-size:16px;line-height:30px;">共有 <?php echo $this->t['total'];?> 条在线下载记录</div>
<table>
<tr style="color:#FFF;background:#0a3e68;line-height:30px;">
<td width='80'>id</td>
<td width='100'>姓名</td>
<td width='350'>资料名称</td>
<td width='150'>下载时间</td>
<td width='150'>操作</td>
</tr>
<?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><?= $item['id']?></td>
<td><?= $item['username']?></td>
<td><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></td>
<td><?php echo date('Y-m-d H:i:s', strtotime($item['ts_created'])); ?></td>
<td>
<a href='/admin/onlineapp/show/id/<?php echo $item['id'];?>'>查看详细</a>
<a href='/admin/onlineapp/delete/id/<?= $item['id'];?>/' onclick="return confirm('确定将此记录删除?')">删除</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
<div style="font-size:16px;line-height:30px;">用户总数: <?php echo $this->su['total'];?></div>
<div style="font-size:16px;line-height:30px;">管理员: <?php echo $this->suadmin['total'];?></div>
<div style="font-size:16px;line-height:30px;">搜索用户</div>
<div style="width:100%;">
<form action="/admin/user/search/" method="get">
<input type="hidden" name="search" value='1' />
<div>姓名 <input type="text" name="realname" /></div>
<div>单位 <input type="text" name="unit" /></div>
<div>项目 <input type="text" name="project" /></div>
<div><input type="submit" value="搜索" /></div>
</form>
</div>
</div>
<div id="oxbox" style="display:none;">
<div class="closeox"><a href="javascript:void(0);" onclick="$('oxbox').hide()">[关闭]</a></div>
<div id="loading">加载中...</div>
<div id="returninfo">
</div>
</div>
<script type="text/javascript">
function show(id)
{
var request_url = "/admin/onlineapp/show/";
request_pars = 'id='+id;
var myAjax = new Ajax.Updater('returninfo', request_url,{
method : 'get',
parameters : request_pars,
onFailure : reportError,
onLoading : loading,
onComplete : done,
evalScripts: true
});
}
function loading(){$('loading').style.display = 'block';}
function done(){$('loading').style.display = 'none';}
function reportError(request){alert('Sorry. There was an error.');}
</script>
</div>

View File

@ -11,8 +11,8 @@
<div id="divContent">
<div id="leftPanel">
用户管理工具:
<ul>
<li class="title">用户管理</li>
<li><a href="/admin/user/list">普通用户列表</a></li>
<li><a href="/admin/user/adminlist">管理员列表</a></li>
</ul>
@ -30,20 +30,27 @@
<div id="rightPanel">
<div style="font-size:16px;line-height:30px;">用户列表</div>
<table>
<thead>
<tr>
<td width='150'>用户名</td>
<td width='250'>电子邮箱</td>
<td width='100'>用户类型</td>
<td width='150'>真实姓名</td>
<td width='200'>单位</td>
<td width='100'>真实姓名</td>
<td width='150'>操作</td>
</tr>
</thead>
<?php if (count($this->paginator)): ?>
<?php $autoindex=0;?>
<?php foreach ($this->paginator as $item): ?>
<tr>
<?php $autoindex++;?>
<tr <?php if($autoindex%2 == 0) echo 'bgcolor="#CCCCCC"'; else echo 'bgcolor="#FFFFFF"'; ?>>
<td><?= $item['username']?></td>
<td><?= $item['email']; ?></td>
<td><?= $item['usertype']; ?></td>
<td><?= $item['unit']; ?></td>
<td><?= $item['realname']; ?></td>
<td>
<a href='/admin/user/delete/id/<?= $item['id'];?>/uname/<?= $item['username'];?>' onclick="return confirm('确定将此记录删除?')">删除</a>

View File

@ -5,21 +5,17 @@
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台管理首页</a>');
$this->breadcrumb('<a href="/admin/stat">统计</a>');
$this->breadcrumb('<a href="/admin/stat/onlineapp">在线下载记录</a>');
$this->breadcrumb('详细信息');
$this->breadcrumb('用户列表');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<ul>
<li><a href="/admin/onlineapp">所有在线下载记录</a></li>
<li><a href="/admin/onlineapp/datas">数据下载记录统计</a></li>
<li><a href="/admin/onlineapp/users">用户下载记录统计</a></li>
<li class="title">用户管理</li>
<li><a href="/admin/user/list">普通用户列表</a></li>
<li><a href="/admin/user/adminlist">管理员列表</a></li>
</ul>
</div>
<?php if ($this->msg or $this->messages) :?>
@ -32,23 +28,47 @@
</div>
<?php endif; ?>
<div id="rightPanel">
<form name="form1" method="post" action="/admin/user/edit">
<table>
<tr><td width="80">记录ID</td><td><?php echo $this->infos['id'];?></td></tr>
<tr><td>用户名</td><td><?php echo $this->infos['uname'];?> > <a href="/admin/user/show/id/<?php echo $this->infos['uid'];?>">察看用户</a></td></tr>
<tr><td>姓名</td><td><?php echo $this->infos['username'];?></td></tr>
<tr><td>单位</td><td><?php echo $this->infos['unit'];?></td></tr>
<tr><td>电话</td><td><?php echo $this->infos['phone'];?></td></tr>
<tr><td>地址</td><td><?php echo $this->infos['address'];?></td></tr>
<tr><td>邮编</td><td><?php echo $this->infos['postcode'];?></td></tr>
<tr><td>电话</td><td><?php echo $this->infos['phone'];?></td></tr>
<tr><td>Email</td><td><?php echo $this->infos['email'];?></td></tr>
<tr><td>项目</td><td><textarea style="width:500px;height:200px;font-size:12px;"><?php echo $this->infos['project'];?></textarea></td></tr>
<tr><td>下载时间</td><td><?php echo date('Y-m-d H:i:s', strtotime($this->infos['ts_created']));?></td></tr>
<tr><td>项目名称</td><td><?php echo $this->infos['title'];?> > <a href="/data/<?php echo $this->infos['uuid'];?>">查看项目</a></td></tr>
<tr><td width="100">ID</td><td width="600"><?= $this->infos['id'];?></td></tr>
<tr><td>用户名</td><td><?= $this->infos['username'];?></td></tr>
<tr><td>真实姓名</td><td><?= $this->infos['realname'];?></td></tr>
<tr><td>电子邮箱</td><td><?= $this->infos['email'];?></td></tr>
<tr><td>注册时间</td><td><?=$this->infos['ts_created'];?></td></tr>
<tr><td>最后登陆时间</td><td><?= $this->infos['ts_last_login'];?></td></tr>
<tr><td>单位</td><td><?= $this->infos['unit'];?></td></tr>
<tr><td>地址</td><td><?= $this->infos['address'];?></td></tr>
<tr><td>电话</td><td><?= $this->infos['phone'];?></td></tr>
<tr><td>项目</td><td><?= $this->infos['project'];?></td></tr>
<tr><td>用户权限</td><td>
<select name="usertype">
<?php
if ($this->infos['usertype']=='member')
{ echo "
<option value='member' selected='selected'>普通会员</option>
<option value='administrator'>系统管理员</option>
";}
else if($this->infos['usertype']=='administrator')
{ echo "<option value='administrator' selected='selected'>系统管理员</option>
<option value='member'>普通会员</option>
";}
?>
</select>
</td></tr>
<tr><td>用户密码</td><td><input type='password' name="newpwd" /></td></tr>
<tr><td>确认用户密码</td><td><input type='password' name="cfnewpwd" /></td></tr>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
<input type='hidden' value="<?php echo $this->infos['id'];?>" name='id' />
<input type="submit" value="提交" />
</form>
<form name="lostpwd" action="/admin/user/fetchpwd">
<input type="hidden" name="id" value="<?= $this->infos['id'];?>" />
<input type="hidden" name="email" value="<?= $this->infos['email'];?>" />
<input type="submit" value="为他执行重置密码"/>
</form>
</div>