update category and series list

This commit is contained in:
jack 2018-02-11 13:02:17 +08:00
parent 20d1787371
commit 9919d816cb
7 changed files with 398 additions and 296 deletions

4
.gitignore vendored
View File

@ -4,4 +4,6 @@ include/Zend
htdocs/upload/
htdocs/images/captcha/
geonetwork/
.DS_Store
.DS_Store
time1.xml
time.xml

View File

@ -258,6 +258,8 @@ class DataController extends Zend_Controller_Action
*/
function seriesAction()
{
$this->_helper->layout->setLayout('layout-sanji');
$id = $this->_request->getParam('id');
if (empty($id)) $id=0;
if (!is_numeric($id))
@ -302,10 +304,17 @@ class DataController extends Zend_Controller_Action
}
$sum=$row[0]['count'];
$select=$this->db->select();
$select->from('normalmetadata','*')->join('dataseries','normalmetadata.id=dataseries.id')->where('dataseries.sid=?',$id)->order('normalmetadata.title')->limitPage($page,$limit);
$select->from('normalmetadata','*')
->join('dataseries','normalmetadata.id=dataseries.id')
->joinLeft('mdstat','normalmetadata.uuid=mdstat.uuid', ['viewed','downloaded'])
->where('dataseries.sid=?',$id)
->order('normalmetadata.title')
->limitPage($page,$limit);
if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword);
$this->view->metadata=$this->db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$limit);
view::addTextPaginator($select, $this);
//$this->view->showtools=($sum>$page)?true:false;
//$this->view->form=new SearchForm();
$sql=$this->db->quoteInto("select keyword,count(*) as count from (select t.keyword,t.id from keyword t left join dataseries d on t.id=d.id where t.keytype='place' and d.sid=?) as f group by keyword order by count desc limit 30",$id);
@ -322,6 +331,8 @@ class DataController extends Zend_Controller_Action
*/
function categoryAction()
{
$this->_helper->layout->setLayout('layout-sanji');
$page = $this->_request->getParam('page');
$code = (int)$this->_request->getParam('code');
$state=$this->db->query('select c.code,name,name_zh,count(*) from category c,categorycode cc where c.code=cc.code group by c.code,cc.name,cc.name_zh');
@ -329,14 +340,19 @@ class DataController extends Zend_Controller_Action
if ($code>0 && $code<20) {
$where=$this->db->quoteInto('code = ?',$code);
$row=$this->db->fetchRow("select * from categorycode where ".$where);
$this->view->codename=(empty($row['name_zh'])?$row['name']:$row['name_zh']);
$this->view->codename=(empty($row['name_zh']) ? $row['name'] : $row['name_zh']);
$sql='select count(m.id) from normalmetadata m left join category c on m.id=c.id where c.code=?';
$row=$this->db->fetchRow($sql,array($code));
$sum=$row['count'];
$select=$this->db->select();
$select->from('normalmetadata as m','*')->joinLeft('category as c','m.id=c.id')->where('c.code=?',$code)->order('m.title')->limitPage($page,$this->limit);
$this->view->metadata=$this->db->fetchAll($select);
$this->view->page=new Pagination($sum,$page,$this->limit);
$select->from('normalmetadata as m','*')
->joinLeft('category as c','m.id=c.id')
->where('c.code=?',$code)
->order('m.title')
->limitPage($page,$this->limit);
view::addTextPaginator($select, $this);
} else {
//提供全部分类列表
}
@ -347,6 +363,8 @@ class DataController extends Zend_Controller_Action
*/
function timelineAction()
{
$this->_helper->layout->setLayout('layout-sanji');
$fn="time1.xml";
$rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1");
$last_update=strtotime($rows[0]['ts_created']);

View File

@ -9,14 +9,14 @@ class HeiheController extends DataController
$this->debug = 1;
$this->view->pageID = "heihe-".$this->_request->getActionName();
$this->view->nav[] = array('link'=>"/heihe",'title'=>'黑河计划数据管理中心');
$this->_helper->layout->setLayout('heihe');
// $this->_helper->layout->setLayout('heihe');
}
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);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河流域数据简介','about');
}
@ -70,7 +70,7 @@ class HeiheController extends DataController
function baseAction()
{
$this->getmd(array('冰川','沙漠','地貌','植被','草场','沙漠化','基础地理','遥感影像','水文地质','社会经济','人口','SWAT','NPP','WRF','辐射','NEP'));
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-基础数据','about');
$this->view->nav[] = array('link'=>"/heihe/base",'title'=>'基础数据');
$this->_helper->viewRenderer('base');
@ -79,7 +79,7 @@ class HeiheController extends DataController
function geobaseAction()
{
$this->getmd('基础地理');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-基础地理数据','about');
$this->view->nav[] = array('link'=>"/heihe/geobase",'title'=>'基础地理数据');
$this->_helper->viewRenderer('base');
@ -88,7 +88,7 @@ class HeiheController extends DataController
function coreAction()
{
$this->getmd(array('DEM','土地利用','土壤','气象','水文观测','灌溉','试验'));
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-核心数据','about');
$this->view->nav[] = array('link'=>"/heihe/core",'title'=>'核心数据');
$this->_helper->viewRenderer('base');
@ -97,7 +97,7 @@ class HeiheController extends DataController
function demAction()
{
$this->getmd('DEM');
$archive = new Archive($this->db);
$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');
@ -106,7 +106,7 @@ class HeiheController extends DataController
function rsAction()
{
$this->getmd('遥感影像');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-遥感影像','about');
$this->view->nav[] = array('link'=>"/heihe/rs",'title'=>'遥感影像');
$this->_helper->viewRenderer('base');
@ -115,7 +115,7 @@ class HeiheController extends DataController
function waterAction()
{
$this->getmd('水文地质');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-水文水资源数据','about');
$this->view->nav[] = array('link'=>"/heihe/water",'title'=>'水文水资源数据');
$this->_helper->viewRenderer('base');
@ -124,7 +124,7 @@ class HeiheController extends DataController
function modelAction()
{
$this->getmd(array('WRF','NPP','SWAT','NEP','辐射'));
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-模型数据','about');
$this->view->nav[] = array('link'=>"/heihe/model",'title'=>'模型数据');
$this->_helper->viewRenderer('base');
@ -133,7 +133,7 @@ class HeiheController extends DataController
function economicAction()
{
$this->getmd(array('人口','社会经济'));
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-社会经济数据','about');
$this->view->nav[] = array('link'=>"/heihe/economic",'title'=>'社会经济数据');
$this->_helper->viewRenderer('base');
@ -142,7 +142,7 @@ class HeiheController extends DataController
function landsurfaceAction()
{
$this->getmd(array('冰川','沙漠','地貌','植被','草场','沙漠化'));
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-陆地表层数据','about');
$this->view->nav[] = array('link'=>"/heihe/landsurface",'title'=>'陆地表层数据');
$this->_helper->viewRenderer('base');
@ -151,7 +151,7 @@ class HeiheController extends DataController
function landuseAction()
{
$this->getmd('土地利用');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-土地利用数据','about');
$this->view->nav[] = array('link'=>"/heihe/landuse",'title'=>'土地利用数据');
$this->_helper->viewRenderer('base');
@ -160,7 +160,7 @@ class HeiheController extends DataController
function soilAction()
{
$this->getmd('土壤');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-土壤数据','about');
$this->view->nav[] = array('link'=>"/heihe/soil",'title'=>'土壤数据');
$this->_helper->viewRenderer('base');
@ -169,7 +169,7 @@ class HeiheController extends DataController
function meteoAction()
{
$this->getmd('气象');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-气象观测数据','about');
$this->view->nav[] = array('link'=>"/heihe/meteo",'title'=>'气象观测数据');
$this->_helper->viewRenderer('base');
@ -178,7 +178,7 @@ class HeiheController extends DataController
function hydroAction()
{
$this->getmd('水文观测');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-水文观测数据','about');
$this->view->nav[] = array('link'=>"/heihe/hydro",'title'=>'水文观测数据');
$this->_helper->viewRenderer('base');
@ -186,7 +186,7 @@ class HeiheController extends DataController
function irragationAction()
{
$this->getmd('灌溉');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-灌溉数据','about');
$this->view->nav[] = array('link'=>"/heihe/irragation",'title'=>'灌溉数据');
$this->_helper->viewRenderer('base');
@ -195,7 +195,7 @@ class HeiheController extends DataController
function obsAction()
{
$this->getmd('试验');
$archive = new Archive($this->db);
$archive = new Archive($this->db);
$this->view->info = $archive->getOneArchive('黑河计划-观测试验数据','about');
$this->view->nav[] = array('link'=>"/heihe/obs",'title'=>'观测试验数据');
$this->_helper->viewRenderer('base');
@ -207,30 +207,30 @@ class HeiheController extends DataController
$this->view->metadata=$this->db->fetchAll($sql);
}
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 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()
@ -311,63 +311,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);
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;
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;
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;
}
/*
@ -814,10 +814,10 @@ class HeiheController extends DataController
if($ac == "my")
{
//防止通过其它方式访问,先判断是否是登录用户,如果不是,抛出消息后强制用户退出
$auth = Zend_Auth::getInstance();
if(!$auth->hasIdentity())
$this->_redirect('/account/login?href=/heihe/projects/ac/my');
//防止通过其它方式访问,先判断是否是登录用户,如果不是,抛出消息后强制用户退出
$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';
}
@ -1077,134 +1077,134 @@ 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 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 {
//提供全部分类列表
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.fund_id asc";
$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');
}
group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by f.fund_id asc";
$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 {
//提供全部分类列表
}
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信息的浏览

View File

@ -46,7 +46,7 @@ class HiwaterController extends DataController
$this->view->pageIn = "collapse9";
}
$this->view->pageID = "hiwater-".$acName;
$this->_helper->layout->setLayout('heihe');
// $this->_helper->layout->setLayout('heihe');
}
function indexAction()

View File

@ -1,43 +1,82 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$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'=>"/data/category",'title'=>'分类浏览');
$this->headLink()->appendStylesheet('/static-sanji/css/data-list.css');
?>
<div class="row-fluid">
<?= $this->render('breadcrumbs.phtml'); ?>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<div class="row-fluid">
<h4>数据集类别</h4>
<ul class="nav nav-pills">
<?php foreach($this->category as $cg) : ?>
<li <?php if (!empty($this->metadata)) : if($cg['name'] == $this->codename || $cg['name_zh'] == $this->codename ){?> class="active" <?php } endif; ?>>
<a href='/data/category/code/<?php echo $cg['code']; ?>'><?php (empty($cg['name_zh']))?print($cg['name']):print($cg['name_zh']); ?>
<span class="note">(<?php echo $cg['count']; ?>)</span></a></li>
<?php endforeach; ?>
</ul>
</div>
<div class="row-fluid">
<?php if (!empty($this->metadata)) : ?>
<div id='metacontent'>
<h4>当前浏览:<?php echo $this->codename; ?></h4>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php foreach($this->metadata as $md) : ?>
<div class="media well well-small">
<a href="/service/bigthumb/uuid/<?= $md['uuid'] ?>" class="pull-left colorbox">
<img class="media-object" src="/service/thumb/id/<?php echo $md['id'];?>">
</a>
<div class="media-body">
<h4 class="media-heading"><a href="/data/<?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; ?>
<?php echo $this->page->getNavigation(); ?>
<hr class="c-f">
<div class="container">
<div class="row">
<div class="col-lg-12">
<?= $this->render('breadcrumbs.phtml'); ?>
</div>
</div>
<?php endif; ?>
<div class="row">
<div class="col-lg-12">
<?= $this->partial('data/tools.phtml'); ?>
</div>
</div>
</div>
<hr class="c-f">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h4>数据集类别</h4>
<ul class="nav nav-pills">
<?php foreach($this->category as $cg) : ?>
<li class="<?php if (!empty($this->metadata)) : if($cg['name'] == $this->codename || $cg['name_zh'] == $this->codename ){?> active <?php } endif; ?>" style="width: auto;">
<a href='/data/category/code/<?php echo $cg['code']; ?>'><?php (empty($cg['name_zh']))?print($cg['name']):print($cg['name_zh']); ?>
<span class="note">(<?php echo $cg['count']; ?>)</span></a></li>
<?php endforeach; ?>
</ul>
</div>
</div>
<?php if($this->paginator) { ?>
<div class="row">
<div class="col-lg-12">
<h4>当前浏览:<?php echo $this->codename; ?></h4>
<?php foreach($this->paginator as $md) : ?>
<div class="row">
<div class="col-lg-12 c-list">
<div class="col-md-3 c-img-box">
<div class="c-cover"></div>
<a class="c-cover" href="/data/<?php echo $md['uuid'];?>"></a>
<div class="c-img" style="background:url('/service/thumb/id/<?php echo $md['id'];?>') no-repeat center; background-size:cover"></div>
<!-- <a href="/service/bigthumb/uuid/--><?//= $md['uuid'] ?><!--" class="pull-left colorbox">-->
<!-- <img class="media-object" src="/service/thumb/id/--><?php //echo $md['id'];?><!--">-->
<!-- </a>-->
</div>
<div class="col-md-9 c-list-box">
<h4><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<p class="c-info"><span class="c-time"></span><i><?php echo date("d,M,Y",strtotime( $md['ts_published'] )); ?></i></p>
<p class="c-con">
<?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>200 ? $this->escape(mb_substr($md['description'],0,200,'UTF-8').'...'):$this->escape($md['description']));?>
</p>
<div class="dam clear">
<div class="c-left">
<i>文件大小</i>
<em><?php echo round($md['filesize'] / 2014, 2) > 0.99 ? round($md['filesize'] / 2014, 2) : '小于1'?>MB</em>
</div>
<a class="c-right" href="/data/<?php echo $md['uuid'];?>">更多</a>
</div>
</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="page">
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>
<?php } ?>
</div>

View File

@ -6,40 +6,81 @@ $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css');
$this->nav[] = array('link'=>"/data/series",'title'=>'数据集序列浏览');
$this->headLink()->appendStylesheet('/static-sanji/css/data-list.css');
?>
<div class="row-fluid">
<?= $this->render('breadcrumbs.phtml'); ?>
<?= $this->partial('data/tools.phtml'); ?>
<hr class="c-f">
<div class="container">
<div class="row">
<div class="col-lg-12">
<?= $this->render('breadcrumbs.phtml'); ?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<?= $this->partial('data/tools.phtml'); ?>
</div>
</div>
</div>
<div id='leftnav'>
<fieldset><legend>数据集序列</legend>
<ul>
<?php foreach($this->serie as $cg) : ?>
<li><a href='/data/series/<?php echo $cg['name']; ?>'><?php echo $cg['name']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endforeach; ?>
</ul></fieldset>
<?php if ($this->showtools) : ?>
<fieldset><legend>本序列中常用地点关键词</legend>
<ul>
<?php foreach($this->places as $place) : ?>
<li><a href='/data/series/<?php echo $this->seriesid; ?>/<?php echo urlencode($place['keyword']); ?>'><?php echo $place['keyword']; ?></a><span class="note">(<?php echo $place['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</fieldset>
<?php endif; ?>
<hr class="c-f">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div id='leftnav'>
<fieldset><legend>数据集序列</legend>
<ul>
<?php foreach($this->serie as $cg) : ?>
<li><a href='/data/series/<?php echo $cg['name']; ?>'><?php echo $cg['name']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php endforeach; ?>
</ul></fieldset>
<?php if ($this->showtools) : ?>
<fieldset><legend>本序列中常用地点关键词</legend>
<ul>
<?php foreach($this->places as $place) : ?>
<li><a href='/data/series/<?php echo $this->seriesid; ?>/<?php echo urlencode($place['keyword']); ?>'><?php echo $place['keyword']; ?></a><span class="note">(<?php echo $place['count']; ?>)</span></li>
<?php endforeach; ?>
</ul>
</fieldset>
<?php endif; ?>
</div>
<?php if($this->paginator) { ?>
<h4>当前浏览数据集序列:<?php echo $this->codename; ?></h4>
<?php foreach($this->paginator as $md) : ?>
<div class="row c-list">
<div class="col-md-3 c-img-box">
<div class="c-cover"></div>
<a class="c-cover" href="/data/<?php echo $md['uuid'];?>"></a>
<div class="c-img" style="background:url('/service/thumb/id/<?php echo $md['id'];?>') no-repeat center; background-size:cover"></div>
<!-- <a href="/service/bigthumb/uuid/--><?//= $md['uuid'] ?><!--" class="pull-left colorbox">-->
<!-- <img class="media-object" src="/service/thumb/id/--><?php //echo $md['id'];?><!--">-->
<!-- </a>-->
</div>
<div class="col-md-9 c-list-box">
<h4><a href="/data/<?php echo $md['uuid'];?>"><?php echo $this->escape($md['title']);?></a></h4>
<p class="c-info"><span class="c-click"></span><i><?php echo $md['viewed']?></i> | &nbsp;<span class="c-time"></span><i><?php echo date("d,M,Y",strtotime( $md['ts_published'] )); ?></i></p>
<p class="c-con">
<?php echo str_replace(array("\r\n", "\n", "\r"),'<br />',mb_strlen($md['description'])>200 ? $this->escape(mb_substr($md['description'],0,200,'UTF-8').'...'):$this->escape($md['description']));?>
</p>
<div class="dam clear">
<div class="c-left">
<i>文件大小</i>
<em><?php echo round($md['filesize'] / 2014, 2) > 0.99 ? round($md['filesize'] / 2014, 2) : '小于1'?>MB</em>
</div>
<a class="c-right" href="/data/<?php echo $md['uuid'];?>">更多</a>
</div>
</div>
</div>
<?php endforeach; ?>
<?php } ?>
</div>
</div>
<div class="row">
<div class="col-xs-12">
<div class="page">
<div class="pagenavi"><?= $this->paginator; ?></div>
</div>
</div>
</div>
</div>
<?php if (!empty($this->metadata)) : ?>
<div id='metacontent'>
<h1>当前浏览数据集序列:<?php echo $this->codename; ?></h1>
<?php echo $this->page->getNavigation(); ?>
<hr />
<?php foreach($this->metadata as $md) : ?>
<div class="mditem">
<div class="thumb"><img src="/service/thumb/id/<?php echo $md['id'];?>" /></div>
<h2><a href="/data/<?php echo $md['uuid']; ?>"><?php echo $this->escape($md['title']);?></a>
</h2>
<span><?php echo mb_strlen($md['description'])>400?$this->escape(mb_substr($md['description'],0,400,'UTF-8').'...'):$this->escape($md['description']);?></span>
</div>
<?php endforeach; echo $this->page->getNavigation(); ?>
</div>
<?php endif; ?>

View File

@ -43,6 +43,8 @@ $this->theme->AppendPlus($this,'jquery_ui');
</div>
</div>
<script type="text/javascript">
$(function() {
//jquery ui datepicker