完善hiwater功能

This commit is contained in:
wlx 2013-05-26 11:23:36 +00:00
parent bfefa18b90
commit 3af3b545ee
9 changed files with 353 additions and 54 deletions

View File

@ -29,6 +29,10 @@ class HiwaterController extends DataController
{
$this->view->pageIn = "collapse5";
}
else if(in_array($acName,array("fund","tag","timeline","timemap",'author','organization')))
{
$this->view->pageIn = "collapse10";
}
else if(in_array($acName,array("other")))
{
$this->view->pageIn = "collapse6";
@ -410,32 +414,130 @@ class HiwaterController extends DataController
$this->view->offset=$offset+1;
}
//从pgsql读取数组并拆分为php数组
function getArray($str){
if(strlen($str)>3)
//基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者)
function authorAction()
{
return explode(",",substr($str,1,-1));
}else{
return NULL;
$ac = $this->_request->getParam('ac');
$id = (int)$this->_request->getParam('id');
if ($ac=='verified') {
//已经认证过的数据作者
$this->view->tabID='author-verified';
$this->view->ac='verified';
if ($id) {
//列出作者的数据
$sql="select username,realname from users where id=?";
$this->view->author=$this->db->fetchRow($sql,array($id));
$sql="select m.* from normalmetadata m left join mdauthor a on a.uuid=m.uuid where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and a.userid=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
} else {
//已经认证过的数据作者
$sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(50);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
} else if ($ac=='unverified' || empty($ac)) {
//未认证的数据作者
$this->view->tabID='author-unverified';
$this->view->ac='unverified';
if ($id) {
//列出数据
$sql="select individual as username from responsible where id=?";
$this->view->author=$this->db->fetchRow($sql,array($id));
$sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.id where r.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and r.role in ('pointOfContact','resourceProvider','owner') and s.id=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
} else {
//列出所有作者
$sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and role.role in ('pointOfContact','resourceProvider','owner')";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(50);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
}
}
//将php数组组装成pgsql中的数组
function mkArray($array){
if(!is_array($array))
function fundAction()
{
return "{".$array."}";
$id = (int)$this->_request->getParam('id');
if (!empty($id)) {
$sql="select * from fund where id=?";
$this->view->fund=$this->db->fetchRow($sql,array($id));
if ($this->view->fund) {
$sql="select distinct m.* from normalmetadata m left join mdfund mf on m.uuid=mf.uuid where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and mf.fid=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($id));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}
if(count($array)==1)
{
$key = max(array_keys($array));
return "{".$array[$key]."}";
}
if(count($array)>1)
{
return "{".join(",",$array)."}";
} else {
//提供全部分类列表
$sql="select f.id,f.title,f.fund_id,f.fund_type,f.ts_created,count(m.id) as datacount,sum(md.filesize) as filesize from fund f left join mdfund m on f.id=m.fid left join metadata md on m.uuid=md.uuid where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by f.ts_created desc";
$sth = $this->db->prepare($sql);
$sth->execute();
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
$this->_helper->viewRenderer('fund-list');
}
}
function organizationAction()
{
$page = $this->_request->getParam('page');
$name = $this->_request->getParam('name');
$state=$this->db->query("select distinct responsible.organisation from responsible left join role on role.resid=responsible.id where role.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and role.role in ('pointOfContact','resourceProvider','owner')");
$this->view->organisation=$state->fetchAll();
if (!empty($name)) {
$this->view->codename=$name;
$sql="select distinct m.* from normalmetadata m left join role r on m.uuid=r.uuid left join responsible s on r.resid=s.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 r.role in ('pointOfContact','resourceProvider','owner') and s.organisation=?";
$sth = $this->db->prepare($sql);
$sth->execute(array($name));
$rows = $sth->fetchAll();
$paginator = Zend_Paginator::factory($rows);
$paginator->setCurrentPageNumber($this->_getParam('page'));
$paginator->setItemCountPerPage(10);
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
} else {
//提供全部分类列表
}
}
}

View File

@ -0,0 +1,71 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('数据作者浏览');
$this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
$this->theme->AppendPlus($this,'colorbox');
$this->headLink()->appendStylesheet('/css/water.css');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class='row'>
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span9">
<ul class="nav nav-tabs">
<li id="Nav-author-unverified"><a href="/hiwater/author">未认证的数据作者<?php if ($this->author && $this->ac=='unverified') echo ''.$this->author['username']; ?></a></li>
<li id="Nav-author-verified"><a href="/hiwater/author/ac/verified">已认证的数据作者<?php if ($this->author && $this->ac=='verified') echo ''.$this->author['username'].'['.$this->author['realname'].']'; ?></a></li>
</ul>
<?php if ($this->author) : ?>
<?php if (!empty($this->paginator)) : ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php foreach($this->paginator as $md) : ?>
<div class="media well well-small">
<a class="pull-left colorbox" href="/service/bigthumb/uuid/<?php echo $md['uuid']; ?>">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/hiwater/view/uuid/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<?php if (@$md['datadoi']) : ?>
<h4 class="media-heading">DOI:<?php echo $md['datadoi'];?>
<?php if (@$md['ts_submitted']) : ?> <span class="label label-info">申请日期:<?php echo $md['ts_submitted'];?></span>
<?php else: if (@$md['ts_created']) : ?> <span class="label label-info">创建日期:<?php echo $md['ts_created'];?></span> <?php endif; ?>
<?php endif; ?>
<?php if (@$md['ts_published']) : ?> <span class="label label-success">发布日期:<?php echo $md['ts_published'];?></span><?php endif; ?>
</h4>
<?php else: if (@$md['doi']): ?>
<h4 class="media-heading">DOI:<?php echo $md['doi']; ?></h4>
<?php endif; ?>
<?php endif; ?>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php endif; ?>
<?php else : ?>
<?php if (!empty($this->paginator)) : ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<ul class="row">
<?php foreach($this->paginator as $author) : ?>
<li class="span3"><a href="/hiwater/author/ac/<?php echo $this->ac; ?>/id/<?php echo $author['id']; ?>">
<?php
echo $author['username'];
if ($this->ac=='verified') echo '['.$author['realname'].', 共'.$author['count'].'条]';
?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
<?php endif; ?>
</div>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$(".colorbox").colorbox({photo:"true"});
});
$('#Nav-<?php echo $this->tabID; ?>').addClass("active");
</script>

View File

@ -0,0 +1,26 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('支持项目');
$this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class='row'>
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span9">
<?php if (!empty($this->paginator)) : ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php foreach($this->paginator as $md) : ?>
<div class="well">
<h4><a href="/hiwater/fund/id/<?php echo $md['id'];?>"><?php echo $this->escape($md['title']);?></a></h4>
编号:<?php echo $md['fund_id']; ?> | 类型:<?php echo $md['fund_type']; ?> | 提供数据集:<?php echo $md['datacount']; ?>条,<?php echo $md['filesize']>5000?(round($md['filesize']/1024,2)).'GB':$md['filesize'].'MB'; ?></div>
<?php endforeach; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php else : ?>
暂无对应信息。
<?php endif; ?>
</div>
</div>

View File

@ -0,0 +1,43 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('支持项目');
$this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
$this->theme->AppendPlus($this,'colorbox');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class='row'>
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span9">
<div class="well">
<h4><a href="/hiwater/fund/id/<?php echo $this->fund['id'];?>"><?php echo $this->escape($this->fund['title']);?></a></h4>
编号:<?php echo $this->fund['fund_id']; ?> | 类型:<?php echo $this->fund['fund_type']; ?>
</div>
<?php if (!empty($this->paginator)) : ?>
<hr />
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php foreach($this->paginator as $md) : ?>
<div class="media well well-small">
<a class="pull-left colorbox" href="/service/bigthumb/uuid/<?php echo $md['uuid']; ?>">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/hiwater/view/uuid/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php else : ?>
暂无对应信息。
<?php endif; ?>
</div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$(".colorbox").colorbox({photo:"true"});
});
</script>

View File

@ -113,6 +113,7 @@
</div>
</div>
</div>
<!--
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-water-cold">
<a class="accordion-toggle" href="/hiwater/satellite">
@ -129,6 +130,7 @@
</ul>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-water-document">
<a href="/hiwater/document" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
@ -172,11 +174,10 @@
<li id="Nav-water-asd"><i class="icon-double-angle-right"></i><a href="/hiwater/asd">植被类型分布</a></li>
<li id="Nav-water-asd"><i class="icon-double-angle-right"></i><a href="/hiwater/asd">植被覆盖度</a></li>
<li id="Nav-water-asd"><i class="icon-double-angle-right"></i><a href="/hiwater/asd">物候期</a></li>
<li id="Nav-water-asd"><i class="icon-double-angle-right"></i><a href="/hiwater/asd">NPP</a></li>
<li id="Nav-water-asd"><i class="icon-double-angle-right"></i><a href="/hiwater/asd">NPP</a></li>
<li id="Nav-water-npp"><i class="icon-double-angle-right"></i><a href="/hiwater/npp">NPP</a></li>
</ul>
</div>
</div>
</div> -->
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-satellite">
<a class="accordion-toggle" href="/hiwater/satellite">
@ -191,6 +192,25 @@
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-funtion">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse10">
其他导航方式
</a>
</div>
<div id="collapse10" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="nav nav-list heihe-subnav">
<li id="Nav-hiwater-tag"><a href="/hiwater/tag"><i class="icon-double-angle-right"></i>关键词浏览</a></li>
<li id="Nav-hiwater-timeline"><a href="/hiwater/timeline"><i class="icon-double-angle-right"></i>时间轴浏览</a></li>
<li id="Nav-hiwater-timemap"><a href="/hiwater/timemap"><i class="icon-double-angle-right"></i>时空浏览</a></li>
<li id="Nav-hiwater-fund"><a href="/hiwater/fund"><i class="icon-double-angle-right"></i>项目浏览</a></li>
<li id="Nav-hiwater-author"><a href="/hiwater/author"><i class="icon-double-angle-right"></i>作者浏览</a></li>
<li id="Nav-hiwater-organization"><a href="/hiwater/organization"><i class="icon-double-angle-right"></i>单位浏览</a></li>
</ul>
</div>
</div>
</div>
</div>
<form id="search" enctype="application/x-www-form-urlencoded" action="/hiwater/search" method="post">

View File

@ -0,0 +1,50 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('分单位浏览');
if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
$this->theme->AppendPlus($this,'colorbox');
?>
<?= $this->render('breadcrumbs.phtml') ?>
<div class="row">
<div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div>
<div class="span9">
<?php if (!empty($this->paginator)) : ?>
<h3>当前浏览:<?php echo $this->codename; ?></h3>
<div class="pagenavi"><?= $this->paginator; ?></div>
<ul id="datalist">
<?php foreach($this->paginator as $md) : ?>
<div class="media well well-small">
<a class="pull-left colorbox" href="/service/bigthumb/uuid/<?php echo $md['uuid']; ?>">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>" data-src="holder.js/128x128">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/hiwater/view/uuid/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<div class="summary"><?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']));?></div>
</div>
</div>
<?php endforeach; ?>
</ul>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php else : ?>
<div class="row-fluid">
<ul class="nav nav-pills">
<?php foreach($this->organisation as $cg) : ?>
<li><a href='/hiwater/organization/name/<?php echo $cg['organisation']; ?>'><?php print($cg['organisation']); ?></a></li>
<?php endforeach; ?>
</ul></div>
<?php endif; ?>
</div></div>
<script type="text/javascript" charset="utf-8">
$(document).ready(function(){
$(".colorbox").colorbox({rel:"colorbox",photo:"true",transition:"fade"});
$(".colorbox").colorbox({photo:"true"});
});
</script>

View File

@ -4,11 +4,6 @@ $this->headTitle($this->config->title->data);
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->codename)?''.$this->codename:''));
$this->breadcrumb()->setSeparator(' > ');
$this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
@ -25,7 +20,7 @@ $this->nav[] = array('link'=>"/hiwater",'title'=>'黑河生态水文遥感试验
<div class="md-list">
<ol start="<?php echo $this->offset; ?>">
<?php foreach($this->metadata as $md) : ?>
<li><a href="/heihe/view/uuid/<?php echo $md['uuid']; ?>" title="<?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?>"><?php echo $md['title']; ?></a></li>
<li><a href="/hiwater/view/uuid/<?php echo $md['uuid']; ?>" title="<?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?>"><?php echo $md['title']; ?></a></li>
<?php endforeach; ?>
</ol>
</div>

View File

@ -4,11 +4,6 @@ $this->headTitle($this->config->title->data);
$this->headTitle('时空导航');
$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->theme->AppendPlus($this,'google_map_v3');
$this->theme->AppendPlus($this,'colorbox');
$this->headScript()->appendFile('/js/timeline_var.js');
@ -26,10 +21,10 @@ img{max-width:none}
<?= $this->partial('hiwater/navi.phtml'); ?>
</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>
</div>
<div id="timemap">
<div id="timeline" style="height:500px;border-right:1px solid #abc;width:50%;float:left;"></div>
<div id="map" style="height:500px;"></div>
</div>
</div>
</div>
@ -91,7 +86,7 @@ $(function() {
},
"title" : "<?php echo htmlspecialchars($row['title']); ?>",
"options" : {
"infoHtml": "<div class='info'><a href=/heihe/view/uuid/<?php echo $row['uuid']; ?>><?php echo htmlspecialchars($row['title']); ?></a><hr /><img src=/service/thumb/id/<?php echo $row['id']; ?> onclick='$.colorbox({photo:\"true\",href:\"/service/bigthumb/id/<?php echo $row['id']; ?>\"});' /></div>",
"infoHtml": "<div class='info'><a href=/hiwater/view/uuid/<?php echo $row['uuid']; ?>><?php echo htmlspecialchars($row['title']); ?></a><hr /><img src=/service/thumb/id/<?php echo $row['id']; ?> onclick='$.colorbox({photo:\"true\",href:\"/service/bigthumb/id/<?php echo $row['id']; ?>\"});' /></div>",
"theme":"orange"
}
},

View File

@ -19,9 +19,6 @@ h3.gs_rt{font-size:110%;}
<?= $this->render('breadcrumbs.phtml'); ?>
<?php $md=$this->metadata;if ($md):?>
<div class="row">
<!-- <div class="span3">
<?= $this->partial('hiwater/navi.phtml'); ?>
</div> -->
<div class="span12">
<h3><?php echo $this->escape($md->title);
if ($md->title_en) echo '<br />'.$this->escape($md->title_en);?>