fix #483, 实现基于数据作者的浏览
This commit is contained in:
parent
a23cb14414
commit
6fd9b4cb0f
|
@ -1947,7 +1947,76 @@ class DataController extends Zend_Controller_Action
|
|||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
|
||||
}
|
||||
|
||||
//基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者)
|
||||
function authorAction()
|
||||
{
|
||||
$ac = $this->_request->getParam('ac');
|
||||
$id = (int)$this->_request->getParam('id');
|
||||
if ($ac=='verified') {
|
||||
//已经认证过的数据作者
|
||||
$this->view->pageID='author-verified';
|
||||
$this->view->ac='verified';
|
||||
if ($id) {
|
||||
//列出作者的数据
|
||||
$sql="select username,realname from users where id=?";
|
||||
$this->view->author=$this->db->fetchRow($sql,array($id));
|
||||
$sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where a.userid=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($id));
|
||||
$rows = $sth->fetchAll();
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
} else {
|
||||
//已经认证过的数据作者
|
||||
$sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(50);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
} else if ($ac=='unverified' || empty($ac)) {
|
||||
//未认证的数据作者
|
||||
$this->view->pageID='author-unverified';
|
||||
$this->view->ac='unverified';
|
||||
if ($id) {
|
||||
//列出数据
|
||||
$sql="select individual as username from responsible where id=?";
|
||||
$this->view->author=$this->db->fetchRow($sql,array($id));
|
||||
$sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.role in ('pointOfContact','resourceProvider','owner') and s.id=?";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute(array($id));
|
||||
$rows = $sth->fetchAll();
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
} else {
|
||||
//列出所有作者
|
||||
$sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
$paginator = Zend_Paginator::factory($rows);
|
||||
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||
$paginator->setItemCountPerPage(50);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->data);
|
||||
$this->headTitle('数据作者浏览');
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||
$this->breadcrumb('<a href="/data/author">数据作者浏览</a>');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->theme->AppendPlus($this,'colorbox');
|
||||
?>
|
||||
<div class='row-fluid'>
|
||||
<div><?= $this->breadcrumb() ?> </div>
|
||||
<?= $this->partial('data/tools.phtml'); ?>
|
||||
<ul class="nav nav-tabs">
|
||||
<li id="Nav-author-unverified"><a href="/data/author">未认证的数据作者<?php if ($this->author && $this->ac=='unverified') echo ':'.$this->author['username']; ?></a></li>
|
||||
<li id="Nav-author-verified"><a href="/data/author/ac/verified">已认证的数据作者<?php if ($this->author && $this->ac=='verified') echo ':'.$this->author['username'].'['.$this->author['realname'].']'; ?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if ($this->author) : ?>
|
||||
<?php if (!empty($this->paginator)) : ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
<?php foreach($this->paginator as $md) : ?>
|
||||
<div class="media well well-small">
|
||||
<a class="pull-left colorbox" href="/service/bigthumb/uuid/<?php echo $md['uuid']; ?>">
|
||||
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
|
||||
</a>
|
||||
<div class="media-body">
|
||||
<h4 class="media-heading"><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
|
||||
<?php if (@$md['datadoi']) : ?>
|
||||
<h4 class="media-heading">DOI:<?php echo $md['datadoi'];?>
|
||||
<?php if (@$md['ts_submitted']) : ?> <span class="label label-info">申请日期:<?php echo $md['ts_submitted'];?></span>
|
||||
<?php else: if (@$md['ts_created']) : ?> <span class="label label-info">创建日期:<?php echo $md['ts_created'];?></span> <?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php if (@$md['ts_published']) : ?> <span class="label label-success">发布日期:<?php echo $md['ts_published'];?></span><?php endif; ?>
|
||||
</h4>
|
||||
<?php else: if (@$md['doi']): ?>
|
||||
<h4 class="media-heading">DOI:<?php echo $md['doi']; ?></h4>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
<?php endif; ?>
|
||||
<?php else : ?>
|
||||
<?php if (!empty($this->paginator)) : ?>
|
||||
<div class="pagenavi"><?= $this->paginator; ?></div>
|
||||
<ul class="row">
|
||||
<?php foreach($this->paginator as $author) : ?>
|
||||
<li class="span3"><a href="/data/author/ac/<?php echo $this->ac; ?>/id/<?php echo $author['id']; ?>">
|
||||
<?php
|
||||
echo $author['username'];
|
||||
if ($this->ac=='verified') echo '['.$author['realname'].', 共'.$author['count'].'条]';
|
||||
?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endif; ?>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function(){
|
||||
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
|
||||
$(".colorbox").colorbox({photo:"true"});
|
||||
});
|
||||
</script>
|
Loading…
Reference in New Issue