增加了查看所有数据作者的功能

This commit is contained in:
Li Jianxuan 2012-06-11 07:56:02 +00:00
parent 95580f7259
commit dc0b83af5c
3 changed files with 157 additions and 3 deletions

View File

@ -2181,14 +2181,24 @@ class Admin_DataController extends Zend_Controller_Action
/*
authorAction() 数据作者
*/
* authorAction() 数据作者
*
* param string $ac //动作
=add 添加
=edit 编辑
=update 更新
=del 删除
=list 列出所有数据作者
* param string $uuid //UUID
*
* return view|application-json
*/
public function authorAction(){
$ac = $this->_getParam('ac');
$uuid = $this->_getParam('uuid');
if(empty($ac) && empty($uuid))
{
@ -2393,6 +2403,49 @@ class Admin_DataController extends Zend_Controller_Action
}//认证作者
else if($ac =="list")
{
$this->_helper->viewRenderer('author-list');
$sql = "SELECT u.id,u.realname,u.email,count(a.id) as d FROM mdauthor a
LEFT JOIN users u ON a.userid=u.id
WHERE a.status>0
GROUP BY u.id,u.realname,u.email
ORDER BY u.id DESC";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(15);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
else if($ac == "userdatas")
{
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$id = $this->_getParam('id');
$sql = "SELECT md.title,md.uuid FROM mdauthor a
LEFT JOIN metadata md ON a.uuid=md.uuid
WHERE a.userid=? AND a.status>0
ORDER BY a.ts_created";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$rows = $sth->fetchAll();
$data = array("datas"=>$rows);
$this->jsonexit($data);
return true;
}
}//authorAction() 数据作者管理

View File

@ -0,0 +1,95 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/admin.css');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/author.css');
$this->headLink()->appendStylesheet('/css/colorbox.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/admin/data">数据管理</a>');
$this->breadcrumb('数据作者管理');
$this->breadcrumb()->setSeparator(' > ');
?>
<!-- 左侧导航 -->
<div id="leftPanel">
<?= $this->partial('data/left.phtml'); ?>
</div>
<!-- //左侧导航 -->
<!-- 页面内容 -->
<div id="rightPanel">
<div id="tabs-controller">
<ul>
<li class="box-shadow"><a class="text-shadow" href="/admin/data/author">作者管理</a></li>
<li class="box-shadow active"><a class="text-shadow" href="/admin/data/author/ac/list">查看所有数据作者</a></li>
</ul>
</div>
<div>
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/admin/data/author/ac/list">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button>
</form>
</div>
<div id="datalist">
<?php
if (count($this->paginator)):
if ($this->mdtitle) echo "<h2>元数据:".$this->mdtitle."</h2>";
echo "<ul>";
$autoindex=0;
foreach ($this->paginator as $item):
$autoindex++;?>
<li id="list_<?php echo $item['id'];?>">
<p><a href="/admin/user/show/id/<?= $item['id'] ?>" target="_blank"><?php echo $item['realname'];?></a> </p>
<p>
<?php if ($item['d']) : ?>
数据个数 <span id="sumAuthor_<?php echo $item['id'];?>"><?php echo $item['d']; ?></span> | <a href="javascript:;" onclick="view(<?= $item['id']?>)">查看数据</a> | Email: <span><?= $item['email'];?></span>
<?php endif; ?>
</p>
</li>
<?php endforeach;
echo "</ul>";
endif; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
<!-- //页面内容 -->
<script>
function view(id){
$.ajax({
'type':"POST",
'url':'/admin/data/author',
'data':'ac=userdatas&id='+id,
'success':function(data){
if (typeof(data)=='object')
{
if(typeof(data.error)!='undefined')
{Alert(data.error);return false;}
if(data.datas != null)
{
html = "";
for(v in data.datas)
{
html += '<li><a href="/data/'+data.datas[v].uuid+'" target="_blank">'+data.datas[v].title+'</a></li>';
}
$.colorbox({'innerWidth':'50%','html':html});
}
}
else{
Alert('出现错误,请稍后再试');
}
},
'timeout': 30000,
'error': function(){
$.colorbox({'innerWidth':'50%','html':'<img src="/images/alert_big_error.png" /><h4>处理中出现错误,请刷新页面后重试</h4>'});
}
});
}
$(".iframe").colorbox({iframe:true, width:"80%", height:"80%"});
$(".inline").colorbox({inline:true, width:"50%"});
function Alert(html){
$.colorbox({'innerWidth':'50%','html':'<h4 style="font-size:16px;font-weight:bold;">'+html+'</h4>'});
}
</script>

View File

@ -20,6 +20,12 @@ $this->breadcrumb()->setSeparator(' > ');
<!-- 页面内容 -->
<div id="rightPanel">
<div id="tabs-controller">
<ul>
<li class="box-shadow active"><a class="text-shadow" href="/admin/data/author">作者管理</a></li>
<li class="box-shadow"><a class="text-shadow" href="/admin/data/author/ac/list">查看所有数据作者</a></li>
</ul>
</div>
<div>
<p>请输入元数据标题关键字进行搜索</p>
<form id="datasearch" class="search_form" action="/admin/data/author">