heihe view 中相关文献的调用修改为ajax分页方式
This commit is contained in:
parent
aaeb52e720
commit
c1c799b9a1
|
@ -593,17 +593,6 @@ class DataController extends Zend_Controller_Action
|
||||||
$sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10";
|
$sql="select distinct(md.uuid),md.title from keyword kw left join normalmetadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=? and k.keytype='theme') and kw.id<>? limit 10";
|
||||||
//$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=?) and kw.id<>? limit 10";
|
//$sql="select distinct(md.uuid),md.title from keyword kw left join metadata md on kw.id=md.id where kw.keyword in (select k.keyword from keyword k left join metadata m on k.id=m.id where m.id=?) and kw.id<>? limit 10";
|
||||||
$this->view->related=$this->db->fetchAll($sql,array($id,$id));
|
$this->view->related=$this->db->fetchAll($sql,array($id,$id));
|
||||||
//相关文献
|
|
||||||
$sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where (";
|
|
||||||
foreach($this->view->keys as $k)
|
|
||||||
{
|
|
||||||
if ($k->keytype=='theme')
|
|
||||||
{
|
|
||||||
$sql.=" a.title like '%".$k->keyword."%' or ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$sql.=" 1<>1) order by a.ts_created desc limit 10";
|
|
||||||
$this->view->literature=$this->db->fetchAll($sql);
|
|
||||||
//数据附件
|
//数据附件
|
||||||
$sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid);
|
$sql = $this->db->quoteInto("select m.id,a.realname from mdattach m left join attachments a on m.id=a.id where m.uuid=?",$uuid);
|
||||||
$this->view->attachments = $this->db->fetchAll($sql);
|
$this->view->attachments = $this->db->fetchAll($sql);
|
||||||
|
@ -619,13 +608,65 @@ class DataController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function literatureAction(){
|
||||||
|
$this->_helper->layout->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
|
$keyword=$this->_request->getParam("q");
|
||||||
|
|
||||||
|
$id = (int)$this->_request->getParam('id');
|
||||||
|
$sql="select m.id from normalmetadata m left join mdstatus s on m.uuid=s.uuid
|
||||||
|
left join thumbnail t on t.id=m.id left join geonetworkmetadata g on m.uuid=g.uuid where ";
|
||||||
|
if (empty($id)) {
|
||||||
|
$uuid = $this->_request->getParam('uuid');
|
||||||
|
if (empty($uuid)) exit("读取信息错误");
|
||||||
|
$where=$this->db->quoteInto('m.uuid = ?',$uuid);
|
||||||
|
} else {
|
||||||
|
$where=$this->db->quoteInto('m.id = ?',$id);
|
||||||
|
}
|
||||||
|
$sql.=$where;
|
||||||
|
$row=$this->db->fetchRow($sql);
|
||||||
|
if (!$row) exit("读取信息错误");
|
||||||
|
$id=$row['id'];
|
||||||
|
|
||||||
|
$keys=$this->db->fetchAll("select * from keyword where id=? order by keytype,ts_created",array($id));
|
||||||
|
|
||||||
|
$wheresql = array();
|
||||||
|
foreach ($keys as $k=>$v)
|
||||||
|
{
|
||||||
|
if($v['keytype']=="theme")
|
||||||
|
$wheresql[] = " a.title like '%".$v['keyword']."%' ";
|
||||||
|
}
|
||||||
|
$wheresql[] = " 1<>1 ";
|
||||||
|
$wheresql = join(" or ",$wheresql);
|
||||||
|
$sql="select a.*,array_to_string(array(select author from knl_author t where t.item_id=a.item_id order by place asc),'; ') as author from knl_article a where ($wheresql) order by a.ts_created desc";
|
||||||
|
$rows = $this->db->fetchAll($sql);
|
||||||
|
|
||||||
|
$paginator = Zend_Paginator::factory($rows);
|
||||||
|
$paginator->setCurrentPageNumber($this->_getParam('page'));
|
||||||
|
$paginator->setItemCountPerPage(5);
|
||||||
|
$paginator->setView($this->view);
|
||||||
|
Zend_View_Helper_PaginationControl::setDefaultViewPartial('data/pagination_ajax.phtml');
|
||||||
|
$this->config = Zend_Registry::get('config');
|
||||||
|
if ($paginator)
|
||||||
|
{
|
||||||
|
foreach($paginator as $c)
|
||||||
|
{
|
||||||
|
$u=parse_url($c['url']);
|
||||||
|
if (@$u['host']=='hdl.handle.net') $c['url'] = $this->config->seekspace->handleurl.$u['path'];
|
||||||
|
print '<li><a target="_blank" href="'.$c['url'].'">'.$c['title'].'</a>【'.$c['author'].' '.$c['publisher'].' '.$c['ts_issued']."】</li>";
|
||||||
|
}
|
||||||
|
echo '<div class="paginator">'.$paginator.'</div>';
|
||||||
|
}
|
||||||
|
}//相关文献
|
||||||
|
|
||||||
function replace($string){
|
function replace($string){
|
||||||
$patterns = array("/\"/i","/\'/i");
|
$patterns = array("/\"/i","/\'/i");
|
||||||
$replacements = array("“","‘");
|
$replacements = array("“","‘");
|
||||||
ksort($patterns);
|
ksort($patterns);
|
||||||
ksort($replacements);
|
ksort($replacements);
|
||||||
return preg_replace($patterns, $replacements, $string);
|
return preg_replace($patterns, $replacements, $string);
|
||||||
}
|
}//引号替换
|
||||||
|
|
||||||
|
|
||||||
function postcommentAction(){
|
function postcommentAction(){
|
||||||
$this->_helper->layout->disableLayout();
|
$this->_helper->layout->disableLayout();
|
||||||
|
@ -708,7 +749,9 @@ class DataController extends Zend_Controller_Action
|
||||||
echo "出错了,请稍后再试";
|
echo "出错了,请稍后再试";
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
}
|
}//ajax评论
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 数据评论,根据UUID读取
|
* 数据评论,根据UUID读取
|
||||||
*/
|
*/
|
||||||
|
@ -739,7 +782,7 @@ class DataController extends Zend_Controller_Action
|
||||||
}
|
}
|
||||||
echo '<div class="paginator">'.$paginator.'</div>';
|
echo '<div class="paginator">'.$paginator.'</div>';
|
||||||
}//else echo "<li>No comments.</li>";
|
}//else echo "<li>No comments.</li>";
|
||||||
}
|
}//评论列表
|
||||||
|
|
||||||
function creatform($datas) {
|
function creatform($datas) {
|
||||||
return '
|
return '
|
||||||
|
@ -768,6 +811,7 @@ class DataController extends Zend_Controller_Action
|
||||||
<input type="hidden" name="submited" value="1" />
|
<input type="hidden" name="submited" value="1" />
|
||||||
</form>';
|
</form>';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 判断用户是否填写了申请信息
|
* 判断用户是否填写了申请信息
|
||||||
* @param string $uuid
|
* @param string $uuid
|
||||||
|
|
|
@ -254,25 +254,8 @@ endforeach;
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<?php if ($this->literature) : ?>
|
|
||||||
<div id="literature">
|
<div id="literature">
|
||||||
<ul>
|
|
||||||
<?php foreach ($this->literature as $r) :
|
|
||||||
$u=parse_url($r->url);
|
|
||||||
if (@$u['host']=='hdl.handle.net')
|
|
||||||
$url=$this->config->seekspace->handleurl.$u['path'];
|
|
||||||
else
|
|
||||||
$url=$r->url;
|
|
||||||
echo '<li>';
|
|
||||||
if ($url) echo '<a href="'.$url.'" target="_blank">';
|
|
||||||
echo $r->title;
|
|
||||||
if ($url) echo '</a>';
|
|
||||||
echo '【'.$r->author.'. '.$r->publisher.' '.$r->ts_issued.'】</li>';
|
|
||||||
?>
|
|
||||||
<?php endforeach; ?>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
|
||||||
<div id="gsearch">
|
<div id="gsearch">
|
||||||
<ul id="searchctrl">
|
<ul id="searchctrl">
|
||||||
<li><a href="javascript:;" class="googlesearch">Google搜索</a></li>
|
<li><a href="javascript:;" class="googlesearch">Google搜索</a></li>
|
||||||
|
@ -354,10 +337,22 @@ function ajaxpage(page){
|
||||||
url:url,
|
url:url,
|
||||||
data:data,
|
data:data,
|
||||||
success:function(html){$('#allcomments').html(html);},
|
success:function(html){$('#allcomments').html(html);},
|
||||||
beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />评论加载中');}
|
beforeSend:function(){$('#allcomments').html('<img src="/images/loading.gif" />加载中');}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
ajaxpage(0);
|
ajaxpage(0);
|
||||||
|
//ajax literature
|
||||||
|
function literature(page){
|
||||||
|
$.ajax({
|
||||||
|
type:"GET",
|
||||||
|
url:"/data/literature/uuid/<?= $md->uuid; ?>",
|
||||||
|
data:'page='+page,
|
||||||
|
success:function(html){$('#literature').html('<ul>'+html+'</ul>');$('#literature .paginationControl a').attr('onclick',$('#literature .paginationControl a').attr('onclick').replace(/ajaxpage/i,"literature"));},
|
||||||
|
beforeSend:function(){$('#literature').html('<img src="/images/loading.gif" />加载中');}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
literature(0);
|
||||||
|
|
||||||
function getFileList(){
|
function getFileList(){
|
||||||
var tw = ($(window).width() - $('#window-outter').width())/2;
|
var tw = ($(window).width() - $('#window-outter').width())/2;
|
||||||
$('#window-outter').css({'right':tw});
|
$('#window-outter').css({'right':tw});
|
||||||
|
|
Loading…
Reference in New Issue