初步实现项目支持的浏览

This commit is contained in:
wlx 2013-04-29 16:07:34 +00:00
parent 594d31cfba
commit 02395fe9ae
2 changed files with 60 additions and 0 deletions

View File

@ -1966,6 +1966,39 @@ class DataController extends Zend_Controller_Action
} else {
//提供全部分类列表
}
}
function fundAction()
{
$id = (int)$this->_request->getParam('id');
if (!empty($id)) {
$sql="select * from fund where id=?";
$this->view->fund=$this->db->fetch($sql,array($id));
if ($this->view->fund) {
$sql="select distinct m.* from normalmetadata m left join mdfund mf on m.uuid=mf.uuid where 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 from fund f left join mdfund m on f.id=m.fid group by f.id,f.title,f.fund_id,f.fund_type,f.ts_created order by f.ts_created desc";
$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');
}
}
}

View File

@ -0,0 +1,27 @@
<?php
$this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->data);
$this->headTitle('支持项目');
$this->headTitle()->setSeparator(' - ');
$this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/data">'.$this->config->title->data.'</a>');
$this->breadcrumb('<a href="/data/fund">支持项目</a>');
$this->breadcrumb()->setSeparator(' > ');
?>
<div id='row-fluid'>
<div><?= $this->breadcrumb() ?> </div>
<?= $this->partial('data/tools.phtml'); ?>
</div>
<?php if (!empty($this->paginator)) : ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php foreach($this->paginator as $md) : ?>
<div class="well">
<h4><a href="/data/fund/id/<?php echo $md['id'];?>"><?php echo $this->escape($md['title']);?></a></h4>
编号:<?php echo $md['fund_id']; ?> | 类型:<?php echo $md['fund_type']; ?>
</div>
<?php endforeach; ?>
<div class="pagenavi"><?= $this->paginator; ?></div>
<?php else : ?>
暂无对应信息。
<?php endif; ?>