update pagination

This commit is contained in:
jack 2018-05-12 16:40:01 +08:00
parent f30ff25a53
commit f81566f050
3 changed files with 18 additions and 22 deletions

View File

@ -104,7 +104,7 @@ class DataController extends Zend_Controller_Action
$select->from('normalmetadata','*')->joinLeft('mdstat','normalmetadata.uuid=mdstat.uuid', ['viewed','downloaded'])->where('datatype=0')->order('title')->limitPage($page,$limit); $select->from('normalmetadata','*')->joinLeft('mdstat','normalmetadata.uuid=mdstat.uuid', ['viewed','downloaded'])->where('datatype=0')->order('title')->limitPage($page,$limit);
$this->view->metadata = $this->db->fetchAll($select); $this->view->metadata = $this->db->fetchAll($select);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
} }
function offlinelistAction() function offlinelistAction()
{ {
@ -118,7 +118,7 @@ class DataController extends Zend_Controller_Action
$select=$this->db->select(); $select=$this->db->select();
$select->from('normalmetadata','*')->joinLeft('mdstat','normalmetadata.uuid=mdstat.uuid', ['viewed','downloaded'])->where('datatype=1')->order('title')->limitPage($page,$limit); $select->from('normalmetadata','*')->joinLeft('mdstat','normalmetadata.uuid=mdstat.uuid', ['viewed','downloaded'])->where('datatype=1')->order('title')->limitPage($page,$limit);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
} }
//展示最近20条离线神情记录情况 //展示最近20条离线神情记录情况
function offlineappAction() function offlineappAction()
@ -205,7 +205,7 @@ class DataController extends Zend_Controller_Action
$select=$this->db->select(); $select=$this->db->select();
$select->from('metadata','*')->joinLeft('mdstat','metadata.uuid=mdstat.uuid', ['viewed','downloaded'])->order('id desc')->limitPage($page,$limit); $select->from('metadata','*')->joinLeft('mdstat','metadata.uuid=mdstat.uuid', ['viewed','downloaded'])->order('id desc')->limitPage($page,$limit);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
} }
function tagAction() function tagAction()
@ -246,7 +246,7 @@ class DataController extends Zend_Controller_Action
//$state=$db->query($sql); //$state=$db->query($sql);
$this->view->metadata=$this->db->fetchAll($select); $this->view->metadata=$this->db->fetchAll($select);
// $this->view->page=new Pagination($sum,$page,$limit); // $this->view->page=new Pagination($sum,$page,$limit);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
} }
} }
/* /*
@ -306,7 +306,7 @@ class DataController extends Zend_Controller_Action
->limitPage($page,$limit); ->limitPage($page,$limit);
if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword); if (!empty($keyword)) $select->join('keyword','keyword.id=normalmetadata.id')->where('keyword.keyword=?',$keyword);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
//$this->view->showtools=($sum>$page)?true:false; //$this->view->showtools=($sum>$page)?true:false;
@ -344,7 +344,7 @@ class DataController extends Zend_Controller_Action
->where('c.code=?',$code) ->where('c.code=?',$code)
->order('m.title') ->order('m.title')
->limitPage($page,$this->limit); ->limitPage($page,$this->limit);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
} else { } else {
//提供全部分类列表 //提供全部分类列表
} }
@ -1989,7 +1989,7 @@ where ds.uuid=? )) ) a ) p on r.id=p.refid order by p.place";
$select->from('normalmetadata as m','m.*') $select->from('normalmetadata as m','m.*')
->order('m.title desc')->limitPage($page,9); ->order('m.title desc')->limitPage($page,9);
view::addTextPaginator($select, $this); view::addPaginator($select, $this);
} }
/* /*
@ -2168,7 +2168,7 @@ where ds.uuid=? )) ) a ) p on r.id=p.refid order by p.place";
$sth->execute(array($name)); $sth->execute(array($name));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
view::addTextPaginator($rows, $this); view::addPaginator($rows, $this);
} else { } else {
//提供全部分类列表 //提供全部分类列表
} }
@ -2261,7 +2261,7 @@ where ds.uuid=? )) ) a ) p on r.id=p.refid order by p.place";
$sth->execute(array($id)); $sth->execute(array($id));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
view::addTextPaginator($rows, $this); view::addPaginator($rows, $this);
} else { } else {
//已经认证过的数据作者 //已经认证过的数据作者
$sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname"; $sql="select u.username,u.realname,u.id,count(u.id) as count from mdauthor a left join users u on a.userid=u.id where a.status=1 and a.uuid in (select uuid from normalmetadata) group by u.id,u.username,u.realname";
@ -2269,7 +2269,7 @@ where ds.uuid=? )) ) a ) p on r.id=p.refid order by p.place";
$sth->execute(); $sth->execute();
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
view::addTextPaginator($rows, $this); view::addPaginator($rows, $this);
} }
} else if ($ac=='unverified' || empty($ac)) { } else if ($ac=='unverified' || empty($ac)) {
//未认证的数据作者 //未认证的数据作者
@ -2283,14 +2283,14 @@ where ds.uuid=? )) ) a ) p on r.id=p.refid order by p.place";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(array($id)); $sth->execute(array($id));
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
view::addTextPaginator($rows, $this); view::addPaginator($rows, $this);
} else { } else {
//列出所有作者 //列出所有作者
$sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')"; $sql="select distinct responsible.individual as username,responsible.id from responsible left join role on role.resid=responsible.id where role.role in ('pointOfContact','resourceProvider','owner')";
$sth = $this->db->prepare($sql); $sth = $this->db->prepare($sql);
$sth->execute(); $sth->execute();
$rows = $sth->fetchAll(); $rows = $sth->fetchAll();
view::addTextPaginator($rows, $this); view::addPaginator($rows, $this);
} }
} }
} }

View File

@ -1,7 +1,6 @@
<?php if ($this->pageCount): ?> <?php if ($this->pageCount): ?>
<div class="pagination"> <ul class="pagination">
<ul> <!-- Previous page link -->
<!-- Previous page link -->
<?php if (isset($this->previous)): ?> <?php if (isset($this->previous)): ?>
<li><a href="<?= $this->url(array('page' => $this->previous)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>">&laquo;</a></li> <li><a href="<?= $this->url(array('page' => $this->previous)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>">&laquo;</a></li>
<?php else: ?> <?php else: ?>
@ -21,8 +20,6 @@
<li><a href="<?= $this->url(array('page' => $this->next)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>">&raquo;</a></li> <li><a href="<?= $this->url(array('page' => $this->next)); ?>?<?php echo $_SERVER["QUERY_STRING"];?>">&raquo;</a></li>
<?php else: ?> <?php else: ?>
<li class="disabled"><a href="javascript:;">&raquo;</a></li> <li class="disabled"><a href="javascript:;">&raquo;</a></li>
<?php endif; ?>
</ul>
</div>
<?php endif; ?> <?php endif; ?>
</ul>
<?php endif; ?>

View File

@ -27,5 +27,4 @@
<span><a href="#">返回顶部</a></span> <span><a href="#">返回顶部</a></span>
<?php endif; ?> <?php endif; ?>