#558 增加了从表中读取信息的功能
This commit is contained in:
parent
475f67534a
commit
c1f5c7de56
|
@ -1,17 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
class KnowledgeController extends Zend_Controller_Action
|
class KnowledgeController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
function indexAction()
|
function indexAction()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
function preDispatch()
|
function preDispatch()
|
||||||
{
|
{
|
||||||
$this->db=Zend_Registry::get('db');
|
$this->db=Zend_Registry::get('db');
|
||||||
$this->view->config = Zend_Registry::get('config');
|
$this->view->config = Zend_Registry::get('config');
|
||||||
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
||||||
$this->view->messages = $this->messenger->getMessages();
|
$this->view->messages = $this->messenger->getMessages();
|
||||||
$this->view->theme=new Theme();
|
$this->view->theme=new Theme();
|
||||||
}
|
}
|
||||||
function datacenterAction()
|
function datacenterAction()
|
||||||
{
|
{
|
||||||
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
|
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
|
||||||
|
@ -24,8 +24,8 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
$paginator->setItemCountPerPage(10);
|
$paginator->setItemCountPerPage(10);
|
||||||
$paginator->setView($this->view);
|
$paginator->setView($this->view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
}
|
}
|
||||||
function userAction()
|
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";
|
$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";
|
||||||
|
@ -37,8 +37,8 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
$paginator->setItemCountPerPage(10);
|
$paginator->setItemCountPerPage(10);
|
||||||
$paginator->setView($this->view);
|
$paginator->setView($this->view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
}
|
}
|
||||||
function authorAction()
|
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";
|
$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";
|
||||||
|
@ -50,12 +50,12 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
$paginator->setItemCountPerPage(10);
|
$paginator->setItemCountPerPage(10);
|
||||||
$paginator->setView($this->view);
|
$paginator->setView($this->view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
}
|
}
|
||||||
|
|
||||||
function westplanAction()
|
function westplanAction()
|
||||||
{
|
{
|
||||||
$sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc";
|
$sql="select distinct array_to_string(array(select author from knl_author t where t.item_id=c.item_id order by place asc),'; ') as author,c.title,c.publisher,c.ts_created,c.ts_issued,c.item_id,c.url from knl_article c where c.url <>'' order by ts_created desc";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$rows = $sth->fetchAll();
|
$rows = $sth->fetchAll();
|
||||||
|
@ -64,11 +64,11 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
$paginator->setItemCountPerPage(10);
|
$paginator->setItemCountPerPage(10);
|
||||||
$paginator->setView($this->view);
|
$paginator->setView($this->view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
}
|
}
|
||||||
function searchAction()
|
function searchAction()
|
||||||
{
|
{
|
||||||
$key=$this->_request->getParam('q');
|
$key=$this->_request->getParam('q');
|
||||||
$source=$this->_request->getParam('searchsource');
|
$source=$this->_request->getParam('searchsource');
|
||||||
if(preg_match("/\"|'|<|>/",$key))
|
if(preg_match("/\"|'|<|>/",$key))
|
||||||
{
|
{
|
||||||
|
@ -89,7 +89,7 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
if (!empty($key) && $source=='datasource') {
|
if (!empty($key) && $source=='datasource') {
|
||||||
$search=new SimpleSearch($key);
|
$search=new SimpleSearch($key);
|
||||||
$where=$search->sql_expr(array("reference"));
|
$where=$search->sql_expr(array("reference"));
|
||||||
$sql="select * from reference where ".$where." order by id desc";
|
$sql="select * from reference where ".$where." order by id desc";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$rows = $sth->fetchAll();
|
$rows = $sth->fetchAll();
|
||||||
|
@ -98,14 +98,14 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
$paginator->setItemCountPerPage(10);
|
$paginator->setItemCountPerPage(10);
|
||||||
$paginator->setView($this->view);
|
$paginator->setView($this->view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
$this->view->key=$key;
|
$this->view->key=$key;
|
||||||
$this->view->source=$source;
|
$this->view->source=$source;
|
||||||
$this->_helper->viewRenderer('search-data');
|
$this->_helper->viewRenderer('search-data');
|
||||||
}
|
}
|
||||||
else if (!empty($key) && $source=='westsource') {
|
else if (!empty($key) && $source=='westsource') {
|
||||||
$search=new SimpleSearch($key);
|
$search=new SimpleSearch($key);
|
||||||
$where=$search->sql_expr(array("c.title","a.author"));
|
$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";
|
$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 = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
|
@ -115,28 +115,28 @@ class KnowledgeController extends Zend_Controller_Action
|
||||||
$paginator->setItemCountPerPage(10);
|
$paginator->setItemCountPerPage(10);
|
||||||
$paginator->setView($this->view);
|
$paginator->setView($this->view);
|
||||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||||
$this->view->paginator=$paginator;
|
$this->view->paginator=$paginator;
|
||||||
$this->view->key=$key;
|
$this->view->key=$key;
|
||||||
$this->view->source=$source;
|
$this->view->source=$source;
|
||||||
//$this->_helper->viewRenderer('search-data');
|
//$this->_helper->viewRenderer('search-data');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function paperAction()
|
function paperAction()
|
||||||
{
|
{
|
||||||
$id = (int)$this->_request->getParam('id');
|
$id = (int)$this->_request->getParam('id');
|
||||||
$sql="select * from reference where id=$id";
|
$sql="select * from reference where id=$id";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$this->view->paper = $sth->fetch();
|
$this->view->paper = $sth->fetch();
|
||||||
|
|
||||||
$sql="select * from ref_author where id=$id order by place";
|
$sql="select * from ref_author where id=$id order by place";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$this->view->author = $sth->fetchAll();
|
$this->view->author = $sth->fetchAll();
|
||||||
|
|
||||||
$sql="select * from ref_tag where id=$id";
|
$sql="select * from ref_tag where id=$id";
|
||||||
$sth = $this->db->prepare($sql);
|
$sth = $this->db->prepare($sql);
|
||||||
$sth->execute();
|
$sth->execute();
|
||||||
$this->view->tag = $sth->fetchAll();
|
$this->view->tag = $sth->fetchAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1453,6 +1453,24 @@ class ServiceController extends Zend_Controller_Action
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
echo $pagnation;
|
echo $pagnation;
|
||||||
}//文档页面相关数据
|
}//文档页面相关数据
|
||||||
|
|
||||||
|
function refdatacountAction()
|
||||||
|
{
|
||||||
|
if(view::isXmlHttpRequest($this))
|
||||||
|
{
|
||||||
|
$id = (int)$this->_getParam('id');
|
||||||
|
if($id < 1){
|
||||||
|
echo 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$sql = "select count(md.id) as total from mdref mr
|
||||||
|
right join normalmetadata md on md.uuid=mr.uuid
|
||||||
|
where mr.refid=$id";
|
||||||
|
$rs = $this->db->query($sql);
|
||||||
|
$row = $rs->fetch();
|
||||||
|
echo $row['total'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function tagdatalistAction(){
|
function tagdatalistAction(){
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ $this->headLink()->appendStylesheet('/css/mdreview.css');
|
||||||
$this->breadcrumb('<a href="/">首页</a>');
|
$this->breadcrumb('<a href="/">首页</a>');
|
||||||
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
|
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
|
||||||
$this->breadcrumb('文章查看');
|
$this->breadcrumb('文章查看');
|
||||||
$this->breadcrumb()->setSeparator(' > ');
|
$this->breadcrumb()->setSeparator(' > ');
|
||||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||||
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||||
?>
|
?>
|
||||||
|
@ -16,48 +16,71 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||||
</div>
|
</div>
|
||||||
<div class="span9">
|
<div class="span9">
|
||||||
<div id="content">
|
<div id="content">
|
||||||
<h3><?php echo $this->paper['title']; ?></h3>
|
<?php if(!empty($this->paper['title'])){ ?>
|
||||||
<ul>
|
<h3><?php echo $this->paper['title']; ?></h3>
|
||||||
<?php foreach($this->author as $a) : ?>
|
<hr />
|
||||||
<li><a href="#"><?php echo $a['lastname'];if (!empty($a['firstname'])) echo ', '.$a['firstname']; ?></a></li>
|
<?php } ?>
|
||||||
<?php endforeach; ?>
|
<?php if(count($this->author) > 0) {?>
|
||||||
</ul>
|
<h4>作者</h4>
|
||||||
<?php if ($this->paper['abstract']) : ?>
|
<ul>
|
||||||
<strong>摘要:</strong>
|
<?php foreach($this->author as $a) : ?>
|
||||||
<?php echo $this->paper['abstract']; endif; if ($this->tag) : ?>
|
<li><?php echo $a['lastname'];if (!empty($a['firstname'])) echo ', '.$a['firstname']; ?></li>
|
||||||
<strong>关键词:</strong>
|
<?php endforeach; ?>
|
||||||
<ul>
|
</ul>
|
||||||
<?php foreach($this->tag as $t) : ?>
|
<hr />
|
||||||
<li><a href="#"><?php echo $a['tag']; ?></a></li>
|
<?php } ?>
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
<?php if ($this->paper['abstract']){ ?>
|
||||||
<?php endif; ?>
|
<h4>摘要</h4>
|
||||||
<quote>
|
<p><?php echo $this->paper['abstract']; ?></p>
|
||||||
<?php echo $this->paper['reference']; ?>
|
<hr />
|
||||||
</quote>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if(count($this->tag) > 0) { ?>
|
||||||
|
<h4>关键词</h4>
|
||||||
|
<ul>
|
||||||
|
<?php foreach($this->tag as $t) : ?>
|
||||||
|
<li><?php echo $t['tag']; ?></li>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</ul>
|
||||||
|
<hr />
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if(!empty($this->paper['reference'])) { ?>
|
||||||
|
<h4>引用方式</h4>
|
||||||
|
<blockquote>
|
||||||
|
<?php echo $this->paper['reference']; ?>
|
||||||
|
</blockquote>
|
||||||
|
<hr />
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<?php if (empty($this->paper['link']))
|
<?php
|
||||||
{
|
if (empty($this->paper['link']))
|
||||||
if(!empty($this->paper[‘attid’]))
|
{
|
||||||
echo '<a href="/service/attach/id/'.$this->paper['attid'].'"><i class="icon-download text-success"></i>PDF下载</a>';
|
if(!empty($this->paper['attid']))
|
||||||
}else{
|
{
|
||||||
echo '<a href="'.$this->paper['link'].'"><i class="icon-download text-success"></i>PDF下载</a>';
|
echo '<a href="/service/attach/id/'.$this->paper['attid'].'"><i class="icon-download text-success"></i>PDF下载</a>';
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
if (!empty($item['link'])) :
|
echo '<a href="'.$this->paper['link'].'"><i class="icon-download text-success"></i>PDF下载</a>';
|
||||||
echo ' <a href="'.$item['link'].'">下载</a>';
|
}
|
||||||
endif;
|
|
||||||
?>
|
|
||||||
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $this->paper['id'];?>',0)">相关数据(共?条)</a>
|
if (!empty($item['link'])) :
|
||||||
|
echo ' <a href="'.$item['link'].'">下载</a>';
|
||||||
</div>
|
endif;
|
||||||
|
?>
|
||||||
|
<a class="btn btn-mini btn-info" href="javascript:;" onclick="showdata('<?php echo $this->paper['id'];?>',0)">相关数据(共<span id="referenceDataCount">?</span>条)</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div><!-- content -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" >
|
<script type="text/javascript" >
|
||||||
$('#Nav-knowledge-author').addClass('active');
|
$('#Nav-knowledge-author').addClass('active');
|
||||||
</script>
|
</script>
|
||||||
<script>
|
<script>
|
||||||
function showdata(id,page){
|
function showdata(id,page){
|
||||||
var url="/service/refdatalist/id/"+id;
|
var url="/service/refdatalist/id/"+id;
|
||||||
|
@ -69,4 +92,15 @@ function showdata(id,page){
|
||||||
'success':function(html){$.colorbox({'html':html,'innerHeight':230});}
|
'success':function(html){$.colorbox({'html':html,'innerHeight':230});}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
function displayDataCount()
|
||||||
|
{
|
||||||
|
$.ajax({
|
||||||
|
'type':"GET",
|
||||||
|
'url':"/service/refdatacount/id/<?php echo $this->paper['id'];?>",
|
||||||
|
'data':'',
|
||||||
|
'dataType':'html',
|
||||||
|
'success':function(html){$('#referenceDataCount').html(html)}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
displayDataCount();
|
||||||
</script>
|
</script>
|
Loading…
Reference in New Issue