Ticket #150 在Downcontroller中增加了新的动作和参数

This commit is contained in:
Li Jianxuan 2011-09-13 02:51:34 +00:00
parent 68367d42c8
commit 07d5e2163d
7 changed files with 443 additions and 40 deletions

View File

@ -236,6 +236,10 @@ class Admin_DownController extends Zend_Controller_Action
}
//在线数据下载情况仅针对onlineapp表自2011-9-8开始记录。
function onlineAction()
{
$ac=$this->_getParam('ac');
$id=(int)$this->_getParam('id');
if(empty($ac) || empty($id))
{
$select=$this->db->select();
$select->from('onlineapp as o',array('id','userid','unit','username','ts_created','project'))
@ -252,6 +256,127 @@ class Admin_DownController extends Zend_Controller_Action
$re=$this->db->query($count);
$t=$re->fetch();
$this->view->t=$t;
}//列表
if($ac=='delete' && !empty($id))
{
$sql="delete from onlineapp where id=?";
try {
$this->db->query($sql,array($id));
$this->messenger->addMessage('该记录已删除');
} catch (Exception $e) {
$this->messenger->addMessage($e->getMessage());
}
$this->_redirect("/admin/down/online/");
}//删除
if($ac=='show' && !empty($id))
{
$sql ="select o.*,u.username as uname,u.id as uid,m.title,m.uuid
from onlineapp as o
left join users as u on u.id = o.userid
left join metadata as m on o.uuid = m.uuid
where o.id=?";
$result =$this->db->query($sql,$id);
$rows = $result->fetch();
$this->view->infos=$rows;
$this->_helper->viewRenderer('onlineshow');
}//查看详细
}//onlineAction
function userAction()
{
$ac=$this->_getParam('ac');
$id=(int)$this->_getParam('id');
if(empty($ac)|| empty($id))
{
$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')
->group('realname')
->order('num 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;
}//列表
if($ac=='show' && !empty($id))
{
$select=$this->db->select();
$select->from('onlineapp as o',array('id','username','ts_created'))
->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid'))
->where('o.userid = ?', $id)
->order('o.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;
$sql="select username,realname from users where id='$id'";
$re=$this->db->query($sql);
$t=$re->fetch();
$this->view->infos=$t;
$this->_helper->viewRenderer('showuser');
}//查看单个用户的下载记录
}//userAction 用户下载情况
function dataAction()
{
$ac=$this->_getParam('ac');
$uuid = $this->_request->getParam('uuid');
if(empty($ac) || $ac=='list')
{
$select=$this->db->select();
$select->from('onlineapp as o','count(o.id) as num')
->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid'))
->where('o.uuid = m.uuid')
->group('m.title')
->group('m.uuid')
->order('num 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;
}//数据下载情况列表
if($ac=='show' && !empty($uuid))
{
$select=$this->db->select();
$select->from('onlineapp as o',array('id','username','ts_created'))
->join('metadata as m', 'o.uuid = m.uuid', array('title','uuid'))
->where('m.uuid = ?', $uuid)
->order('o.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;
$sql="select title from metadata where uuid='$uuid'";
$re=$this->db->query($sql);
$t=$re->fetch();
$this->view->infos=$t;
$this->_helper->viewRenderer('showdata');
}//查看单个数据下载情况
}//dataAction 数据下载情况
}

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台管理首页</a>');
$this->breadcrumb('在线下载记录');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</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">
<table>
<tr style="color:#FFF;background:#0a3e68;line-height:30px;">
<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><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?php echo $item['title'];?></a></td>
<td><?php echo $item['num']; ?></td>
<td>
<a href='/admin/down/data/ac/show/uuid/<?php echo $item['uuid'];?>'>查看详细</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
</div>

View File

@ -12,8 +12,6 @@
<div id="leftPanel">
<?= $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,31 +21,38 @@
<?php endforeach;endif; ?>
</div>
<?php endif; ?>
<div>共有 <?php echo $this->t['total'];?> 条在线下载记录</div>
<?php if (count($this->paginator)): ?>
<table class="offline" cellspacing=0>
<thead><tr>
<th id="name">姓名</th>
<th id="unit">单位</th>
<th id="title">数据</th>
<th id="project">用途</th>
<th id="ts">时间</th>
<th id="name">操作</th>
</tr></thead>
<tbody>
<?php foreach ($this->paginator as $item): ?>
<tr><td class="name"><a href="/admin/user/show/id/<?= $item['userid']; ?>"><img src="/images/user.gif"></a> <a href="/admin/down/user/id/<?= $item['userid']; ?>"><?= $item['username']; ?></a></td>
<td class="unit"><?= $item['unit']; ?></td>
<td class="title"><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><img src="/images/data.gif"></a> <a href="/admin/down/data/<?php echo $item['uuid'];?>"><?php echo $item['title'];?></a></td>
<td class="project"><?= $item['project']; ?></td>
<td class="ts"><?= date('Y-m-d',strtotime($item['ts_created'])); ?></td>
<td class="action">
<a href="/admin/down/online/show/<?= $item['id']; ?>">查看</a>
<a href="/admin/down/online/delete/<?= $item['id']; ?>">删除</a>
<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='100'>姓名</td>
<td width='150'>单位</td>
<td width='350'>数据</td>
<td width='300'>用途</td>
<td width='120'>下载时间</td>
<td width='100'>操作</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><img src="/images/user.gif" /><?= $item['username']?></td>
<td><?= $item['unit']?></td>
<td><img src="/images/data.gif" /><a href="/data/<?php echo $item['uuid'];?>" target="_blank"><?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><?php echo date('Y-m-d H:i:s', strtotime($item['ts_created'])); ?></td>
<td>
<a href='/admin/down/online/ac/show/id/<?php echo $item['id'];?>'>查看详细</a>
<a href='/admin/down/online/ac/delete/id/<?= $item['id'];?>/' onclick="return confirm('确定将此记录删除?')">删除</a>
</td>
</tr>
</tr>
<?php endforeach; ?>
</tbody></table>
<?php endif; ?>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
</div>

View File

@ -0,0 +1,47 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台管理首页</a>');
$this->breadcrumb('详细信息');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</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">
<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>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
</div>

View File

@ -0,0 +1,60 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$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()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</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->infos['title']; ?>” 的下载记录</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/down/online/ac/show/id/<?php echo $item['id'];?>'>查看详细</a>
<a href='/admin/down/online/ac/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>

View File

@ -0,0 +1,60 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$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()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</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->infos['username']; ?>” 的下载记录</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/down/online/ac/show/id/<?php echo $item['id'];?>'>查看详细</a>
<a href='/admin/down/online/ac/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>

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('后台管理');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin">后台管理首页</a>');
$this->breadcrumb('在线下载记录');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/prototype.js');
?>
<div id="divContent">
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</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">
<table>
<tr style="color:#FFF;background:#0a3e68;line-height:30px;">
<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><a href="/admin/user/show/id/<?php echo $item['uid'];?>" target="_blank"><?php echo $item['realname'];?></a></td>
<td><?php echo $item['num']; ?></td>
<td>
<a href='/admin/down/user/ac/show/id/<?php echo $item['uid'];?>'>查看详细</a>
</td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
</table>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
</div>