增加json输出滚动信息的功能
This commit is contained in:
parent
b515f8a0e0
commit
a44effeba9
|
@ -1,20 +1,50 @@
|
||||||
<?php
|
<?php
|
||||||
class HeiheController extends DataController
|
class HeiheController extends DataController
|
||||||
{
|
{
|
||||||
private $limit=20;
|
private $limit=20;
|
||||||
|
|
||||||
function preDispatch()
|
function preDispatch()
|
||||||
{
|
{
|
||||||
parent::preDispatch();
|
parent::preDispatch();
|
||||||
$this->_helper->layout->setLayout('heihe');
|
$this->_helper->layout->setLayout('heihe');
|
||||||
}
|
}
|
||||||
|
|
||||||
function indexAction()
|
function indexAction()
|
||||||
{
|
{
|
||||||
$sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and length(t.data)>2 order by random() limit 3";
|
$sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and length(t.data)>2 order by random() limit 3";
|
||||||
$this->view->meatdata=$this->db->fetchAll($sql);
|
$this->view->meatdata=$this->db->fetchAll($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function changelistAction()
|
||||||
|
{
|
||||||
|
|
||||||
|
$this->_helper->layout->disableLayout();
|
||||||
|
$this->_helper->viewRenderer->setNoRender();
|
||||||
|
|
||||||
|
$rows = array();
|
||||||
|
$rows[]=array(
|
||||||
|
'uuid'=>'ca50f052-b409-48eb-a18b-1787e8d19062',
|
||||||
|
'src' =>'/images/water/forest.png',
|
||||||
|
'description' => '据,其空间坐标系统主要包括了以下三个类型:WGS84坐标系,ALBERS坐标系,高斯坐标系。其中WGS84',
|
||||||
|
'title' => 'xxxxxxxxxx'
|
||||||
|
);
|
||||||
|
$rows[]=array(
|
||||||
|
'uuid'=>'ca50f052-b409-48eb-a18b-1787e8d19062',
|
||||||
|
'src' =>'/images/water/water.jpg',
|
||||||
|
'description' => '据,其空间坐标系统主要包括了以下三个类型:WGS84坐标系,ALBERS坐标系,高斯坐标系。其中WGS84',
|
||||||
|
'title' => 'xxxxxxxxxx'
|
||||||
|
);
|
||||||
|
$rows[]=array(
|
||||||
|
'uuid'=>'ca50f052-b409-48eb-a18b-1787e8d19062',
|
||||||
|
'src' =>'/images/water/doppler.jpg',
|
||||||
|
'description' => '据,其空间坐标系统主要包括了以下三个类型:WGS84坐标系,ALBERS坐标系,高斯坐标系。其中WGS84',
|
||||||
|
'title' => 'xxxxxxxxxx'
|
||||||
|
);
|
||||||
|
|
||||||
|
echo Zend_Json::encode($rows);
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 数据浏览
|
* 数据浏览
|
||||||
*/
|
*/
|
||||||
|
@ -29,10 +59,10 @@ class HeiheController extends DataController
|
||||||
$select=$this->db->select();
|
$select=$this->db->select();
|
||||||
$select->from('normalmetadata','*')->where(" uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ")->order('title desc')->limitPage($page,$this->limit);
|
$select->from('normalmetadata','*')->where(" uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ")->order('title desc')->limitPage($page,$this->limit);
|
||||||
$this->view->metadata = $this->db->fetchAll($select);
|
$this->view->metadata = $this->db->fetchAll($select);
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function thumbAction()
|
function thumbAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
|
@ -42,270 +72,270 @@ class HeiheController extends DataController
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$select=$this->db->select();
|
$select=$this->db->select();
|
||||||
$select->from('normalmetadata as m','m.*')
|
$select->from('normalmetadata as m','m.*')
|
||||||
->where(" uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ")
|
->where(" uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ")
|
||||||
->order('m.title desc')->limitPage($page,$this->limit);
|
->order('m.title desc')->limitPage($page,$this->limit);
|
||||||
$this->view->metadata = $this->db->fetchAll($select);
|
$this->view->metadata = $this->db->fetchAll($select);
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
function documentAction()
|
function documentAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$row=$this->db->fetchAll("select count(*) from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ))");
|
$row=$this->db->fetchAll("select count(*) from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ))");
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$sql="select * from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') )) order by reference limit ? offset ?";
|
$sql="select * from reference where id in (select refid from mdref where uuid in (select uuid from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') )) order by reference limit ? offset ?";
|
||||||
$this->view->refs=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->refs=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit,"文献");
|
$this->view->page=new Pagination($sum,$page,$this->limit,"文献");
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function baseAction()
|
function baseAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化' or keyword='基础地理' or keyword='遥感影像' or keyword='水文地质' or keyword='社会经济' or keyword='人口' or keyword='SWAT' or keyword='NPP' or keyword='WRF' or keyword='辐射' or keyword='NEP'))");
|
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化' or keyword='基础地理' or keyword='遥感影像' or keyword='水文地质' or keyword='社会经济' or keyword='人口' or keyword='SWAT' or keyword='NPP' or keyword='WRF' or keyword='辐射' or keyword='NEP'))");
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化' or keyword='基础地理' or keyword='遥感影像' or keyword='水文地质' or keyword='社会经济' or keyword='人口' or keyword='SWAT' or keyword='NPP' or keyword='WRF' or keyword='辐射' or keyword='NEP')) order by timebegin,title limit ? offset ?";
|
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化' or keyword='基础地理' or keyword='遥感影像' or keyword='水文地质' or keyword='社会经济' or keyword='人口' or keyword='SWAT' or keyword='NPP' or keyword='WRF' or keyword='辐射' or keyword='NEP')) order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function geobaseAction()
|
function geobaseAction()
|
||||||
{
|
{
|
||||||
$this->getmd('基础地理');
|
$this->getmd('基础地理');
|
||||||
}
|
}
|
||||||
|
|
||||||
function coreAction()
|
function coreAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='DEM' or keyword='土地利用' or keyword='土壤' or keyword='气象' or keyword='水文观测' or keyword='灌溉' or keyword='试验'))");
|
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='DEM' or keyword='土地利用' or keyword='土壤' or keyword='气象' or keyword='水文观测' or keyword='灌溉' or keyword='试验'))");
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='DEM' or keyword='土地利用' or keyword='土壤' or keyword='气象' or keyword='水文观测' or keyword='灌溉' or keyword='试验')) order by timebegin,title limit ? offset ?";
|
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='DEM' or keyword='土地利用' or keyword='土壤' or keyword='气象' or keyword='水文观测' or keyword='灌溉' or keyword='试验')) order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function demAction()
|
function demAction()
|
||||||
{
|
{
|
||||||
$this->getmd('DEM');
|
$this->getmd('DEM');
|
||||||
}
|
}
|
||||||
|
|
||||||
function rsAction()
|
function rsAction()
|
||||||
{
|
{
|
||||||
$this->getmd('遥感影像');
|
$this->getmd('遥感影像');
|
||||||
}
|
}
|
||||||
|
|
||||||
function waterAction()
|
function waterAction()
|
||||||
{
|
{
|
||||||
$this->getmd('水文地质');
|
$this->getmd('水文地质');
|
||||||
}
|
}
|
||||||
|
|
||||||
function modelAction()
|
function modelAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='WRF' or keyword='NPP' or keyword='SWAT' or keyword='NEP' or keyword='辐射'))");
|
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='WRF' or keyword='NPP' or keyword='SWAT' or keyword='NEP' or keyword='辐射'))");
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='WRF' or keyword='NPP' or keyword='SWAT' or keyword='NEP' or keyword='辐射')) order by timebegin,title limit ? offset ?";
|
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='WRF' or keyword='NPP' or keyword='SWAT' or keyword='NEP' or keyword='辐射')) order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function economicAction()
|
function economicAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='人口' or keyword='社会经济'))");
|
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='人口' or keyword='社会经济'))");
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='人口' or keyword='社会经济')) order by timebegin,title limit ? offset ?";
|
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='人口' or keyword='社会经济')) order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function landsurfaceAction()
|
function landsurfaceAction()
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化'))");
|
$state=$this->db->query("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化'))");
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化')) order by timebegin,title limit ? offset ?";
|
$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='heihe') and id in (select id from keyword where keytype='theme' and (keyword='冰川' or keyword='沙漠' or keyword='地貌' or keyword='植被' or keyword='草场' or keyword='沙漠化')) order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function landuseAction()
|
function landuseAction()
|
||||||
{
|
{
|
||||||
$this->getmd('土地利用','theme');
|
$this->getmd('土地利用','theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
function soilAction()
|
function soilAction()
|
||||||
{
|
{
|
||||||
$this->getmd('土壤','theme');
|
$this->getmd('土壤','theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
function meteoAction()
|
function meteoAction()
|
||||||
{
|
{
|
||||||
$this->getmd('气象','theme');
|
$this->getmd('气象','theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
function hydroAction()
|
function hydroAction()
|
||||||
{
|
{
|
||||||
$this->getmd('水文观测','theme');
|
$this->getmd('水文观测','theme');
|
||||||
}
|
}
|
||||||
function irragationAction()
|
function irragationAction()
|
||||||
{
|
{
|
||||||
$this->getmd('灌溉','theme');
|
$this->getmd('灌溉','theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
function obsAction()
|
function obsAction()
|
||||||
{
|
{
|
||||||
$this->getmd('试验','theme');
|
$this->getmd('试验','theme');
|
||||||
}
|
}
|
||||||
|
|
||||||
function listAction()
|
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='heihe') order by timebegin,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='heihe') order by timebegin,title";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql);
|
$this->view->metadata=$this->db->fetchAll($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tagAction()
|
function tagAction()
|
||||||
{
|
{
|
||||||
$key = $this->_request->getParam('key');
|
$key = $this->_request->getParam('key');
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
if (!empty($key)) {
|
if (!empty($key)) {
|
||||||
$this->view->codename=$key;
|
$this->view->codename=$key;
|
||||||
$sql=$this->db->quoteInto('select count(id) from keyword where keyword=?',$key);
|
$sql=$this->db->quoteInto('select count(id) from keyword where keyword=?',$key);
|
||||||
$state=$this->db->query($sql);
|
$state=$this->db->query($sql);
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$sql="select uuid,title,id,description from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keyword='".$key."') order by timebegin,title limit ? offset ?";
|
$sql="select uuid,title,id,description from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from keyword where keyword='".$key."') order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
} else {
|
} 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='heihe') group by keyword.keyword order by count desc");
|
$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='heihe') group by keyword.keyword order by count desc");
|
||||||
$k1=$state->fetchAll();
|
$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='heihe') group by k.keyword order by k.keyword");
|
$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='heihe') group by k.keyword order by k.keyword");
|
||||||
$k2=$state->fetchAll();
|
$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='heihe') group by k.keyword order by k.keyword");
|
$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='heihe') group by k.keyword order by k.keyword");
|
||||||
$k3=$state->fetchAll();
|
$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='heihe') group by k.keyword order by k.keyword");
|
$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='heihe') group by k.keyword order by k.keyword");
|
||||||
$k4=$state->fetchAll();
|
$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='heihe') group by keyword.keyword order by keyword.keyword");
|
$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='heihe') group by keyword.keyword order by keyword.keyword");
|
||||||
$k5=$state->fetchAll();
|
$k5=$state->fetchAll();
|
||||||
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
|
$this->view->keywords=array('place'=>$k1,'theme'=>$k2,'discipline'=>$k3,'stratum'=>$k4,'temporal'=>$k5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchAction()
|
function searchAction()
|
||||||
{
|
{
|
||||||
$this->view->addHelperPath('helper','Zend_View_Helper_');
|
$this->view->addHelperPath('helper','Zend_View_Helper_');
|
||||||
$form=new SearchForm();
|
$form=new SearchForm();
|
||||||
$this->view->form=$form;
|
$this->view->form=$form;
|
||||||
//$form->submit->setLabel('快速搜索');
|
//$form->submit->setLabel('快速搜索');
|
||||||
$key=$this->_request->getParam('q');
|
$key=$this->_request->getParam('q');
|
||||||
if (!empty($key)) {
|
if (!empty($key)) {
|
||||||
$search=new Search($key);
|
$search=new Search($key);
|
||||||
$where=$search->sql_expr(array("title","description"));
|
$where=$search->sql_expr(array("title","description"));
|
||||||
$page=@(int)$this->_request->getParam('page');
|
$page=@(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$row=$this->db->fetchAll("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and ".$where);
|
$row=$this->db->fetchAll("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and ".$where);
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$sql="select uuid,title,id,description from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and ".$where." order by timebegin,title limit ? offset ?";
|
$sql="select uuid,title,id,description from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and ".$where." order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->key=$key;
|
$this->view->key=$key;
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function timemapAction()
|
function timemapAction()
|
||||||
{
|
{
|
||||||
$sql="select id,uuid,west,south,north,east,title,timebegin,timeend from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and timebegin is not null";
|
$sql="select id,uuid,west,south,north,east,title,timebegin,timeend from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and timebegin is not null";
|
||||||
$this->view->rows=$this->db->fetchAll($sql);
|
$this->view->rows=$this->db->fetchAll($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
function timelineAction()
|
function timelineAction()
|
||||||
{
|
{
|
||||||
$fn="heihetime.xml";
|
$fn="heihetime.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='heihe') order by ts_created desc limit 1");
|
$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='heihe') order by ts_created desc limit 1");
|
||||||
$last_update=strtotime($rows[0]['ts_created']);
|
$last_update=strtotime($rows[0]['ts_created']);
|
||||||
if (!file_exists($fn) || (filemtime($fn)<$last_update))
|
if (!file_exists($fn) || (filemtime($fn)<$last_update))
|
||||||
{
|
{
|
||||||
$dateformat="M j Y";
|
$dateformat="M j Y";
|
||||||
$rows=$this->db->fetchAll("select id,uuid,description,title,timebegin,timeend from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and timebegin is not null order by timebegin,title");
|
$rows=$this->db->fetchAll("select id,uuid,description,title,timebegin,timeend from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and timebegin is not null order by timebegin,title");
|
||||||
$timexml='<data>';
|
$timexml='<data>';
|
||||||
foreach($rows as $row) {
|
foreach($rows as $row) {
|
||||||
$timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).' GMT+0800" ';
|
$timexml.='<event start="'.date($dateformat,strtotime($row['timebegin'])).' GMT+0800" ';
|
||||||
if ($row['timeend']!='' && $row['timeend']!=$row['timebegin']) $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"';
|
if ($row['timeend']!='' && $row['timeend']!=$row['timebegin']) $timexml.=' end="'.date($dateformat,strtotime($row['timeend'])).'" isDuration="true"';
|
||||||
$timexml.= ' title="'.htmlspecialchars($row['title']).'" image="/images/westdc_40w.gif" link="/heihe/view/uuid/'.$row['uuid'].'">';
|
$timexml.= ' title="'.htmlspecialchars($row['title']).'" image="/images/westdc_40w.gif" link="/heihe/view/uuid/'.$row['uuid'].'">';
|
||||||
$desc_length=mb_strlen($row['description'],"UTF-8");
|
$desc_length=mb_strlen($row['description'],"UTF-8");
|
||||||
$desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
|
$desc=mb_substr($row['description'],0,($desc_length>300)?300:$desc_length,"UTF-8");
|
||||||
if ($desc_length>300) $desc.=" ...";
|
if ($desc_length>300) $desc.=" ...";
|
||||||
$timexml.=htmlspecialchars($desc);
|
$timexml.=htmlspecialchars($desc);
|
||||||
$timexml.="</event>\n";
|
$timexml.="</event>\n";
|
||||||
}
|
}
|
||||||
$timexml.='</data>';
|
$timexml.='</data>';
|
||||||
$fp=fopen($fn,'w');
|
$fp=fopen($fn,'w');
|
||||||
fwrite($fp,$timexml);
|
fwrite($fp,$timexml);
|
||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function categoryAction()
|
function categoryAction()
|
||||||
{
|
{
|
||||||
$code = (int)$this->_request->getParam('code');
|
$code = (int)$this->_request->getParam('code');
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$this->view->category=$this->db->fetchAll("select c.code,name,name_zh,count(*) from category c left join normalmetadata m on c.id=m.id,categorycode cc where c.code=cc.code and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') group by c.code,cc.name,cc.name_zh");
|
$this->view->category=$this->db->fetchAll("select c.code,name,name_zh,count(*) from category c left join normalmetadata m on c.id=m.id,categorycode cc where c.code=cc.code and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') group by c.code,cc.name,cc.name_zh");
|
||||||
if ($code>0 && $code<20) {
|
if ($code>0 && $code<20) {
|
||||||
$row=$this->db->fetchAll("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from category where code=".$code.")");
|
$row=$this->db->fetchAll("select count(*) from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select id from category where code=".$code.")");
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
$sql="select uuid,title,description,id from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select distinct id from category where code=".$code.") order by timebegin,title limit ? offset ?";
|
$sql="select uuid,title,description,id from normalmetadata where uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') and id in (select distinct id from category where code=".$code.") order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
$row=$this->db->fetchRow("select name,name_zh from categorycode where code=?",$code);
|
$row=$this->db->fetchRow("select name,name_zh from categorycode where code=?",$code);
|
||||||
$this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
|
$this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
|
||||||
} else {
|
} else {
|
||||||
//提供全部分类列表
|
//提供全部分类列表
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getmd($keyword,$type='theme')
|
private function getmd($keyword,$type='theme')
|
||||||
{
|
{
|
||||||
$page=(int)$this->_request->getParam('page');
|
$page=(int)$this->_request->getParam('page');
|
||||||
if (empty($page)) $page=1;
|
if (empty($page)) $page=1;
|
||||||
$offset=$this->limit*($page-1);
|
$offset=$this->limit*($page-1);
|
||||||
$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='heihe' and m.id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."')");
|
$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='heihe' and m.id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."')");
|
||||||
$row=$state->fetchAll();
|
$row=$state->fetchAll();
|
||||||
$sum=$row[0]['count'];
|
$sum=$row[0]['count'];
|
||||||
//@todo: add order with title
|
//@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='heihe') and id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."') order by timebegin,title limit ? offset ?";
|
$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='heihe') and id in (select id from keyword where keytype='".$type."' and keyword='".$keyword."') order by timebegin,title limit ? offset ?";
|
||||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||||
$this->view->offset=$offset+1;
|
$this->view->offset=$offset+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue