当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Paginator::getPagesInRange方法代码示例

本文整理汇总了PHP中Zend_Paginator::getPagesInRange方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Paginator::getPagesInRange方法的具体用法?PHP Zend_Paginator::getPagesInRange怎么用?PHP Zend_Paginator::getPagesInRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Paginator的用法示例。


在下文中一共展示了Zend_Paginator::getPagesInRange方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPages

 /**
  * Returns an array of "local" pages given a page number and range.
  *
  * @param  Zend_Paginator $paginator
  * @param  integer $pageRange Unused
  * @return array
  */
 public function getPages(Zend_Paginator $paginator, $pageRange = null)
 {
     $pageRange = $paginator->getPageRange();
     $pageNumber = $paginator->getCurrentPageNumber();
     $delta = $pageNumber % $pageRange;
     if ($delta == 0) {
         $delta = $pageRange;
     }
     $offset = $pageNumber - $delta;
     $lowerBound = $offset + 1;
     $upperBound = $offset + $pageRange;
     return $paginator->getPagesInRange($lowerBound, $upperBound);
 }
开发者ID:jkimdon,项目名称:cohomeals,代码行数:20,代码来源:Jumping.php

示例2: getPages

 /**
  * Create the page object used in View - paginator method
  * @access public
  * @return object
  */
 public function getPages()
 {
     $pages = new stdClass();
     $pageCount = $this->_paginator->count();
     $pages->pageCount = $pageCount;
     $pages->itemCountPerPage = $this->_itemCountPerPage;
     $pages->first = 1;
     $pages->current = (int) $this->_currentPage;
     $pages->last = $pageCount;
     // Previous and next
     if ($this->_currentPage - 1 > 0) {
         $pages->previous = $this->_currentPage - 1;
     }
     if ($this->_currentPage + 1 <= $pageCount) {
         $pages->next = $this->_currentPage + 1;
     }
     // Pages in range
     $pageRange = $this->_paginator->getPageRange();
     if ($pageRange > $pageCount) {
         $pageRange = $pageCount;
     }
     $delta = ceil($pageRange / 2);
     if ($this->_currentPage - $delta > $pageCount - $pageRange) {
         $lowerBound = $pageCount - $pageRange + 1;
         $upperBound = $pageCount;
     } else {
         if ($this->_currentPage - $delta < 0) {
             $delta = $this->_currentPage;
         }
         $offset = $this->_currentPage - $delta;
         $lowerBound = $offset + 1;
         $upperBound = $offset + $pageRange;
     }
     $pages->pagesInRange = $this->_paginator->getPagesInRange($lowerBound, $upperBound);
     $pages->firstPageInRange = min($pages->pagesInRange);
     $pages->lastPageInRange = max($pages->pagesInRange);
     // Item numbers
     if ($this->_currentItems == null) {
         $this->getCurrentItems();
     }
     if ($this->_currentItems !== null) {
         $pages->currentItemCount = $this->_paginator->getCurrentItemCount();
         $pages->itemCountPerPage = $this->_paginator->getItemCountPerPage();
         $pages->totalItemCount = $this->_paginator->getTotalItemCount();
         $pages->firstItemNumber = ($this->_currentPage - 1) * $this->_paginator->getItemCountPerPage() + 1;
         $pages->lastItemNumber = $pages->firstItemNumber + $pages->currentItemCount - 1;
     }
     return $pages;
 }
开发者ID:sandeepdwarkapuria,项目名称:dotkernel,代码行数:54,代码来源:Paginator.php

示例3: getPages

 /**
  * Returns an array of all pages given a page number and range.
  *
  * @param  Zend_Paginator $paginator
  * @param  integer $pageRange Unused
  * @return array
  */
 public function getPages(Zend_Paginator $paginator, $pageRange = null)
 {
     return $paginator->getPagesInRange(1, $paginator->count());
 }
开发者ID:fredcido,项目名称:cenbrap,代码行数:11,代码来源:All.php

示例4: testGetsPagesInOutOfBoundsRange

 public function testGetsPagesInOutOfBoundsRange()
 {
     $actual = $this->_paginator->getPagesInRange(-1, 12);
     $this->assertEquals(array_combine(range(1, 11), range(1, 11)), $actual);
 }
开发者ID:SustainableCoastlines,项目名称:loveyourwater,代码行数:5,代码来源:PaginatorTest.php

示例5: testGetPagesInRangeOutOfBounds

 public function testGetPagesInRangeOutOfBounds()
 {
     $this->_restorePaginatorDefaults();
     $actual = $this->_paginator->getPagesInRange(-1, 12);
     $this->assertEquals(array_combine(range(1, 11), range(1, 11)), $actual);
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:6,代码来源:PaginatorTest.php


注:本文中的Zend_Paginator::getPagesInRange方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。