优化黑河计划专题
This commit is contained in:
parent
cfbc7f8815
commit
81db4bca0f
|
@ -8,12 +8,15 @@ class HeiheController extends DataController
|
|||
parent::preDispatch();
|
||||
$this->debug = 1;
|
||||
$this->view->pageID = "heihe-".$this->_request->getActionName();
|
||||
$this->view->nav[] = array('link'=>"/heihe",'title'=>'黑河计划数据管理中心');
|
||||
}
|
||||
|
||||
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";
|
||||
$this->view->meatdata=$this->db->fetchAll($sql);
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河流域数据简介','about');
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -65,121 +68,136 @@ class HeiheController extends DataController
|
|||
|
||||
function baseAction()
|
||||
{
|
||||
$page=(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $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'))");
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$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;
|
||||
$this->getmd(array('冰川','沙漠','地貌','植被','草场','沙漠化','基础地理','遥感影像','水文地质','社会经济','人口','SWAT','NPP','WRF','辐射','NEP'));
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-基础数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/base",'title'=>'基础数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function geobaseAction()
|
||||
{
|
||||
$this->getmd('基础地理');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-基础地理数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/geobase",'title'=>'基础地理数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function coreAction()
|
||||
{
|
||||
$page=(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $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='试验'))");
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$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;
|
||||
$this->getmd(array('DEM','土地利用','土壤','气象','水文观测','灌溉','试验'));
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-核心数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/core",'title'=>'核心数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function demAction()
|
||||
{
|
||||
$this->getmd('DEM');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-DEM','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/dem",'title'=>'DEM');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function rsAction()
|
||||
{
|
||||
$this->getmd('遥感影像');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-遥感影像','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/rs",'title'=>'遥感影像');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function waterAction()
|
||||
{
|
||||
$this->getmd('水文地质');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-水文水资源数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/water",'title'=>'水文水资源数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function modelAction()
|
||||
{
|
||||
$page=(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $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='辐射'))");
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$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;
|
||||
$this->getmd(array('WRF','NPP','SWAT','NEP','辐射'));
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-模型数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/model",'title'=>'模型数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function economicAction()
|
||||
{
|
||||
$page=(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $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='社会经济'))");
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$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;
|
||||
$this->getmd(array('人口','社会经济'));
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-社会经济数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/economic",'title'=>'社会经济数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function landsurfaceAction()
|
||||
{
|
||||
$page=(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $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='沙漠化'))");
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$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;
|
||||
$this->getmd(array('冰川','沙漠','地貌','植被','草场','沙漠化'));
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-陆地表层数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/landsurface",'title'=>'陆地表层数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function landuseAction()
|
||||
{
|
||||
$this->getmd('土地利用','theme');
|
||||
$this->getmd('土地利用');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-土地利用数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/landuse",'title'=>'土地利用数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function soilAction()
|
||||
{
|
||||
$this->getmd('土壤','theme');
|
||||
$this->getmd('土壤');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-土壤数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/soil",'title'=>'土壤数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function meteoAction()
|
||||
{
|
||||
$this->getmd('气象','theme');
|
||||
$this->getmd('气象');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-气象观测数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/meteo",'title'=>'气象观测数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function hydroAction()
|
||||
{
|
||||
$this->getmd('水文观测','theme');
|
||||
$this->getmd('水文观测');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-水文观测数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/hydro",'title'=>'水文观测数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
function irragationAction()
|
||||
{
|
||||
$this->getmd('灌溉','theme');
|
||||
$this->getmd('灌溉');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-灌溉数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/irragation",'title'=>'灌溉数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function obsAction()
|
||||
{
|
||||
$this->getmd('试验','theme');
|
||||
$this->getmd('试验');
|
||||
$archive = new Archive($this->db);
|
||||
$this->view->info = $archive->getOneArchive('黑河计划-观测试验数据','about');
|
||||
$this->view->nav[] = array('link'=>"/heihe/obs",'title'=>'观测试验数据');
|
||||
$this->_helper->viewRenderer('base');
|
||||
}
|
||||
|
||||
function listAction()
|
||||
|
@ -188,34 +206,30 @@ class HeiheController extends DataController
|
|||
$this->view->metadata=$this->db->fetchAll($sql);
|
||||
}
|
||||
|
||||
function tagAction()
|
||||
{
|
||||
$key = $this->_request->getParam('key');
|
||||
$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);
|
||||
$state=$this->db->query($sql);
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$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='heihe') 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='heihe') 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='heihe') 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='heihe') 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='heihe') 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);
|
||||
}
|
||||
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(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='heihe') and k.keyword=?",$key);
|
||||
$state=$this->db->query($sql);
|
||||
$row=$state->fetchAll();
|
||||
$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 ?";
|
||||
$this->view->metadata=$this->db->fetchAll($sql,array($this->limit,$offset));
|
||||
$this->view->page=new Pagination($sum,$page,$this->limit);
|
||||
} else {
|
||||
$sql="select k.keyword,count(*),k.keytype from keyword k left join normalmetadata m on k.id=m.id where length(k.keyword)>0 and m.uuid in (select d.uuid from datasource d left join source s on d.sourceid=s.id where s.code='heihe') ";
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
function searchAction()
|
||||
|
@ -296,19 +310,63 @@ class HeiheController extends DataController
|
|||
}
|
||||
}
|
||||
|
||||
private function getmd($keyword,$type='theme')
|
||||
{
|
||||
$page=(int)$this->_request->getParam('page');
|
||||
if (empty($page)) $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."')");
|
||||
$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='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->page=new Pagination($sum,$page,$this->limit);
|
||||
$this->view->offset=$offset+1;
|
||||
private function getmd($keyword,$type='theme')
|
||||
{
|
||||
$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='heihe' and m.id in (select id from keyword where keytype='".$type."' and 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='heihe') and id in (select id from keyword where keytype='".$type."' and 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;
|
||||
}
|
||||
|
||||
//获取多项条件并列关系的数据并必须满足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='heihe' 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='heihe') 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;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -334,13 +392,7 @@ class HeiheController extends DataController
|
|||
$this->view->isadmin=false;
|
||||
if ($user->usertype=='administrator') $this->view->isadmin=true;
|
||||
}
|
||||
|
||||
if(empty($ac) || $ac == "index")
|
||||
{
|
||||
$this->_helper->viewRenderer('submit-index');
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//新建元数据
|
||||
if($ac == "newdata")
|
||||
{
|
||||
|
@ -409,10 +461,10 @@ class HeiheController extends DataController
|
|||
}//newdata
|
||||
|
||||
//未提交数据
|
||||
if($ac == "unsubmit")
|
||||
if($ac == "unsubmit" || $ac=="")
|
||||
{
|
||||
$do = $this->_getParam('do');
|
||||
|
||||
|
||||
//未提交的数据列表
|
||||
if(empty($do) || $do=="index")
|
||||
{
|
||||
|
@ -737,6 +789,7 @@ class HeiheController extends DataController
|
|||
if(empty($ac) || $ac == "index" || $ac == 'my')
|
||||
{
|
||||
$this->_helper->viewRenderer('project-index');
|
||||
$this->view->tabID='projects-index';
|
||||
|
||||
//Search Link
|
||||
$this->view->searchLink = "/heihe/projects/ac/index/";
|
||||
|
@ -752,15 +805,20 @@ class HeiheController extends DataController
|
|||
$this->view->error = "输入的搜索条件有误,只允许输入汉字、数字、字母";
|
||||
return true;
|
||||
}
|
||||
$wheresql[] = " (title LIKE '%$q%' OR
|
||||
code LIKE '%$q%' OR
|
||||
name LIKE '%$q%')";
|
||||
$wheresql[] = " (p.title LIKE '%$q%' OR
|
||||
p.code LIKE '%$q%' OR
|
||||
p.name LIKE '%$q%')";
|
||||
$this->view->searchKeyword = $q;
|
||||
}
|
||||
|
||||
if($ac == "my")
|
||||
{
|
||||
$wheresql[] = " email='$user_email' ";
|
||||
//防止通过其它方式访问,先判断是否是登录用户,如果不是,抛出消息后强制用户退出
|
||||
$auth = Zend_Auth::getInstance();
|
||||
if(!$auth->hasIdentity())
|
||||
$this->_redirect('/account/login?href=/heihe/projects/ac/my');
|
||||
$wheresql[] = " p.email='$user_email' ";
|
||||
$this->view->tabID='projects-my';
|
||||
}
|
||||
|
||||
if(count($wheresql)>0)
|
||||
|
@ -775,8 +833,8 @@ class HeiheController extends DataController
|
|||
$wheresql = " WHERE ".$wheresql;
|
||||
}
|
||||
|
||||
$sql = "SELECT * FROM heiheproject $wheresql
|
||||
ORDER BY id DESC";
|
||||
$sql = "SELECT p.*,f.id as fid FROM heiheproject p left join fund f on p.code=f.fund_id $wheresql
|
||||
ORDER BY p.id asc";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
|
@ -792,8 +850,8 @@ class HeiheController extends DataController
|
|||
if($ac == "submitting")
|
||||
{
|
||||
$this->_helper->viewRenderer('project-index');
|
||||
|
||||
$sql = "SELECT * FROM heiheproject WHERE status=1";
|
||||
$this->view->tabID='projects-submitting';
|
||||
$sql = "SELECT p.*,f.id as fid FROM heiheproject p left join fund f on p.code=f.fund_id WHERE p.status=1";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
|
@ -808,8 +866,8 @@ class HeiheController extends DataController
|
|||
if($ac == "unsubmit")
|
||||
{
|
||||
$this->_helper->viewRenderer('project-index');
|
||||
|
||||
$sql = "SELECT * FROM heiheproject WHERE status=0";
|
||||
$this->view->tabID='projects-unsubmit';
|
||||
$sql = "SELECT p.*,f.id as fid FROM heiheproject p left join fund f on p.code=f.fund_id WHERE p.status=0";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
|
@ -824,8 +882,8 @@ class HeiheController extends DataController
|
|||
if($ac == "submit")
|
||||
{
|
||||
$this->_helper->viewRenderer('project-index');
|
||||
|
||||
$sql = "SELECT * FROM heiheproject WHERE status>0";
|
||||
$this->view->tabID='projects-submit';
|
||||
$sql = "SELECT p.*,f.id as fid FROM heiheproject p left join fund f on p.code=f.fund_id WHERE p.status>0";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll();
|
||||
|
||||
|
@ -1018,5 +1076,166 @@ class HeiheController extends DataController
|
|||
$sth=$this->wdb->prepare($sql);
|
||||
$sth->execute(array($author,$uuid));
|
||||
}
|
||||
//基于数据作者的浏览(包括认证后的数据作者以及未认证的数据作者)
|
||||
function authorAction()
|
||||
{
|
||||
$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='heihe') 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='heihe') 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='heihe') 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='heihe') 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function fundAction()
|
||||
{
|
||||
$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='heihe') 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;
|
||||
}
|
||||
} 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 left join heiheproject hp on f.fund_id=hp.code where hp.id is not null 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 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 orgAction()
|
||||
{
|
||||
$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='heihe') 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='heihe') 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 {
|
||||
//提供全部分类列表
|
||||
}
|
||||
}
|
||||
|
||||
//实现基于DOI信息的浏览
|
||||
function doiAction()
|
||||
{
|
||||
$ac = $this->_request->getParam('ac');
|
||||
if ($ac=='unready') {
|
||||
//列出没有DOI的数据
|
||||
$sql="select m.* from normalmetadata m where length(m.doi)<3 and m.uuid not in (select uuid from datadoi) and m.uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe') order by m.ts_created desc";
|
||||
$this->view->tabID='doi-unready';
|
||||
} else if ($ac=='prepare') {
|
||||
//列出有DOI但还未进行提交申请的数据
|
||||
$sql="select m.* from normalmetadata m where length(m.doi)>3 and m.uuid not in (select uuid from datadoi) and m.uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe') order by m.ts_created desc";
|
||||
$this->view->tabID='doi-prepare';
|
||||
} else if ($ac=='unsubmit') {
|
||||
//列出有DOI并计划提交申请的数据
|
||||
$sql="select m.*,d.doi as datadoi,date(d.ts_created) as ts_created from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_created is not null and d.ts_submitted is null and m.uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe') order by d.ts_created desc";
|
||||
$this->view->tabID='doi-unsubmit';
|
||||
} else if ($ac=='submit') {
|
||||
//列出有DOI并计划提交申请的数据
|
||||
$sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_submitted is not null and d.ts_published is null and m.uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe') order by d.ts_submitted desc,d.ts_created desc";
|
||||
$this->view->tabID='doi-submit';
|
||||
} else if ($ac=='publish' || empty($ac)) {
|
||||
//默认:列出最新发布的DOI数据
|
||||
$sql="select m.*,d.doi as datadoi,date(d.ts_submitted) as ts_submitted,date(d.ts_published) as ts_published from normalmetadata m left join datadoi d on m.uuid=d.uuid where length(m.doi)>3 and d.ts_published is not null and m.uuid in (select ds.uuid from datasource ds left join source s on ds.sourceid=s.id where s.code='heihe') order by d.ts_published desc,d.ts_submitted desc,d.ts_created desc";
|
||||
$this->view->tabID='doi-publish';
|
||||
}
|
||||
$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;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue