添加了快速搜索自动分词功能;分页中增加说明文字;添加water中径流观测页面
This commit is contained in:
parent
52d04eba59
commit
2fe5725b9a
|
@ -1,6 +1,7 @@
|
|||
<?php
|
||||
class DataController extends Zend_Controller_Action
|
||||
{
|
||||
private $limit=10;
|
||||
function __call($id, $arguments)
|
||||
{
|
||||
Zend_Debug::dump($arguments,'argu');
|
||||
|
@ -477,23 +478,17 @@ class DataController extends Zend_Controller_Action
|
|||
//$formData=$this->_request->getPost();
|
||||
//include_once("bcspamblock.php");
|
||||
//if ($form->isValid($formData)) {
|
||||
$page=@(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $page=1;
|
||||
$limit=10;
|
||||
$offset=$limit*($page-1);
|
||||
if (!empty($key)) {
|
||||
$md=new MetadataTable();
|
||||
$db=$md->getAdapter();
|
||||
$sql=$db->quoteInto('select count(*) from metadata where title ilike ? or description ilike ?','%'.$key.'%');
|
||||
$state=$db->query($sql);
|
||||
$row=$state->fetchAll();
|
||||
$sum=$row[0]['count'];
|
||||
$select=$db->select();
|
||||
$select->from('metadata','*')->where('title ilike ? or description ilike ?','%'.$key.'%')->order('title')->limit($limit,$offset);
|
||||
$this->view->metadata = $db->fetchAll($select);
|
||||
$this->view->page=new Pagination($sum,$page);
|
||||
$this->view->key=$key;
|
||||
}
|
||||
$page=@(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $page=1;
|
||||
$offset=$this->limit*($page-1);
|
||||
$search=new Search($key);
|
||||
$where=$search->sql_expr(array("title","description"));
|
||||
$row=$this->db->fetchAll("select count(*) from metadata where ".$where);
|
||||
$sum=$row[0]['count'];
|
||||
$sql="select uuid,title,id,description from metadata where ".$where." order by title limit ? offset ?";
|
||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||
$this->view->key=$key;
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
|
|
@ -107,6 +107,10 @@ class WaterController extends DataController
|
|||
{
|
||||
$this->getmd('降水','theme');
|
||||
}
|
||||
function runoffAction()
|
||||
{
|
||||
$this->getmd('径流','theme');
|
||||
}
|
||||
function hydroAction()
|
||||
{
|
||||
$this->getmd('水文','theme');
|
||||
|
@ -142,6 +146,28 @@ class WaterController extends DataController
|
|||
}
|
||||
}
|
||||
|
||||
function searchAction()
|
||||
{
|
||||
$this->view->addHelperPath('helper','Zend_View_Helper_');
|
||||
$form=new SearchForm();
|
||||
$this->view->form=$form;
|
||||
//$form->submit->setLabel('快速搜索');
|
||||
$key=$this->_request->getParam('q');
|
||||
if (!empty($key)) {
|
||||
$search=new Search($key);
|
||||
$where=$search->sql_expr(array("title","description"));
|
||||
$page=@(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $page=1;
|
||||
$offset=$this->limit*($page-1);
|
||||
$row=$this->db->fetchAll("select count(*) from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and ".$where);
|
||||
$sum=$row[0]['count'];
|
||||
$sql="select uuid,title,id,description from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and ".$where." order by timebegin limit ? offset ?";
|
||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||
$this->view->key=$key;
|
||||
}
|
||||
}
|
||||
|
||||
function timelineAction()
|
||||
{
|
||||
$fn="watertime.xml";
|
||||
|
|
|
@ -67,19 +67,35 @@ Wang WZ, Ran YH, Xin XZ, Ren HZ. Watershed Allied Telemetry Experimental
|
|||
Research. Journal of Geophysical Research, 2009, 114(D22103),
|
||||
doi:10.1029/2008JD011590. <a href="/images/water/water_02.pdf">下载</a>
|
||||
</p>
|
||||
<p>马明国, 刘强, 阎广建, 陈尔学, 肖青, 苏培玺, 胡泽勇, 李新, 牛铮,王维真, 钱金
|
||||
波, 宋怡, 丁松爽, 辛晓洲, 任华忠, 黄春林, 晋锐, 车涛, 楚荣忠.黑河流域遥感-
|
||||
地面观测同步试验:森林水文和中游干旱区水文试验.地球科学进展,2009,24(7):681-695. <a href="/images/water/water_01.pdf">下载</a>
|
||||
<p>马明国,刘强,阎广建,陈尔学,肖青,苏培玺,胡泽勇,李新,牛铮,王维真,钱金波,宋怡,丁松爽,辛晓洲,任华忠,黄春林,晋锐,车涛,楚荣忠。
|
||||
黑河流域遥感-地面观测同步试验:森林水文和中游干旱区水文试验。地球科学进展,2009,24(7):681-695. <a href="/images/water/water_01.pdf">下载</a>
|
||||
</p>
|
||||
<p>王建,车涛,张立新,晋锐,王维真,李新,梁继,郝小华,李弘毅,吴月茹.黑河流域上游寒区
|
||||
水文遥感-地面同步观测试验介绍.冰川冻土, 2009, 31(2): 189-197. <a href="/images/water/water_03.pdf">下载</a>
|
||||
<p>王建,车涛,张立新,晋锐,王维真,李新,梁继,郝小华,李弘毅,吴月茹。
|
||||
黑河流域上游寒区水文遥感-地面同步观测试验介绍。冰川冻土,2009, 31(2): 189-197. <a href="/images/water/water_03.pdf">下载</a>
|
||||
</p>
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<h3>试验数据的关键词列表</h3>
|
||||
|
||||
<div id='links'>
|
||||
<script>
|
||||
function show(s){
|
||||
var showid=document.getElementById(s);
|
||||
if(showid.style.display=="")
|
||||
showid.style.display="block";
|
||||
else if(showid.style.display=="none")
|
||||
showid.style.display="block";
|
||||
else
|
||||
showid.style.display="none";
|
||||
}
|
||||
</script>
|
||||
<form id="search" enctype="application/x-www-form-urlencoded" action="/water/search" method="post"><ul>
|
||||
<li class="element-group">
|
||||
<input type="text" name="q" id="q" value=""></li>
|
||||
<li class="submit-group">
|
||||
<input type="submit" name="submit" id="submit" value="搜索"></li>
|
||||
<li><button onclick="show('keyword');return false;">试验数据的关键词列表</button></li>
|
||||
<li><button onclick="location.href='/water/timeline'">试验数据的时间轴导航</button></li>
|
||||
</ul></form>
|
||||
<div id='keyword'>
|
||||
<?php
|
||||
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<li><a href="/water/normalmeteo">业务气象站观测</a></li>
|
||||
<li><a href="/water/regionalmeteo">区域气象站观测</a></li>
|
||||
<li><a href="/water/doppler">降水观测</a></li>
|
||||
<li><a href="/water/runoff">径流观测</a></li>
|
||||
<li><a href="/water/hydro">业务水文站观测</a></li>
|
||||
<li><a href="/water/airsounding">探空观测</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
$this->headTitle($this->config->title->site);
|
||||
$this->headTitle($this->config->title->data);
|
||||
$this->headTitle()->setSeparator(' - ');
|
||||
$this->headLink()->appendStylesheet('/css/water.css');
|
||||
$this->breadcrumb('<a href="/">首页</a>');
|
||||
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
|
||||
$this->breadcrumb('<a href="/water/">黑河综合遥感联合试验</a>');
|
||||
$this->breadcrumb('径流观测');
|
||||
$this->breadcrumb()->setSeparator(' > ');
|
||||
?>
|
||||
|
||||
<div id='sidebar'>
|
||||
<div id='leftnavi'>
|
||||
<?= $this->partial('water/navi.phtml'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div id='right'>
|
||||
<div id="intro">
|
||||
|
||||
</div>
|
||||
<hr />
|
||||
<?php if ($this->metadata) : ?>
|
||||
<?php echo $this->page->getNavigation(); ?>
|
||||
<div id="mdlist">
|
||||
<ol>
|
||||
<?php foreach($this->metadata as $md) : ?>
|
||||
<li><a href="/water/<?php echo $md['uuid']; ?>"><?php echo $md['title']; ?></a></li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
|
@ -102,7 +102,7 @@ else
|
|||
<h2>联系人</h2>
|
||||
<ul>
|
||||
<?php
|
||||
$party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'分发者','originator'=>'创建者','pointOfContact'=>'联系人','principalInvestigator'=>'调查者','processor'=>'处理者','publisher'=>'元数据发布者','author'=>'元数据作者');
|
||||
$party_zh=array('resourceProvider'=>'资源提供者','custodian'=>'维护者','owner'=>'拥有者','user'=>'用户','distributor'=>'数据服务联系人','originator'=>'创建者','pointOfContact'=>'联系人','principalInvestigator'=>'调查者','processor'=>'处理者','publisher'=>'元数据发布者','author'=>'元数据作者');
|
||||
$r='';
|
||||
$i=0;
|
||||
foreach($this->authors as $k=>$author) :
|
||||
|
|
|
@ -56,7 +56,7 @@ class Pagination
|
|||
{
|
||||
if ($this->_itemCount<$this->_pageSize) return '';
|
||||
$navigation = '<div class="PageNavigation">';
|
||||
$navigation .= "共<em>$this->_itemCount</em>条 \n";
|
||||
$navigation .= "共有元数据<em>$this->_itemCount</em>条 \n";
|
||||
|
||||
$pageCote = ceil($this->_currentPage / ($this->_navigationItemCount - 1)) - 1; //当前页处于第几栏分页
|
||||
$pageCoteCount = ceil($this->_pageCount / ($this->_navigationItemCount - 1)); //总分页栏
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<?php
|
||||
class Search
|
||||
{
|
||||
var $terms;
|
||||
var $text;
|
||||
|
||||
function Search($text)
|
||||
{
|
||||
$this->terms = array();
|
||||
$this->text=$text;
|
||||
}
|
||||
|
||||
private function safe_query($search)
|
||||
{
|
||||
return preg_replace('/%|_|\'|\\\\/', '\\\\$0', stripslashes($search));
|
||||
}
|
||||
|
||||
function parse_search($search="", $safe = true)
|
||||
{
|
||||
if (empty($search)) $search=$this->text;
|
||||
$temp = array();
|
||||
preg_match_all('/"([^"]+)"|([^\\s]+)/', (( $safe ) ? $this->safe_query($search) : $search), $temp);
|
||||
|
||||
for ($i = 1; $i < count($temp); $i++)
|
||||
{
|
||||
foreach ( $temp[$i] as $value )
|
||||
{
|
||||
if ( strlen($value) >= 3 )
|
||||
{
|
||||
$this->terms[] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function sql_expr($field)
|
||||
{
|
||||
$sql=" 1=1 ";
|
||||
if (!is_array($field))
|
||||
{
|
||||
$field=array($field);
|
||||
}
|
||||
if (!count($this->terms))
|
||||
$this->parse_search();
|
||||
foreach($this->terms as $t)
|
||||
{
|
||||
$sql.=" and (1<>1 ";
|
||||
foreach($field as $f)
|
||||
{
|
||||
$sql.=" or ".$f." ilike '%".$t."%' ";
|
||||
}
|
||||
$sql.=") ";
|
||||
}
|
||||
return $sql;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue