#425 首页添加新闻的焦点轮播功能
This commit is contained in:
parent
11dd20a220
commit
c47de7ae12
|
@ -1,57 +1,75 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
class IndexController extends Zend_Controller_Action
|
class IndexController extends Zend_Controller_Action
|
||||||
{
|
{
|
||||||
function indexAction()
|
function preDispatch()
|
||||||
{
|
{
|
||||||
//数据通讯
|
$this->view->config = Zend_Registry::get('config');
|
||||||
$l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf");
|
$this->db=Zend_Registry::get('db');
|
||||||
$this->view->newsletter=$l->getLast();
|
$this->view->theme = new Theme();
|
||||||
$name=basename($this->view->newsletter,'.pdf');
|
}
|
||||||
list(,$this->view->newsletterno)=explode("_",$name);
|
|
||||||
//统计数据
|
function indexAction()
|
||||||
$sql='select (select count(*) from users) as usernum,(select count(*) from metadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
|
{
|
||||||
$row=$this->db->fetchRow($sql);
|
//数据通讯
|
||||||
$this->view->usernum=$row['usernum'];
|
$l=new mydir($this->view->config->paths->newsletter,"newsletter_*.pdf");
|
||||||
$this->view->metanum=$row['metanum'];
|
$this->view->newsletter=$l->getLast();
|
||||||
$this->view->offlinenum=$row['offlinenum'];
|
$name=basename($this->view->newsletter,'.pdf');
|
||||||
/*$sql='select count(*) from metadata';
|
list(,$this->view->newsletterno)=explode("_",$name);
|
||||||
$row=$this->db->fetchRow($sql);
|
//统计数据
|
||||||
$this->view->metanum=$row['count'];*/
|
$sql='select (select count(*) from users) as usernum,(select count(*) from metadata) as metanum,(select count(*) from offlineapp where ts_approved is not null ) as offlinenum';
|
||||||
$sql="select sum(filesize) as sum,datatype from metadata group by datatype";
|
$row=$this->db->fetchRow($sql);
|
||||||
$rows=$this->db->fetchAll($sql);
|
$this->view->usernum=$row['usernum'];
|
||||||
foreach($rows as $row)
|
$this->view->metanum=$row['metanum'];
|
||||||
{
|
$this->view->offlinenum=$row['offlinenum'];
|
||||||
if ($row['datatype'])
|
/*$sql='select count(*) from metadata';
|
||||||
$this->view->offlinesize=$row['sum'];
|
$row=$this->db->fetchRow($sql);
|
||||||
else
|
$this->view->metanum=$row['count'];*/
|
||||||
$this->view->onlinesize=$row['sum'];
|
$sql="select sum(filesize) as sum,datatype from metadata group by datatype";
|
||||||
}
|
$rows=$this->db->fetchAll($sql);
|
||||||
//特色推荐
|
foreach($rows as $row)
|
||||||
$sql="select * from datafeature order by id desc";
|
{
|
||||||
$this->view->feature=$this->db->fetchRow($sql);
|
if ($row['datatype'])
|
||||||
//特色数据集
|
$this->view->offlinesize=$row['sum'];
|
||||||
$sql="select * from datasetcd order by random()";
|
else
|
||||||
$this->view->datasetcd=$this->db->fetchRow($sql);
|
$this->view->onlinesize=$row['sum'];
|
||||||
//下载最多数据(top 5)
|
}
|
||||||
$sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)";
|
//特色推荐
|
||||||
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
$sql="select * from datafeature order by id desc";
|
||||||
$this->view->mdtop=$this->db->fetchAll($sql);
|
$this->view->feature=$this->db->fetchRow($sql);
|
||||||
$sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)";
|
//特色数据集
|
||||||
$this->view->offlinemdtop=$this->db->fetchAll($sql);
|
$sql="select * from datasetcd order by random()";
|
||||||
$sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()";
|
$this->view->datasetcd=$this->db->fetchRow($sql);
|
||||||
$this->view->mdrandom=$this->db->fetchRow($sql);
|
//下载最多数据(top 5)
|
||||||
//搜索
|
$sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=0 group by m.id order by count(d.uuid) desc limit 5)";
|
||||||
$this->view->addHelperPath('helper','Zend_View_Helper_');
|
$this->db->setFetchMode(Zend_Db::FETCH_OBJ);
|
||||||
$searchform=new SearchForm();
|
$this->view->mdtop=$this->db->fetchAll($sql);
|
||||||
//$searchform->removeElement('submit');
|
$sql="select uuid,title,id from normalmetadata where id in (select m.id from normalmetadata m left join dataorder d on m.uuid=d.uuid where m.datatype=1 group by m.id order by count(d.uuid) desc limit 5)";
|
||||||
$this->view->searchform=$searchform;
|
$this->view->offlinemdtop=$this->db->fetchAll($sql);
|
||||||
}
|
$sql="select m.uuid,m.title,m.id,m.description from normalmetadata m left join thumbnail t on m.id=t.id where length(t.data)>2 order by random()";
|
||||||
function preDispatch()
|
$this->view->mdrandom=$this->db->fetchRow($sql);
|
||||||
{
|
//搜索
|
||||||
$this->view->config = Zend_Registry::get('config');
|
$this->view->addHelperPath('helper','Zend_View_Helper_');
|
||||||
$this->db=Zend_Registry::get('db');
|
$searchform=new SearchForm();
|
||||||
}
|
//$searchform->removeElement('submit');
|
||||||
|
$this->view->searchform=$searchform;
|
||||||
}
|
|
||||||
|
$News = new Archive($this->db);
|
||||||
|
|
||||||
|
$time = date("Y-m-d H:i:s",time());
|
||||||
|
$sql = "SELECT * FROM archive WHERE is_pub=true AND ts_published<'$time' AND image!='' LIMIT 5";
|
||||||
|
$sth = $this->db->query($sql);
|
||||||
|
$rows = $sth->fetchAll(PDO::FETCH_BOTH);
|
||||||
|
|
||||||
|
foreach($rows as $k=>$v)
|
||||||
|
{
|
||||||
|
$url = $News->getArchiveUrlByCid($v['id']);
|
||||||
|
$rows[$k]['url'] = $url['archive_url'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->view->news = $rows;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
$this->headTitle('首页');
|
$this->headTitle('首页');
|
||||||
$this->headTitle()->setSeparator(' - ');
|
$this->headTitle()->setSeparator(' - ');
|
||||||
$this->headLink()->appendStylesheet('/css/index.css');
|
$this->headLink()->appendStylesheet('/css/index.css');
|
||||||
|
$this->theme->AppendPlus($this,'jquery');
|
||||||
|
$this->theme->AppendPlus($this,'slides');
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = Zend_Auth::getInstance();
|
||||||
?>
|
?>
|
||||||
<div id="index">
|
<div id="index">
|
||||||
|
@ -101,16 +103,21 @@
|
||||||
|
|
||||||
<div id="rightPanel">
|
<div id="rightPanel">
|
||||||
<div id="feature">
|
<div id="feature">
|
||||||
<div class="alpha-shadow">
|
<div id="slides">
|
||||||
<div><img src="<?= $this->feature['imgurl']; ?>" alt="特色数据集" style="border-width:1px;border-style:solid;" /></div>
|
<div class="slides_container">
|
||||||
</div>
|
<?php
|
||||||
|
foreach($this->news as $k=>$v)
|
||||||
<div class="title"><?= $this->feature['title']; ?></div>
|
{
|
||||||
<div class="description">
|
echo '<div class="slide">'.
|
||||||
<?= $this->feature['description']; ?>
|
'<div class="thumb"><img src="'.$v['image'].'" /></div>'.
|
||||||
</div>
|
'<div class="description"><h2><a href="'.$v['url'].'">'.$v['title'].'</a></h2>'.
|
||||||
<span class="more"><a href="/data/feature" >以往推荐</a></span>
|
''.$v['description'].'</div>'.
|
||||||
<span id="links"><a href="<?= $this->feature['detailurl']; ?>">详细</a></span>
|
''.
|
||||||
|
'</div>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="itemCd">
|
<div id="itemCd">
|
||||||
<div class="alpha-shadow" id="image"><img src="<?= $this->datasetcd['img']; ?>" /></div>
|
<div class="alpha-shadow" id="image"><img src="<?= $this->datasetcd['img']; ?>" /></div>
|
||||||
|
@ -144,5 +151,16 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
<script>
|
||||||
|
var startSlide = 1;
|
||||||
|
$('#slides').slides({
|
||||||
|
preload: true,
|
||||||
|
preloadImage: 'images/loading.gif',
|
||||||
|
generatePagination: true,
|
||||||
|
play: 5000,
|
||||||
|
pause: 2500,
|
||||||
|
hoverPause: true,
|
||||||
|
start: startSlide
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -68,4 +68,10 @@ textarea {resize: none}
|
||||||
.span3{width:200px;}
|
.span3{width:200px;}
|
||||||
|
|
||||||
.input_arae{ margin:5px 0;}
|
.input_arae{ margin:5px 0;}
|
||||||
.map_display_part{width:500px;height:300px;float:left;}
|
.map_display_part{width:500px;height:300px;float:left;}
|
||||||
|
|
||||||
|
.auto-complete-elements{height:140px;position:absolute;z-index:999;background:#FFF;border:1px solid #ccc; padding:2px;}
|
||||||
|
.auto-complete-elements ul{height:120px;overflow-y:scroll;}
|
||||||
|
.auto-complete-elements ul li{line-height:18px; cursor:pointer;height:18px; overflow:hidden;border:1px solid #FFF;}
|
||||||
|
.auto-complete-elements ul li:hover{height:18px;line-height:18px; border:1px solid #dedede;}
|
||||||
|
.auto-complete-elements .close-btn{height:18px;line-height:18px;border:1px solid #ccc;cursor:pointer; text-align:center}
|
|
@ -114,6 +114,7 @@ input:focus,textarea:focus {
|
||||||
-webkit-focus-ring-color:none;
|
-webkit-focus-ring-color:none;
|
||||||
border-color:#c4c4c4;
|
border-color:#c4c4c4;
|
||||||
background-color:#FFFFF0;
|
background-color:#FFFFF0;
|
||||||
|
border-radius:3px;
|
||||||
}
|
}
|
||||||
fieldset {border:0 none;border-top:1px solid #ddd;margin:10px 0;padding:10px 0;}
|
fieldset {border:0 none;border-top:1px solid #ddd;margin:10px 0;padding:10px 0;}
|
||||||
legend {background:#fff;color:#93BB3A;font-weight:bold; padding:0 6px 0 0;}
|
legend {background:#fff;color:#93BB3A;font-weight:bold; padding:0 6px 0 0;}
|
||||||
|
|
|
@ -147,17 +147,23 @@ color:Green; text-decoration:none;
|
||||||
#dataLink ul{padding:5px 0;}
|
#dataLink ul{padding:5px 0;}
|
||||||
#rightPanel #dataLink a{font-weight: bold;}
|
#rightPanel #dataLink a{font-weight: bold;}
|
||||||
|
|
||||||
/*数据CD开始*/
|
/*新闻*/
|
||||||
#itemCd{ margin-top: 10px; border-bottom:1px dotted gray; overflow:hidden;}
|
#itemCd{ margin-top: 10px; border-bottom:1px dotted gray; overflow:hidden;}
|
||||||
#itemCd img { margin-top:-5px;margin-left:-5px;width:100px;height:100px;border-width:1px;border-style:solid;}
|
|
||||||
#itemCd #image{float: left; width: 110px; height: 105px;}
|
|
||||||
#itemCd #title{font-size: 105%; font-weight: bold; font-family: Tahoma; }
|
|
||||||
#itemCd #filesize{color: Gray;font-size: 95%;}
|
|
||||||
#itemCd #descript{margin: 10px 2% 5px 0px; font-family: Verdana;}
|
|
||||||
#itemCd #descript #intro {font-style: italic;}
|
|
||||||
#itemCd #link {margin-bottom: 10px;}
|
|
||||||
|
|
||||||
#dataLink ul{display:inline;float:left;list-style-type: none;margin-top:-5px;}
|
#dataLink ul{display:inline;float:left;list-style-type: none;margin-top:-5px;}
|
||||||
input{background:#ECF0F5;margin-bottom:6px;}
|
input{background:#ECF0F5;margin-bottom:6px;}
|
||||||
dd,dt{margin:0;}
|
dd,dt{margin:0;}
|
||||||
#dataLink dd {padding-bottom:5px;margin-left:5px;margin-top:-5px;}
|
#dataLink dd {padding-bottom:5px;margin-left:5px;margin-top:-5px;}
|
||||||
|
|
||||||
|
#slides {overflow:hidden;}
|
||||||
|
#slides .slide{width:520px;}
|
||||||
|
#slides .slide { overflow:hidden;}
|
||||||
|
#slides .slide .thumb {float:left; overflow:hidden;}
|
||||||
|
#slides .slide .thumb img{max-height:150px;border:1px solid #CCC;padding:2px;margin:0 5px 0 0;}
|
||||||
|
#slides .slide .ctitle {float:left;overflow:hidden;}
|
||||||
|
#slides .slide .ctitle h2{font-weight:bold;display:block}
|
||||||
|
#slides .slide .description{float:left;}
|
||||||
|
#slides .pagination {}
|
||||||
|
#slides .pagination li{width:10px;height:16px;padding:2px;float:left;}
|
||||||
|
#slides .pagination li.current{background:#dedede;color:#FFF}
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue