实现hiwater功能

This commit is contained in:
wlx 2013-05-25 03:46:38 +00:00
parent 792da56172
commit 83bf8acbf4
10 changed files with 554 additions and 589 deletions

View File

@ -276,12 +276,13 @@ class HiwaterController extends DataController
function tagAction()
{
$key = $this->_request->getParam('key');
$keytype = $this->_request->getParam('keytype');
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
if (!empty($key)) {
$this->view->codename=$key;
$sql=$this->db->quoteInto('select count(id) from keyword where keyword=?',$key);
$sql=$this->db->quoteInto("select count(k.id) from keyword k left join normalmetadata m on k.id=m.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and k.keyword=?",$key);
$state=$this->db->query($sql);
$row=$state->fetchAll();
$sum=$row[0]['count'];
@ -289,17 +290,12 @@ class HiwaterController extends DataController
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
} else {
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join normalmetadata m on keyword.id=m.id where keyword.keytype='place' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by keyword.keyword order by count desc");
$k1=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='theme' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by k.keyword order by k.keyword");
$k2=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='discipline' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by k.keyword order by k.keyword");
$k3=$state->fetchAll();
$state=$this->db->query("select k.keyword,count(k.keyword) from keyword k left join normalmetadata m on k.id=m.id where k.keytype='stratum' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by k.keyword order by k.keyword");
$k4=$state->fetchAll();
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join normalmetadata m on keyword.id=m.id where keyword.keytype='temporal' and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by keyword.keyword order by keyword.keyword");
$k5=$state->fetchAll();
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
$sql="select k.keyword,count(*),k.keytype from keyword k left join normalmetadata m on k.id=m.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') ";
if (!empty($keytype) && ($keytype=='place' || $keytype=='theme' || $keytype=='discipline'||$keytype=='temporal')) $sql.=" and k.keytype='".$keytype."'";
$sql.=' group by k.keyword,k.keytype order by k.keytype,k.keyword,count desc';
$state=$this->db->query($sql);
$this->view->keytype=$keytype;
$this->view->keywords=$state->fetchAll();
}
}
@ -334,7 +330,7 @@ class HiwaterController extends DataController
function timelineAction()
{
$fn="heihetime.xml";
$fn="hiwatertime.xml";
$rows=$this->db->fetchAll("select ts_created from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') order by ts_created desc limit 1");
$last_update=strtotime($rows[0]['ts_created']);
if (!file_exists($fn) || (filemtime($fn)<$last_update))
@ -380,6 +376,12 @@ class HiwaterController extends DataController
}
}
function viewAction()
{
parent::viewAction();
$this->_helper->viewRenderer('hiwater/view');
}
private function getmd($keyword,$type='theme')
{
$page=(int)$this->_request->getParam('page');

View File

@ -3,7 +3,7 @@ $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">

View File

@ -4,7 +4,7 @@
$this->headTitle('全部浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">

View File

@ -6,7 +6,9 @@ $this->headLink()->appendStylesheet('/css/water.css');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb()->setSeparator(' > ');
$this->theme->AppendPlus($this,'colorbox');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>

View File

@ -6,17 +6,14 @@ $this->headTitle('快速搜索');
if (!empty($this->codename)) $this->headTitle($this->codename);
$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="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('快速搜索');
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class='row'>
<div class='span2'>
<div class='span3'>
<?= $this->partial('hiwater/navi.phtml',array('key'=>$this->key)); ?>
</div>
<div class='span10'>
<div class='span9'>
<div><?= $this->breadcrumb() ?> </div>
<?php if (!empty($this->metadata)) : ?>
<?php echo $this->page->getNavigation(); ?>

View File

@ -9,16 +9,17 @@ $this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('关键词导航'.(($this->codename)?''.$this->codename:''));
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div class="span9">
<?php if (!empty($this->metadata)) : ?>
<div id='mdlist'>
<h1>关键词:<?php echo $this->codename; ?><a href="/heihe/tag/">全部关键词</a></h1>
<h1>关键词:<?php echo $this->codename; ?><a href="/hiwater/tag/">全部关键词</a></h1>
<?php echo $this->page->getNavigation(); ?>
<hr />
<div class="md-list">
@ -33,22 +34,27 @@ $this->breadcrumb()->setSeparator(' > ');
</div>
<?php else : ?>
<div id='links'>
<div>
<?php
$keytypezh=array('place'=>'地点关键词','theme'=>'主题关键词','discipline'=>'学科关键词','stratum'=>'地层关键词','temporal'=>'时间关键词');
foreach($this->keywords as $type=>$kcg) :
if (is_array($kcg) && count($kcg)>0 ) :
?>
<fieldset><legend><?php echo $keytypezh[$type]; ?></legend>
<ul>
<?php foreach($kcg as $cg) : ?>
<li><a href='/heihe/tag/key/<?php echo urlencode($cg['keyword']); ?>'><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</fieldset>
<?php endif;endforeach; ?>
</div>
$type='';
foreach($this->keywords as $cg) :
if ($type!=$cg['keytype']) :
if ($type!='') : ?>
</ul>
<?php endif;
$type=$cg['keytype'];
?>
<h4><a href="/hiwater/tag/keytype/<?php echo $type; ?>"><?php echo $keytypezh[$type]; ?></a>
<?php if ($this->keytype) : ?><a class="pull-right" href="/hiwater/tag"><i class="icon-tags"></i>全部关键词</a> <?php endif; ?></h4>
<ul class="inline">
<li><a href='/hiwater/tag/key/<?php echo urlencode($cg['keyword']); ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php else : ?>
<li><a href='/hiwater/tag/key/<?php echo urlencode($cg['keyword']); ?>'><i class="icon-tag"></i><?php echo $cg['keyword']; ?></a><span class="note">(<?php echo $cg['count']; ?>)</span></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</fieldset></div>
<?php endif; ?>
</div>
</div>

View File

@ -4,7 +4,7 @@ $this->headTitle($this->config->title->data);
$this->headTitle('缩略图浏览');
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/water",'title'=>'黑河生态水文遥感试验');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
$this->theme->AppendPlus($this,'colorbox');
$this->theme->AppendPlus($this,'masonry');
?>

View File

@ -6,19 +6,66 @@ $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="/heihe/">'.$this->config->title->heihe.'</a>');
$this->breadcrumb('<a href="/hiwater/">'.$this->config->title->hiwater.'</a>');
$this->breadcrumb('时间轴导航');
$this->breadcrumb()->setSeparator(' > ');
$this->headScript()->appendFile('/js/timeline_var.js');
$this->headScript()->appendFile('/js/timeline_js/timeline-api.js');
$this->headScript()->appendFile('/js/heihetime.js');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div class="span9">
<div id="tl" class="timeline-default" style="height:600px;"> </div>
</div>
</div>
<script>
var tl;
var date = "May 22 2012 13:00:00";
var theme = Timeline.ClassicTheme.create();
theme.event.label.width = 250; // px
theme.event.bubble.width = 250;
theme.event.bubble.height = 200;
window.onload=function() {
var eventSource = new Timeline.DefaultEventSource();
var bandInfos = [
Timeline.createBandInfo({
width: "70%",
intervalUnit: Timeline.DateTime.MONTH,
eventSource: eventSource,
date: date,
intervalPixels: 100,
theme: theme
}),
Timeline.createBandInfo({
width: "30%",
intervalUnit: Timeline.DateTime.YEAR,
eventSource: eventSource,
date: date,
overview: true,
intervalPixels: 200,
theme: theme
})
];
bandInfos[1].syncWith = 0;
bandInfos[1].highlight = true;
tl = Timeline.create(document.getElementById("tl"), bandInfos);
tl.loadXML("/hiwatertime.xml", function(xml, url) {
eventSource.loadXML(xml, url);
});
}
var resizeTimerID = null;
window.onresize=function() {
if (resizeTimerID == null) {
resizeTimerID = window.setTimeout(function() {
resizeTimerID = null;
tl.layout();
}, 500);
}
}
</script>

View File

@ -15,16 +15,17 @@ $this->headScript()->appendFile('/js/timeline_var.js');
$this->headScript()->appendFile('/js/timeline_js/timeline-api.js');
$this->headScript()->appendFile('/js/timemap.2.0.1/lib/mxn/mxn.js?(googlev3)');
$this->headScript()->appendFile('/js/timemap.2.0.1/timemap.pack.js');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<style>
img{max-width:none}
</style>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span10">
<div><?= $this->breadcrumb() ?> </div>
<div class="span9">
<div id="timemap">
<div id="map" style="height:500px;width:40%;float:right;"></div>
<div id="timeline" style="height:500px;border-right:1px solid #abc;"></div>
@ -63,7 +64,7 @@ $(function() {
tm = TimeMap.init({
mapId: "map", // Id of map div element (required)
timelineId: "timeline", // Id of timeline div element (required)
scrollTo: "2000-01-01",
scrollTo: "2012-05-01",
options: {
eventIconPath: "../images/"
},

File diff suppressed because it is too large Load Diff