#451, 实现对知识积累的改造,实现了数据文献和西部计划文献的分离处理,并实现了搜索功能

This commit is contained in:
wlx 2013-04-10 08:14:51 +00:00
parent e63982b141
commit d8e55eeed7
9 changed files with 434 additions and 17 deletions

View File

@ -3,9 +3,6 @@ class KnowledgeController extends Zend_Controller_Action
{
function indexAction()
{
//$this->_redirect('/metadata');
$sql="select a.author,c.* from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 order by ts_created desc limit 10";
$this->view->articles=$this->db->fetchAll($sql);
}
function preDispatch()
{
@ -15,4 +12,113 @@ class KnowledgeController extends Zend_Controller_Action
$this->view->messages = $this->messenger->getMessages();
$this->view->theme=new Theme();
}
function datacenterAction()
{
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
$sql="select * from mdref mr left join reference r on mr.refid=r.id where mr.uuid=? order by r.id desc";
$sth = $this->db->prepare($sql);
$sth->execute(array($siteid));
$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;
}
function userAction()
{
$sql="select * from reference where id in (select refid from mdref where reftype=1 and uuid in (select uuid from normalmetadata)) order by id desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$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;
}
function authorAction()
{
$sql="select * from reference where id in (select refid from mdref where reftype=0 and uuid in (select uuid from normalmetadata)) order by id desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$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;
}
function westplanAction()
{
$sql="select distinct a.author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 order by ts_created desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$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;
}
function searchAction()
{
$key=$this->_request->getParam('q');
$source=$this->_request->getParam('searchsource');
if(preg_match("/\"|'|<|>/",$key))
{
$data=array('<'=>'&lt;','>'=>'&gt;', "\'"=>'', "\""=>'”');
$patterns = array();
$replacements = array();
foreach($data as $k=>$v)
{
$patterns[]='/'.$k.'/i';
$replacements[]=$v;
}
ksort($patterns);
ksort($replacements);
$key=preg_replace($patterns, $replacements, $key);
}
if (!empty($key) && $source=='datasource') {
$search=new SimpleSearch($key);
$where=$search->sql_expr(array("reference"));
$sql="select * from reference where ".$where." order by id desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$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;
$this->view->key=$key;
$this->view->source=$source;
$this->_helper->viewRenderer('search-data');
}
else if (!empty($key) && $source=='westsource') {
$search=new SimpleSearch($key);
$where=$search->sql_expr(array("c.title","a.author"));
$sql="select distinct a.author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c left join knl_author a on c.item_id=a.item_id where c.url <>'' and a.place=1 and $where order by ts_created desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$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;
$this->view->key=$key;
$this->view->source=$source;
//$this->_helper->viewRenderer('search-data');
}
}
}

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('数据作者');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml'); ?>
</div>
<div class="span9">
<div id="content">
<h2>数据作者文献库</h2>
<div>
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item): ?>
<li> <?php echo $item['reference']; ?>
<?php if (!empty($item['link'])) :
echo ' <a href="'.$item['link'].'">下载</a>';
endif;
?>
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $item['id'];?>',0)">相关数据</a>
</li>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-author').addClass('active');
</script>
<script>
function showdata(id,page){
var url="/service/refdatalist/id/"+id;
$.ajax({
'type':"GET",
'url':url,
'data':'page='+page,
'dataType':'html',
'success':function(html){$.colorbox({'html':html,'innerHeight':230});}
});
}
</script>

View File

@ -0,0 +1,38 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('数据中心');
$this->breadcrumb()->setSeparator(' > ');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml'); ?>
</div>
<div class="span9">
<div id="content">
<h2>数据中心文献库</h2>
<div>
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item): ?>
<li> <?php echo $item['reference']; ?>
<?php if (!empty($item['link'])) :
echo ' <a href="'.$item['link'].'">下载</a>';
endif;
?>
</li>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-datacenter').addClass('active');
</script>

View File

