westdc-zf1/application/default/controllers/WaterController.php

93 lines
3.0 KiB
PHP
Raw Normal View History

2010-06-23 15:13:26 +00:00
<?php
class WaterController extends DataController
{
private $limit=20;
function indexAction()
{
//关键词
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join metadata on keyword.id=metadata.id where keyword.keytype='place' and metadata.source='0595169a-279e-4b95-819f-129d0ba4280d' 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 metadata m on k.id=m.id where k.keytype='theme' and m.source='0595169a-279e-4b95-819f-129d0ba4280d' group by k.keyword order by count(k.keyword) desc");
$k2=$state->fetchAll();
$state=$this->db->query("select keyword.keyword,count(*) from keyword left join metadata on keyword.id=metadata.id where keyword.keytype='temporal' and metadata.source='0595169a-279e-4b95-819f-129d0ba4280d' group by keyword.keyword order by count desc");
$k5=$state->fetchAll();
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
$searchform=new SearchForm();
$this->view->searchform=$searchform;
}
function overviewAction()
{
}
function coldAction()
{
$this->getmd('上游寒区水文试验区');
//$this->view->searchform=new SearchForm();
}
function bgAction()
{
//metadata
// 必须确认时间范围信息检查!
$this->getmd('冰沟流域加密观测区');
}
function arAction()
{
$this->getmd('阿柔试验区');
}
function bdkAction()
{
$this->getmd('扁都口试验区');
}
function forestAction()
{
$this->getmd('森林水文试验区');
}
function dykAction()
{
$this->getmd('大野口试验区');
}
function plgAction()
{
$this->getmd('排露沟流域加密观测区');
}
function aridAction()
{
$this->getmd('中游干旱区水文试验区');
}
function hzzAction()
{
$this->getmd('花寨子试验区');
}
function ykAction()
{
$this->getmd('盈科绿洲试验区');
}
function zyAction()
{
$this->getmd('张掖市试验区');
}
function zynocAction()
{
$this->getmd('张掖观象台试验区');
}
function lzgAction()
{
$this->getmd('临泽草地加密观测区');
}
function lzsAction()
{
$this->getmd('临泽站试验区');
}
private function getmd($keyword)
{
$page=(int)$this->_request->getParam('page');
if (empty($page)) $page=1;
$offset=$this->limit*($page-1);
$state=$this->db->query("select count(*) from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and id in (select id from keyword where keytype='place' and keyword='".$keyword."')");
$row=$state->fetchAll();
$sum=$row[0]['count'];
$sql="select uuid,title from metadata where source='0595169a-279e-4b95-819f-129d0ba4280d' and id in (select id from keyword where keytype='place' and keyword='".$keyword."') 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);
}
}