更新hiwater专题,添加并列条件获取数据列表方法

This commit is contained in:
wlx 2013-06-07 02:30:26 +00:00
parent 18a42a5a51
commit e9e6bbc479
2 changed files with 89 additions and 25 deletions

View File

@ -29,13 +29,18 @@ class HiwaterController extends DataController
{
$this->view->pageIn = "collapse5";
}
else if(in_array($acName,array("mso","cosmos","tdp","isotope")))
{
$this->view->pageIn = "collapse6";
}
else if(in_array($acName,array("browse","thumb","fund","tag","timeline","timemap",'author','organization')))
{
$this->view->pageIn = "collapse10";
}
else if(in_array($acName,array("other")))
{
$this->view->pageIn = "collapse6";
$this->view->pageIn = "collapse9";
}
$this->view->pageID = "hiwater-".$acName;
}
@ -97,32 +102,32 @@ class HiwaterController extends DataController
function aviationAction()
{
$this->getmd(array('航空遥感','WiDAS','PLMR','Lidar','CASI','热红外高光谱数据'));
$this->getmdlimited(array('WiDAS','PLMR','Lidar','CASI','热红外高光谱数据'),'航空遥感');
$this->_helper->viewRenderer('base');
}
function radiometerAction()
{
$this->getmd(array('','PLMR'));
$this->getmdlimited('PLMR','航空遥感');
$this->_helper->viewRenderer('base');
}
function lidarAction()
{
$this->getmd(array('LIDAR','Lidar'));
$this->getmdlimited('激光雷达','航空遥感');
$this->_helper->viewRenderer('base');
}
function widasAction()
{
$this->getmd(array('WIDAS','WiDAS'));
{
$this->getmdlimited('WIDAS','航空遥感');
$this->_helper->viewRenderer('base');
}
function nearvisAction()
{
$this->getmd(array('','CASI'));
{
$this->getmdlimited('CASI','航空遥感');
$this->_helper->viewRenderer('base');
}
function thermalAction()
{
$this->getmd(array('','热红外高光谱数据'));
{
$this->getmdlimited('热红外高光谱数据','航空遥感');
$this->_helper->viewRenderer('base');
}
@ -236,7 +241,7 @@ class HiwaterController extends DataController
}
function bnulaiAction()
{
$this->getmd(array('','BNULAI'));
$this->getmd(array('','LAI'));
$this->_helper->viewRenderer('base');
}
@ -270,7 +275,31 @@ class HiwaterController extends DataController
{
$this->getmd('试验','theme');
}
function msoAction()
{
$this->getmd(array('稳定同位素观测系统','热扩散液流计TDP','宇宙射线土壤水分'));
$this->_helper->viewRenderer('base');
}
function isotopeAction()
{
$this->getmd(array('','稳定同位素观测系统'));
$this->_helper->viewRenderer('base');
}
function tdpAction()
{
$this->getmd(array('','热扩散液流计TDP'));
$this->_helper->viewRenderer('base');
}
function cosmosAction()
{
$this->getmd(array('','宇宙射线土壤水分'));
$this->_helper->viewRenderer('base');
}
function listAction()
{
$sql="select uuid,title 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 timebegin,title";
@ -412,6 +441,37 @@ class HiwaterController extends DataController
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
$this->view->page=new Pagination($sum,$page,$this->limit);
$this->view->offset=$offset+1;
}
//获取多项条件并列关系的数据并必须满足limited条件
//$keyword:字符串或字符串数组
//$limited:限制字符串
private function getmdlimited($keyword,$limited)
{
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
if (!is_array($keyword))
{
$keyword=array($keyword);
}
$key="(";
foreach($keyword as $k)
{
$key.="'".$k."',";
}
$key=substr($key,0,-1);
$key.=")";
$keyword=$key;
$state=$this->db->query("select count(m.*) from normalmetadata m left join datasource d on m.uuid=d.uuid left join source s on d.sourceid=s.id where s.code='hiwater' and m.id in (select id from keyword where keyword='".$limited."') and m.id in (select id from keyword where keyword in ".$keyword.")");
$row=$state->fetchAll();
$sum=$row[0]['count'];
//@todo: add order with title
$sql="select uuid,title from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='hiwater') and id in (select id from keyword where keyword='".$limited."') and id in (select id from keyword where keyword in ".$keyword.") order by timebegin,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->offset=$offset+1;
}
//基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者)

View File

@ -25,7 +25,8 @@
</ul>
</div>
</div>
</div>
</div>
<!--
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-airborne">
<a href="/hiwater/airborne" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
@ -46,7 +47,7 @@
</ul>
</div>
</div>
</div>
</div> -->
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-hiwater-hmon">
<a href="/hiwater/hmon" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
@ -100,24 +101,27 @@
</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">
<div class="accordion-heading" id="Nav-hiwater-mso">
<a href="/hiwater/mso" title="查看详细" class="pull-right detail-link"><i class="icon-arrow-right"></i></a>
<a class="accordion-toggle" data-toggle="collapse" data-parent="#side_accordion" href="#collapse6">
地表蒸散发的多尺度观测试验
</a>
</div>
<div id="collapse6" class="accordion-body collapse">
<ul class="nav nav-list heihe-subnav">
<li id="Nav-water-radiometer"><i class="icon-double-angle-right"></i><a href="/hiwater/radiometer">涡动相关观测</a></li>
<li id="Nav-water-lidar"><i class="icon-double-angle-right"></i><a href="/hiwater/lidar">自动气象站</a></li>
<li id="Nav-water-widas"><i class="icon-double-angle-right"></i><a href="/hiwater/widas">大孔径闪烁仪观测</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>
</ul>
<div id="collapse6" class="accordion-body collapse">
<div class="accordion-inner">
<ul class="nav nav-list heihe-subnav">
<!--<li id="Nav-hiwater-autometeo"><a href="/hiwater/autometeo"><i class="icon-double-angle-right"></i>自动气象站</a></li>
<li id="Nav-hiwater-ec"><a href="/hiwater/ec"><i class="icon-double-angle-right"></i>涡动相关观测</a></li>
<li id="Nav-hiwater-las"><a href="/hiwater/las"><i class="icon-double-angle-right"></i>大孔径闪烁仪观测</a></li>-->
<li id="Nav-hiwater-isotope"><a href="/hiwater/isotope"><i class="icon-double-angle-right"></i>稳定同位素观测</a></li>
<li id="Nav-hiwater-tdp"><a href="/hiwater/tdp"><i class="icon-double-angle-right"></i>树杆液流</a></li>
<li id="Nav-hiwater-cosmos"><a href="/hiwater/cosmos"><i class="icon-double-angle-right"></i>宇宙射线土壤水分观测COSMOS</a></li>
</ul>
</div>
</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>