设置为分栏目显示

This commit is contained in:
wlx 2014-01-14 02:16:49 +00:00
parent 3967c23ecb
commit ed6d450d4a
5 changed files with 130 additions and 9 deletions

View File

@ -31,9 +31,55 @@ class HaiheController extends DataController
$this->view->offset=$offset+1; $this->view->offset=$offset+1;
} }
function daxingAction()
{
$this->getmd(array('大兴区'));
$this->_helper->viewRenderer('base');
}
function miyunAction()
{
$this->getmd(array('密云'));
$this->_helper->viewRenderer('base');
}
function guantaoAction()
{
$this->getmd(array('馆陶县'));
$this->_helper->viewRenderer('base');
}
function viewAction() function viewAction()
{ {
parent::viewAction(); parent::viewAction();
$this->_helper->viewRenderer('haihe/view'); $this->_helper->viewRenderer('haihe/view');
} }
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='haihe' 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='haihe') and id in (select id from keyword where keytype='".$type."' and keyword in ".$keyword.") order by 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;
}
} }

View File

@ -0,0 +1,30 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle()->setSeparator(' - ');
$this->headLink()->appendStylesheet('/css/water.css');
$this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集');
?>
<?= $this->render('breadcrumbs.phtml'); ?>
<div class="row">
<div class="span2">
<?= $this->partial('haihe/navi.phtml'); ?>
</div>
<div class="span10">
<?php if ($this->info) : ?>
<div class="well">
<?php if(!empty($this->info['body'])) echo $this->info['body'];?>
</div>
<?php endif; ?>
<?php if ($this->metadata) : ?>
<?php echo $this->page->getNavigation(); ?>
<div id="mdlist">
<ol start="<?php echo $this->offset; ?>">
<?php foreach($this->metadata as $md) : ?>
<li><a href="/haihe/view/uuid/<?php echo $md['uuid']; ?>"><?php echo $md['title']; ?></a></li>
<?php endforeach; ?>
</ol>
</div>
<?php endif; ?>
</div>
</div>

View File

@ -10,8 +10,11 @@ $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集');
?> ?>
<?= $this->render('breadcrumbs.phtml'); ?> <?= $this->render('breadcrumbs.phtml'); ?>
<div class="row"> <div class="row">
<div class="span12"> <div class="span2">
<?= $this->partial('haihe/navi.phtml'); ?>
</div>
<div class="span10">
<h3>数据相关文献</h3> <h3>数据相关文献</h3>
<?php if ($this->refs) : ?> <?php if ($this->refs) : ?>
<?php echo $this->page->getNavigation(); ?> <?php echo $this->page->getNavigation(); ?>

View File

@ -7,7 +7,11 @@ $this->nav[] = array('link'=>"/haihe",'title'=>'海河流域观测数据集');
?> ?>
<?= $this->render('breadcrumbs.phtml'); ?> <?= $this->render('breadcrumbs.phtml'); ?>
<div class="row"> <div class="row">
<div class="span12"> <div class="span2">
<?= $this->partial('haihe/navi.phtml'); ?>
</div>
<div class="span10">
<div id="intro"> <div id="intro">
<h1><?php if(!empty($this->info['title'])) echo $this->info['title']; ?></h1> <h1><?php if(!empty($this->info['title'])) echo $this->info['title']; ?></h1>
<table> <table>

View File

@ -0,0 +1,38 @@
<div id="side_accordion" class="accordion">
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-haihe-index">
<a class="accordion-toggle" href="/haihe/">
介绍
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-haihe-daxing">
<a class="accordion-toggle" href="/haihe/daxing">
大兴站
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-haihe-miyun">
<a class="accordion-toggle" href="/haihe/miyun">
密云站
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-haihe-guantao">
<a class="accordion-toggle" href="/haihe/guantao">
馆陶站
</a>
</div>
</div>
<div class="accordion-group heihe-accordion-title">
<div class="accordion-heading" id="Nav-haihe-document">
<a class="accordion-toggle" href="/haihe/document">
数据文献
</a>
</div>
</div>
</div>