#558 增加了从表中读取信息的功能
This commit is contained in:
parent
475f67534a
commit
c1f5c7de56
|
@ -1,17 +1,17 @@
|
|||
<?php
|
||||
class KnowledgeController extends Zend_Controller_Action
|
||||
{
|
||||
function indexAction()
|
||||
{
|
||||
}
|
||||
function preDispatch()
|
||||
{
|
||||
$this->db=Zend_Registry::get('db');
|
||||
$this->view->config = Zend_Registry::get('config');
|
||||
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
||||
$this->view->messages = $this->messenger->getMessages();
|
||||
$this->view->theme=new Theme();
|
||||
}
|
||||
<?php
|
||||
class KnowledgeController extends Zend_Controller_Action
|
||||
{
|
||||
function indexAction()
|
||||
{
|
||||
}
|
||||
function preDispatch()
|
||||
{
|
||||
$this->db=Zend_Registry::get('db');
|
||||
$this->view->config = Zend_Registry::get('config');
|
||||
$this->messenger=$this->_helper->getHelper('FlashMessenger');
|
||||
$this->view->messages = $this->messenger->getMessages();
|
||||
$this->view->theme=new Theme();
|
||||
}
|
||||
function datacenterAction()
|
||||
{
|
||||
$siteid="e31f5ea7-a4af-4ae3-9ac1-1a84132c4338";//site uuid from geonetowrk
|
||||
|
@ -24,8 +24,8 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
$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";
|
||||
|
@ -37,8 +37,8 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
$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";
|
||||
|
@ -50,12 +50,12 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
$paginator->setItemCountPerPage(10);
|
||||
$paginator->setView($this->view);
|
||||
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
|
||||
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";
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
|
||||
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";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
|
@ -64,11 +64,11 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
$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');
|
||||
$this->view->paginator=$paginator;
|
||||
}
|
||||
function searchAction()
|
||||
{
|
||||
$key=$this->_request->getParam('q');
|
||||
$source=$this->_request->getParam('searchsource');
|
||||
if(preg_match("/\"|'|<|>/",$key))
|
||||
{
|
||||
|
@ -89,7 +89,7 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
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";
|
||||
$sql="select * from reference where ".$where." order by id desc";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$rows = $sth->fetchAll();
|
||||
|
@ -98,14 +98,14 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
$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->view->paginator=$paginator;
|
||||
$this->view->key=$key;
|
||||
$this->view->source=$source;
|
||||
$this->_helper->viewRenderer('search-data');
|
||||
}
|
||||
else if (!empty($key) && $source=='westsource') {
|
||||
}
|
||||
else if (!empty($key) && $source=='westsource') {
|
||||
$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";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
|
@ -115,28 +115,28 @@ class KnowledgeController extends Zend_Controller_Action
|
|||
$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');
|
||||
}
|
||||
}
|
||||
function paperAction()
|
||||
{
|
||||
$id = (int)$this->_request->getParam('id');
|
||||
$sql="select * from reference where id=$id";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->paper = $sth->fetch();
|
||||
|
||||
$sql="select * from ref_author where id=$id order by place";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->author = $sth->fetchAll();
|
||||
|
||||
$sql="select * from ref_tag where id=$id";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->tag = $sth->fetchAll();
|
||||
}
|
||||
$this->view->paginator=$paginator;
|
||||
$this->view->key=$key;
|
||||
$this->view->source=$source;
|
||||
//$this->_helper->viewRenderer('search-data');
|
||||
}
|
||||
}
|
||||
function paperAction()
|
||||
{
|
||||
$id = (int)$this->_request->getParam('id');
|
||||
$sql="select * from reference where id=$id";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->paper = $sth->fetch();
|
||||
|
||||
$sql="select * from ref_author where id=$id order by place";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->author = $sth->fetchAll();
|
||||
|
||||
$sql="select * from ref_tag where id=$id";
|
||||
$sth = $this->db->prepare($sql);
|
||||
$sth->execute();
|
||||
$this->view->tag = $sth->fetchAll();
|
||||
}
|
||||
}
|
|
@ -1453,6 +1453,24 @@ class ServiceController extends Zend_Controller_Action
|
|||
echo '</ul>';
|
||||
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(){
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ $this->headLink()->appendStylesheet('/css/mdreview.css');
|
|||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/knowledge">知识积累</a>');
|
||||
$this->breadcrumb('文章查看');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
$this->headScript()->appendFile('/js/jquery.colorbox-min.js');
|
||||
$this->headLink()->appendStylesheet('/css/colorbox.css');
|
||||
?>
|
||||
|
@ -16,48 +16,71 @@ $this->headLink()->appendStylesheet('/css/colorbox.css');
|
|||
</div>
|
||||
<div class="span9">
|
||||
<div id="content">
|
||||
<h3><?php echo $this->paper['title']; ?></h3>
|
||||
<ul>
|
||||
<?php foreach($this->author as $a) : ?>
|
||||
<li><a href="#"><?php echo $a['lastname'];if (!empty($a['firstname'])) echo ', '.$a['firstname']; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php if ($this->paper['abstract']) : ?>
|
||||
<strong>摘要:</strong>
|
||||
<?php echo $this->paper['abstract']; endif; if ($this->tag) : ?>
|
||||
<strong>关键词:</strong>
|
||||
<ul>
|
||||
<?php foreach($this->tag as $t) : ?>
|
||||
<li><a href="#"><?php echo $a['tag']; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<quote>
|
||||
<?php echo $this->paper['reference']; ?>
|
||||
</quote>
|
||||
<?php if(!empty($this->paper['title'])){ ?>
|
||||
<h3><?php echo $this->paper['title']; ?></h3>
|
||||
<hr />
|
||||
<?php } ?>
|
||||
<?php if(count($this->author) > 0) {?>
|
||||
<h4>作者</h4>
|
||||
<ul>
|
||||
<?php foreach($this->author as $a) : ?>
|
||||
<li><?php echo $a['lastname'];if (!empty($a['firstname'])) echo ', '.$a['firstname']; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<hr />
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($this->paper['abstract']){ ?>
|
||||
<h4>摘要</h4>
|
||||
<p><?php echo $this->paper['abstract']; ?></p>
|
||||
<hr />
|
||||
<?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>
|
||||
<?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>';
|
||||
}else{
|
||||
echo '<a href="'.$this->paper['link'].'"><i class="icon-download text-success"></i>PDF下载</a>';
|
||||
}
|
||||
|
||||
if (!empty($item['link'])) :
|
||||
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>
|
||||
|
||||
</div>
|
||||
<div>
|
||||
<?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>';
|
||||
}
|
||||
}else{
|
||||
echo '<a href="'.$this->paper['link'].'"><i class="icon-download text-success"></i>PDF下载</a>';
|
||||
}
|
||||
|
||||
|
||||
if (!empty($item['link'])) :
|
||||
echo ' <a href="'.$item['link'].'">下载</a>';
|
||||
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><!-- content -->
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript" >
|
||||
$('#Nav-knowledge-author').addClass('active');
|
||||
</script>
|
||||
</div>
|
||||
<script type="text/javascript" >
|
||||
$('#Nav-knowledge-author').addClass('active');
|
||||
</script>
|
||||
<script>
|
||||
function showdata(id,page){
|
||||
var url="/service/refdatalist/id/"+id;
|
||||
|
@ -69,4 +92,15 @@ function showdata(id,page){
|
|||
'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>
|
Loading…
Reference in New Issue