fix the bug in author contorller

This commit is contained in:
Li Jianxuan 2013-04-24 10:35:53 +00:00
parent d2e3a4ad33
commit bb4eacce87
3 changed files with 116 additions and 118 deletions

View File

@ -1595,14 +1595,11 @@ class AuthorController extends Zend_Controller_Action
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($uuid)); $sth->execute(array($uuid));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll(PDO::FETCH_BOTH);
$paginator = Zend_Paginator::factory($rows); include_once("helper/view.php");
$paginator->setCurrentPageNumber($this->_getParam('page')); view::addPaginator($rows,$this->view,$this->_request);
$paginator->setItemCountPerPage(10); $this->view->datas = $rows;
$paginator->setView($this->view);
Zend_View_Helper_PaginationControl::setDefaultViewPartial('pagination_param.phtml');
$this->view->paginator=$paginator;
}else{ }else{
$this->view->error = "参数有误"; $this->view->error = "参数有误";
} }

View File

@ -26,10 +26,12 @@ $this->breadcrumb()->setSeparator(' > ');
<div> <div>
<h2>根据已有数据创建元数据</h2> <h2>根据已有数据创建元数据</h2>
<div class="input-append">
<form id="datasearch" class="search_form" action="/author/newdata/ac/add-by-data"> <form id="datasearch" class="search_form" action="/author/newdata/ac/add-by-data">
<input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" /> <input type="text" id="keyword" name="q" value="<?php if(!empty($this->q)) echo $this->q; ?>" />
<button type="submit" class="btn" id="search_btn">搜索</button> <button type="submit" class="btn" id="search_btn">搜索</button>
</form> </form>
</div>
<?php <?php
if (count($this->paginator)): if (count($this->paginator)):
echo '<ul class="unstyled">'; echo '<ul class="unstyled">';

View File

@ -2,7 +2,6 @@
$this->headTitle($this->config->title->site); $this->headTitle($this->config->title->site);
$this->headTitle($this->config->title->author); $this->headTitle($this->config->title->author);
$this->headTitle()->setSeparator(' - '); $this->headTitle()->setSeparator(' - ');
$this->headScript()->appendFile('/js/jquery-1.7.min.js');
$this->headLink()->appendStylesheet('/css/author.css'); $this->headLink()->appendStylesheet('/css/author.css');
$this->breadcrumb('<a href="/">首页</a>'); $this->breadcrumb('<a href="/">首页</a>');
$this->breadcrumb('<a href="/author">数据作者</a>'); $this->breadcrumb('<a href="/author">数据作者</a>');
@ -21,7 +20,7 @@ $this->breadcrumb()->setSeparator(' > ');
echo $this->error; echo $this->error;
} }
?> ?>
<h3><a href="/data/<?php echo $this->paginator[0]['uuid']; ?>"><?php echo $this->paginator[0]['title']; ?></a> </h3> <h3><a href="/data/<?php echo $this->datas[0]['uuid']; ?>"><?php echo $this->datas[0]['title']; ?></a> </h3>
<div class="well"> <div class="well">
<?php <?php
if (count($this->paginator)): if (count($this->paginator)):