@ -40,12 +40,15 @@ $this->breadcrumb()->setSeparator(' > ');
</div>
<div class="item hero-unit">
<h2>数据作者文献库</h2>
<p>中国环境与生态科学知识积累平台Sharing Environment and Ecology Knowledge Space旨在发展和形成一个支持环境与生态科学领域开放学术信息的自助存档、交流和发现的领域知识平台。首先实现对国家自然科学基金委组织实施的“中国西部环境与生态科学研究计划”历年来所支持的研究项目和课题所产生的有重要科研和学术价值的知识产出进行统一组织和管理建立长期保存与开放持续利用的机制促进知识产出的共享利用扩大其影响和应用效益。其次支持对国内外环境与生态科学领域的各种有价值的开放性学术资源的集成利用特别是对有重要学术影响的研究性数字知识库主要是机构知识库也包括一些学科知识库和个人知识库所涉及的环境与生态科学领域的学术信息进行搜索、发现、聚集和再组织。</p>
<p>数据作者文献库是对发布在数据中心的科学数据中相关的参考文献,主要是由数据作者发表的、和其数据紧密相关的科学文献。</p>
<p>旨在发展和形成一个支持环境与生态科学领域开放学术信息的自助存档、交流和发现的领域知识平台。
其次,支持对国内外环境与生态科学领域的各种有价值的开放性学术资源的集成利用,特别是对有重要学术影响的研究性数字知识库(主要是机构知识库,也包括一些学科知识库和个人知识库)所涉及的环境与生态科学领域的学术信息进行搜索、发现、聚集和再组织。</p>
<p><a class="btn btn-primary" href="/knowledge/author">查看 &raquo;</a></p>
</div>
<div class="item hero-unit">
<h2>数据作者文献库</h2>
<p>中国环境与生态科学知识积累平台Sharing Environment and Ecology Knowledge Space旨在发展和形成一个支持环境与生态科学领域开放学术信息的自助存档、交流和发现的领域知识平台。首先实现对国家自然科学基金委组织实施的“中国西部环境与生态科学研究计划”历年来所支持的研究项目和课题所产生的有重要科研和学术价值的知识产出进行统一组织和管理建立长期保存与开放持续利用的机制促进知识产出的共享利用扩大其影响和应用效益。其次支持对国内外环境与生态科学领域的各种有价值的开放性学术资源的集成利用特别是对有重要学术影响的研究性数字知识库主要是机构知识库也包括一些学科知识库和个人知识库所涉及的环境与生态科学领域的学术信息进行搜索、发现、聚集和再组织。</p>
<h2>数据用户文献库</h2>
<p>数据用户文献库是数据用户在使用科学数据后公开发表在科技期刊上的文献,由用户自发通知数据中心、数据作者收集和数据中心集中手机三种方式进行收集整理。</p>
<p>其次,支持对国内外环境与生态科学领域的各种有价值的开放性学术资源的集成利用,特别是对有重要学术影响的研究性数字知识库(主要是机构知识库,也包括一些学科知识库和个人知识库)所涉及的环境与生态科学领域的学术信息进行搜索、发现、聚集和再组织。</p>
<p><a class="btn btn-primary" href="/knowledge/user">查看 &raquo;</a></p>
</div>
</div>

View File

@ -7,18 +7,19 @@
<li id="Nav-knowledge-datacenter"><a href="/knowledge/datacenter"><i class="icon-chevron-right"></i>数据中心文献库</a></li>
</ul>
</div>
<form class="form-search" id="search" enctype="application/x-www-form-urlencoded" action="/knowledge/search" method="post">
<form class="form-search" id="search" enctype="application/x-www-form-urlencoded" action="/knowledge/search" method="get">
<div class="input-append">
<input class="span2" id="q" name="q" type="text" value="<?php echo (empty($this->key))?'':$this->key; ?>" placeholder="搜索作者和标题">
<div class="btn-group">
<button class="btn dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>
</button>
<ul class="dropdown-menu">
<li><a href="">西部计划文献库</a></li>
<li><a href="">数据作者文献库</a></li>
</ul>
<button type="submit" class="btn">搜索</button>
<div class="form-actions">
<label class="radio">
<input type="radio" name="searchsource" id="datasource" value="datasource" <?php echo ($this->source=='datasource')?'checked':''; ?>>
数据文献库
</label>
<label class="radio">
<input type="radio" name="searchsource" id="westsource" value="westsource" <?php echo ($this->source=='datasource')?'':'checked'; ?>>
西部计划文献库
</label>
</div>
</div>
</form>

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('数据文献搜索');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml',array('key'=>$this->key,'source'=>$this->source)); ?>
</div>
<div class="span9">
<div id="content">
<h2>数据文献搜索</h2>
<div>
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item): ?>
<li> <?php echo $item['reference']; ?>
<?php if (!empty($item['link'])) :
echo ' <a class="btn btn-mini btn-inverse" href="'.$item['link'].'">下载</a>';
endif;
?>
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $item['id'];?>',0)">相关数据</a>
</li>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-user').addClass('active');
</script>
<script>
function showdata(id,page){
var url="/service/refdatalist/id/"+id;
$.ajax({
'type':"GET",
'url':url,
'data':'page='+page,
'dataType':'html',
'success':function(html){$.colorbox({'html':html,'innerHeight':230});}
});
}
</script>

