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

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ htdocs/upload/
htdocs/images/captcha/ htdocs/images/captcha/
geonetwork/ geonetwork/
.DS_Store .DS_Store
time1.xml
time.xml

View File

@ -258,6 +258,8 @@ class DataController extends Zend_Controller_Action
*/ */
function seriesAction() function seriesAction()
{ {
$this->_helper->layout->setLayout('layout-sanji');
$id = $this->_request->getParam('id'); $id = $this->_request->getParam('id');
if (empty($id)) $id=0; if (empty($id)) $id=0;
if (!is_numeric($id)) if (!is_numeric($id))
@ -302,10 +304,17 @@ class DataController extends Zend_Controller_Action
} }
$sum=$row[0]['count']; $sum=$row[0]['count'];
$select=$this->db->select(); $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); 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->showtools=($sum>$page)?true:false;
//$this->view->form=new SearchForm(); //$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); $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() function categoryAction()
{ {
$this->_helper->layout->setLayout('layout-sanji');
$page = $this->_request->getParam('page'); $page = $this->_request->getParam('page');
$code = (int)$this->_request->getParam('code'); $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'); $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) { if ($code>0 && $code<20) {
$where=$this->db->quoteInto('code = ?',$code); $where=$this->db->quoteInto('code = ?',$code);
$row=$this->db->fetchRow("select * from categorycode where ".$where); $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=?'; $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)); $row=$this->db->fetchRow($sql,array($code));
$sum=$row['count']; $sum=$row['count'];
$select=$this->db->select(); $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); $select->from('normalmetadata as m','*')
$this->view->metadata=$this->db->fetchAll($select); ->joinLeft('category as c','m.id=c.id')
$this->view->page=new Pagination($sum,$page,$this->limit);
->where('c.code=?',$code)
->order('m.title')
->limitPage($page,$this->limit);
view::addTextPaginator($select, $this);
} else { } else {
//提供全部分类列表 //提供全部分类列表
} }
@ -347,6 +363,8 @@ class DataController extends Zend_Controller_Action
*/ */
function timelineAction() function timelineAction()
{ {
$this->_helper->layout->setLayout('layout-sanji');
$fn="time1.xml"; $fn="time1.xml";
$rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1"); $rows=$this->db->fetchAll("select ts_created from normalmetadata order by ts_created desc limit 1");
$last_update=strtotime($rows[0]['ts_created']); $last_update=strtotime($rows[0]['ts_created']);

View File

@ -9,7 +9,7 @@ class HeiheController extends DataController
$this->debug = 1; $this->debug = 1;
$this->view->pageID = "heihe-".$this->_request->getActionName(); $this->view->pageID = "heihe-".$this->_request->getActionName();
$this->view->nav[] = array('link'=>"/heihe",'title'=>'黑河计划数据管理中心'); $this->view->nav[] = array('link'=>"/heihe",'title'=>'黑河计划数据管理中心');
$this->_helper->layout->setLayout('heihe'); // $this->_helper->layout->setLayout('heihe');
} }
function indexAction() function indexAction()

View File

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

View File

@ -1,43 +1,82 @@
<?php <?php
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data); $this->headTitle($this->config->title->data);
$this->headTitle('分类浏览'); $this->headTitle('分类浏览');
if (!empty($this->codename)) $this->headTitle($this->codename); if (!empty($this->codename)) $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->nav[] = array('link'=>"/data/category",'title'=>'分类浏览'); $this->nav[] = array('link'=>"/data/category",'title'=>'分类浏览');
$this->headLink()->appendStylesheet('/static-sanji/css/data-list.css');
?> ?>
<div class="row-fluid"> <hr class="c-f">
<div class="container">
<div class="row">
<div class="col-lg-12">
<?= $this->render('breadcrumbs.phtml'); ?> <?= $this->render('breadcrumbs.phtml'); ?>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<?= $this->partial('data/tools.phtml'); ?> <?= $this->partial('data/tools.phtml'); ?>
</div>
</div>
</div> </div>
<div class="row-fluid"> <hr class="c-f">
<div class="container">
<div class="row">
<div class="col-lg-12">
<h4>数据集类别</h4> <h4>数据集类别</h4>
<ul class="nav nav-pills"> <ul class="nav nav-pills">
<?php foreach($this->category as $cg) : ?> <?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; ?>> <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']); ?> <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> <span class="note">(<?php echo $cg['count']; ?>)</span></a></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </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(); ?>
</div> </div>
<?php endif; ?> </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> </div>

View File

@ -6,40 +6,81 @@ $this->headTitle($this->codename);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/metadata.css'); $this->headLink()->appendStylesheet('/css/metadata.css');
$this->nav[] = array('link'=>"/data/series",'title'=>'数据集序列浏览'); $this->nav[] = array('link'=>"/data/series",'title'=>'数据集序列浏览');
$this->headLink()->appendStylesheet('/static-sanji/css/data-list.css');
?> ?>
<div class="row-fluid"> <hr class="c-f">
<?= $this->render('breadcrumbs.phtml'); ?> <div class="container">
<?= $this->partial('data/tools.phtml'); ?> <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>
<div id='leftnav'> <hr class="c-f">
<fieldset><legend>数据集序列</legend>
<ul> <div class="container">
<?php foreach($this->serie as $cg) : ?> <div class="row">
<li><a href='/data/series/<?php echo $cg['name']; ?>'><?php echo $cg['name']; ?></a>(<?php echo $cg['count']; ?>)</li> <div class="col-lg-12">
<?php endforeach; ?> <div id='leftnav'>
</ul></fieldset> <fieldset><legend>数据集序列</legend>
<?php if ($this->showtools) : ?> <ul>
<fieldset><legend>本序列中常用地点关键词</legend> <?php foreach($this->serie as $cg) : ?>
<ul> <li><a href='/data/series/<?php echo $cg['name']; ?>'><?php echo $cg['name']; ?></a>(<?php echo $cg['count']; ?>)</li>
<?php foreach($this->places as $place) : ?> <?php endforeach; ?>
<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> </ul></fieldset>
<?php endforeach; ?> <?php if ($this->showtools) : ?>
</ul> <fieldset><legend>本序列中常用地点关键词</legend>
</fieldset> <ul>
<?php endif; ?> <?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> </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>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$(function() { $(function() {
//jquery ui datepicker //jquery ui datepicker