Ticket #191 增加了导出用户email的功能。

This commit is contained in:
Li Jianxuan 2011-09-29 02:24:47 +00:00
parent e7233554de
commit 8cbe2bf913
2 changed files with 98 additions and 63 deletions

View File

@ -186,6 +186,7 @@ class Admin_DownController extends Zend_Controller_Action
$update=$this->_getParam('update');
$show=$this->_getParam('show');
$undelete=$this->_getParam('undelete');
$emaillist=$this->_getParam('emaillist');
if ($add) {
$form=new OfflinelogForm();
@ -311,6 +312,40 @@ class Admin_DownController extends Zend_Controller_Action
$this->_helper->viewRenderer('offlineshow');
}//查看单条记录
else if($emaillist)
{
$sql = "select distinct(t.*) from
(
select u.email from dataorder d left join users u on d.userid=u.id where (d.status=0 or d.status=5)
union
select o.email from offlineapp o where o.userid is null and o.email is not null
) as t";
$re = $this->db->query($sql);
$rows = $re->fetchAll();
$filecontent = "";
foreach($rows as $row){
$filecontent.=$row['email']."\r\n";
}
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$this->getResponse()->setHeader('Content-Type', 'application/octet-stream')
->setHeader('Content-Disposition','attachment; filename="emails.txt"')
->setHeader('Content-Length', strlen($filecontent))
->setHeader('Content-Type','application/force-download')
->setHeader('Content-Type','application/download')
->setHeader('Content-Description','File Transfer')
->setHeader('Content-Transfer-Encoding','binary')
->setHeader('Expires',0)
->setHeader('Cache-Control','must-revalidate, post-check=0, pre-check=0')
->setHeader('Pragma','public')
->setBody($filecontent);
}//下载邮箱地址列表
$select=$this->db->select();
$select->from('offlineapp')->where('ts_approved is not null')->where('pdflink is not null')->order('ts_created desc');
$paginator = Zend_Paginator::factory($select);

View File

@ -1,64 +1,64 @@
<?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/down">申请管理</a>');
$this->breadcrumb('离线数据申请管理</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div id="rightPanel">
<?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 class="right_title">离线数据服务记录</div>
<a href="/admin/down/offline/add/1">添加新的离线服务记录</a> | <a href="/admin/down/offline/down/1">下载所有离线服务记录</a> | <a href="/admin/down/offline/update/1" onclick="return confirm('该操作需要较长时间,请不要中途刷新页面,是否确定继续?')">自动匹配离线下载用户与网站用户</a>
<?php if (count($this->paginator)): ?>
<table>
<thead><tr>
<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 $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><?= $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']; ?>" title="该操作将删除此记录并且删除与此记录有关的申请记录!请谨慎操作" onclick="return confirm('请仅删除测试用途的离线服务记录!')">删除</a> |
<a href="/admin/down/offlineapp/view/<?= $item['id']; ?>">PDF</a> |
<a href="/admin/down/offline/show/<?= $item['id']; ?>">详细</a>
</td>
</tr>
<?php endforeach; ?>
</tbody></table>
<?php endif; ?>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
<?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/down">申请管理</a>');
$this->breadcrumb('离线数据申请管理</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id="leftPanel">
<?= $this->partial('down/left.phtml'); ?>
</div>
<div id="rightPanel">
<?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 class="right_title">离线数据服务记录</div>
<a href="/admin/down/offline/add/1">添加新的离线服务记录</a> | <a href="/admin/down/offline/down/1">下载所有离线服务记录</a> | <a href="/admin/down/offline/update/1" onclick="return confirm('该操作需要较长时间,请不要中途刷新页面,是否确定继续?')">自动匹配离线下载用户与网站用户</a> | <a href="/admin/down/offline/emaillist/1">下载服务用户邮箱列表</a>
<?php if (count($this->paginator)): ?>
<table>
<thead><tr>
<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 $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><?= $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']; ?>" title="该操作将删除此记录并且删除与此记录有关的申请记录!请谨慎操作" onclick="return confirm('请仅删除测试用途的离线服务记录!')">删除</a> |
<a href="/admin/down/offlineapp/view/<?= $item['id']; ?>">PDF</a> |
<a href="/admin/down/offline/show/<?= $item['id']; ?>">详细</a>
</td>
</tr>
<?php endforeach; ?>
</tbody></table>
<?php endif; ?>
<div style="width:50%;text-align:left;">
<?= $this->paginator; ?>
</div>
</div>