View File

@ -0,0 +1,55 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('西部计划');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml',array('key'=>$this->key,'source'=>$this->source)); ?>
</div>
<div class="span9">
<div id="content">
<h2>西部计划文献搜索</h2>
<div>
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item):
$u=parse_url($item['url']);
if ($u['host']=='hdl.handle.net')
$url=$this->config->seekspace->handleurl.$u['path'];
else
$url=$item['url'];
?>
<li>[<?= date('Y-m-d',strtotime($item['ts_created'])); ?>]<a class="itemTitle" href="<?= $url; ?>" target="_blank" title="<?= $item['publisher']; ?>"><span><?= $item['title']; ?></span></a><?= $item['author']; ?>等. <?= $item['publisher']; ?>
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $item['item_id'];?>',0)">相关数据</a>
</li>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-westplan').addClass('active');
</script>
<script>
function showdata(id,page){
var url="/service/tagdatalist/id/"+id;
$.ajax({
'type':"GET",
'url':url,
'data':'page='+page,
'dataType':'html',
'success':function(html){$.colorbox({'html':html,'innerHeight':250});}
});
}
</script>

View File

@ -0,0 +1,53 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('数据用户');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml'); ?>
</div>
<div class="span9">
<div id="content">
<h2>数据用户文献库</h2>
<div>
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item): ?>
<li> <?php echo $item['reference']; ?>
<?php if (!empty($item['link'])) :
echo ' <a href="'.$item['link'].'">下载</a>';
endif;
?>
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $item['id'];?>',0)">相关数据</a>
</li>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-user').addClass('active');
</script>
<script>
function showdata(id,page){
var url="/service/refdatalist/id/"+id;
$.ajax({
'type':"GET",
'url':url,
'data':'page='+page,
'dataType':'html',
'success':function(html){$.colorbox({'html':html,'innerHeight':230});}
});
}
</script>

View File

@ -0,0 +1,55 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle('知识积累');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/mdreview.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
$this->breadcrumb('西部计划');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
$this->headLink()->appendStylesheet('/css/colorbox.css');
?>
<div class="row">
<div class="span3">
<?= $this->partial('knowledge/navi.phtml'); ?>
</div>
<div class="span9">
<div id="content">
<h2>西部计划文献库</h2>
<div>
<?php if (count($this->paginator)): ?>
<ul>
<?php foreach ($this->paginator as $item):
$u=parse_url($item['url']);
if ($u['host']=='hdl.handle.net')
$url=$this->config->seekspace->handleurl.$u['path'];
else
$url=$item['url'];
?>
<li>[<?= date('Y-m-d',strtotime($item['ts_created'])); ?>]<a class="itemTitle" href="<?= $url; ?>" target="_blank" title="<?= $item['publisher']; ?>"><span><?= $item['title']; ?></span></a><?= $item['author']; ?>等. <?= $item['publisher']; ?>
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $item['item_id'];?>',0)">相关数据</a>
</li>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<script type="text/javascript" >
$('#Nav-knowledge-westplan').addClass('active');
</script>
<script>
function showdata(id,page){
var url="/service/tagdatalist/id/"+id;
$.ajax({
'type':"GET",
'url':url,
'data':'page='+page,
'dataType':'html',
'success':function(html){$.colorbox({'html':html,'innerHeight':250});}
});
}
</script>