修改 首页最新数据集
This commit is contained in:
parent
c09dbfa3b2
commit
fd06b7bb69
|
@ -1,17 +1,14 @@
|
|||
<?php
|
||||
|
||||
class IndexController extends Zend_Controller_Action
|
||||
{
|
||||
function preDispatch()
|
||||
{
|
||||
class IndexController extends Zend_Controller_Action {
|
||||
function preDispatch () {
|
||||
$this->view->config = Zend_Registry::get('config');
|
||||
$this->db = Zend_Registry::get('db');
|
||||
$this->view->theme = new Theme();
|
||||
$this->view->main_nav_pageID = "index";
|
||||
}
|
||||
|
||||
function indexAction()
|
||||
{
|
||||
function indexAction () {
|
||||
//数据通讯
|
||||
$l = new mydir($this->view->config->paths->newsletter, "newsletter_*.pdf");
|
||||
$this->view->newsletter = $l->getLast();
|
||||
|
@ -28,11 +25,8 @@ class IndexController extends Zend_Controller_Action
|
|||
$this->view->metanum=$row['count'];*/
|
||||
$sql = "select sum(filesize) as sum,datatype from normalmetadata group by datatype";
|
||||
$rows = $this->db->fetchAll($sql);
|
||||
foreach($rows as $row)
|
||||
{
|
||||
if ($row['datatype'])
|
||||
$this->view->offlinesize=$row['sum'];
|
||||
else
|
||||
foreach ($rows as $row) {
|
||||
if ($row['datatype']) $this->view->offlinesize = $row['sum']; else
|
||||
$this->view->onlinesize = $row['sum'];
|
||||
}
|
||||
//特色推荐
|
||||
|
@ -62,8 +56,7 @@ class IndexController extends Zend_Controller_Action
|
|||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll(PDO::FETCH_BOTH);
|
||||
|
||||
foreach($rows as $k=>$v)
|
||||
{
|
||||
foreach ($rows as $k => $v) {
|
||||
$url = $News->getArchiveUrlByCid($v['id']);
|
||||
$rows[$k]['url'] = $url['archive_url'];
|
||||
}
|
||||
|
@ -75,8 +68,7 @@ class IndexController extends Zend_Controller_Action
|
|||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll(PDO::FETCH_BOTH);
|
||||
|
||||
foreach($rows as $k=>$v)
|
||||
{
|
||||
foreach ($rows as $k => $v) {
|
||||
$url = $News->getArchiveUrlByCid($v['id']);
|
||||
$rows[$k]['url'] = $url['archive_url'];
|
||||
$rows[$k]['type_title'] = $url['type_title'];
|
||||
|
@ -89,6 +81,15 @@ class IndexController extends Zend_Controller_Action
|
|||
$sth = $this->db->query($sql);
|
||||
$this->view->dois = $sth->fetchAll();
|
||||
|
||||
|
||||
/**
|
||||
* 最新数据集
|
||||
*/
|
||||
$sql = "SELECT md.title,md.uuid FROM metadata md ORDER BY md.id DESC LIMIT 6";
|
||||
$sth = $this->db->query($sql);
|
||||
$rows = $sth->fetchAll(PDO::FETCH_BOTH);
|
||||
|
||||
$this->view->latest_metadata = $rows;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,26 +64,39 @@ $this->headLink()->appendStylesheet('/css/index.css');
|
|||
<div class="data-list span4">
|
||||
<ul class="unstyled">
|
||||
<li>
|
||||
<a href="/data/<?php echo $this->mdtop[0]->uuid; ?>"><?php echo $this->mdtop[0]->title; ?></a>
|
||||
<a href="/data/<?= $this->latest_metadata[0]['uuid']; ?>"
|
||||
title="<?= $this->latest_metadata[0]['title']; ?>">
|
||||
<?= mb_substr($this->latest_metadata[0]['title'], 0, 26, 'utf-8'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/data/<?php echo $this->mdtop[1]->uuid; ?>"><?php echo $this->mdtop[1]->title; ?></a>
|
||||
<a href="/data/<?= $this->latest_metadata[1]['uuid']; ?>"
|
||||
title="<?= $this->latest_metadata[1]['title']; ?>">
|
||||
<?= mb_substr($this->latest_metadata[1]['title'], 0, 26, 'utf-8'); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/data/<?php echo $this->mdtop[2]->uuid; ?>"><?php echo $this->mdtop[2]->title; ?></a>
|
||||
<a href="/data/<?= $this->latest_metadata[2]['uuid']; ?>"
|
||||
title="<?= $this->latest_metadata[2]['title']; ?>">
|
||||
<?= mb_substr($this->latest_metadata[2]['title'], 0, 26, 'utf-8'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="data-list">
|
||||
<ul class="unstyled">
|
||||
<li>
|
||||
<a href="/data/<?php echo $this->mdtop[3]->uuid; ?>"><?php echo $this->mdtop[3]->title; ?></a>
|
||||
<a href="/data/<?= $this->latest_metadata[3]['uuid']; ?>"
|
||||
title="<?= $this->latest_metadata[3]['title']; ?>">
|
||||
<?= mb_substr($this->latest_metadata[3]['title'], 0, 26, 'utf-8'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/data/<?php echo $this->mdtop[4]->uuid; ?>"><?php echo $this->mdtop[4]->title; ?></a>
|
||||
<a href="/data/<?= $this->latest_metadata[4]['uuid']; ?>"
|
||||
title="<?= $this->latest_metadata[4]['title']; ?>">
|
||||
<?= mb_substr($this->latest_metadata[4]['title'], 0, 26, 'utf-8'); ?>
|
||||
</li>
|
||||
<li>
|
||||
<a href="/data/<?php echo $this->mdtop[5]->uuid; ?>"><?php echo $this->mdtop[5]->title; ?></a>
|
||||
<a href="/data/<?= $this->latest_metadata[5]['uuid']; ?>"
|
||||
title="<?= $this->latest_metadata[5]['title']; ?>">
|
||||
<?= mb_substr($this->latest_metadata[4]['title'], 0, 26, 'utf-8'); ?>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue