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


PHP Paginator::setPageRange方法代码示例

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


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

示例1: setUp

 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->scrollingStyle = new \Zend\Paginator\ScrollingStyle\Jumping();
     $this->paginator = new Paginator(new ArrayAdapter(range(1, 101)));
     $this->paginator->setItemCountPerPage(10);
     $this->paginator->setPageRange(10);
     $this->expectedRange = array_combine(range(1, 10), range(1, 10));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:12,代码来源:JumpingTest.php

示例2: setUp

 /**
  * Prepares the environment before running a test.
  */
 protected function setUp()
 {
     parent::setUp();
     $this->_scrollingStyle = new \Zend\Paginator\ScrollingStyle\Jumping();
     $this->_paginator = \Zend\Paginator\Paginator::factory(range(1, 101));
     $this->_paginator->setItemCountPerPage(10);
     $this->_paginator->setPageRange(10);
     $this->_expectedRange = array_combine(range(1, 10), range(1, 10));
 }
开发者ID:haoyanfei,项目名称:zf2,代码行数:12,代码来源:JumpingTest.php

示例3: initialize

 /**
  * @return void
  */
 public function initialize()
 {
     $this->criteria = $this->getVariable('validCriteria', []);
     $this->currentPage = isset($this->criteria['page']) ? $this->criteria['page'] : 1;
     $this->itemsCountPerPage = isset($this->criteria['limit']) ? $this->criteria['limit'] : 20;
     $criteria = $this->repository->createCriteria($this->criteria);
     $this->count = $this->repository->count($criteria);
     $this->zendPaginator = new ZendPaginator(new NullFill($this->count));
     $this->zendPaginator->setCurrentPageNumber($this->currentPage);
     $this->zendPaginator->setDefaultItemCountPerPage($this->itemsCountPerPage);
     $this->zendPaginator->setPageRange(5);
 }
开发者ID:t4web,项目名称:admin,代码行数:15,代码来源:PaginatorViewModel.php

示例4: listAction

 public function listAction()
 {
     $pagerAction = $this->handlePager();
     $limit = $this->getLimit($this->defaultPageSize);
     $limit = 100;
     $page = $this->getRequest()->getQuery('page', 0);
     $sort = $this->getRequest()->getQuery('sort', $this->defaultSort);
     $order = $this->getRequest()->getQuery('order', $this->defaultOrder);
     if (empty($sort)) {
         $sort = $this->defaultSort;
     }
     $offset = $limit * $page - $limit;
     if ($offset < 0) {
         $offset = 0;
     }
     /* @var $qb \Doctrine\ORM\QueryBuilder */
     $qb = $this->getEntityManager()->createQueryBuilder();
     $qb->select(['e.referrer', 'COUNT(e.id) AS refcount'])->from($this->getEntityClass(), 'e')->setFirstResult($offset)->setMaxResults($limit)->groupBy('e.referrer')->orderBy('e.' . $sort, $order);
     $qb = $this->handleSearch($qb);
     $pager = $this->getPagerForm($limit);
     $q = $qb->getQuery();
     $q->setMaxResults($limit);
     $q->setFirstResult($offset);
     $results = $this->getSources($q->getArrayResult());
     $paginator = new Paginator(new ArrayAdapter($results));
     $paginator->setCacheEnabled(true);
     $paginator->setDefaultItemCountPerPage($limit);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange($this->paginatorRange);
     $ui = ['table' => ["source" => ["col" => 3, "label" => "Source", "sort" => false], "referrers" => ["col" => 6, "label" => "Referrers", "sort" => false], "count" => ["col" => 1, "label" => "# Leads", "sort" => false]]];
     return ['paginator' => $paginator, 'sort' => $sort, 'order' => $order, 'page' => $page, 'pager' => $pager, 'query' => $this->params()->fromQuery(), 'ui' => $ui, 'isAdmin' => $this->isAdmin(), 'history' => $this->setHistory()];
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:32,代码来源:SourceController.php

示例5: indexAction

 public function indexAction()
 {
     /* 	$temp = $this->forward()->dispatch('Application/Controller/Album', array('action' => 'index'));
     		
     		echo '<pre>'; print_r($temp); echo '<pre>';die; */
     $auth = new AuthenticationService();
     if (!$auth->hasIdentity()) {
         return $this->redirect()->toRoute('home');
     }
     $select = new Select();
     $search = @$_REQUEST['search'];
     if (!empty($search)) {
         $select->where->like('name', '%' . $search . '%');
     }
     $order_by = $this->params()->fromRoute('order_by') ? $this->params()->fromRoute('order_by') : 'id';
     $order = $this->params()->fromRoute('order') ? $this->params()->fromRoute('order') : Select::ORDER_ASCENDING;
     $page = $this->params()->fromRoute('page') ? (int) $this->params()->fromRoute('page') : 1;
     $category = $this->getCategoryTable()->fetchAllCategory($select->order($order_by . ' ' . $order), $search);
     $itemPerPage = 2;
     $category->current();
     $paginator = new Paginator(new PaginatorIterator($category));
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($itemPerPage);
     $paginator->setPageRange(10);
     return new ViewModel(array('order_by' => $order_by, 'order' => $order, 'page' => $page, 'paginator' => $paginator));
 }
开发者ID:anillaogi016,项目名称:zend-admin,代码行数:26,代码来源:CategoryController.php

示例6: testNoPagesBeforeSecondLastPageEqualsPageRangeMinTwo

 public function testNoPagesBeforeSecondLastPageEqualsPageRangeMinTwo()
 {
     $this->paginator->setPageRange(3);
     $this->paginator->setCurrentPageNumber(19);
     $pages = $this->paginator->getPages('Elastic');
     $this->assertEquals(5, count($pages->pagesInRange));
 }
开发者ID:pnaq57,项目名称:zf2demo,代码行数:7,代码来源:ElasticTest.php

示例7: listAction

 public function listAction()
 {
     $pagerAction = $this->handlePager();
     $limit = $this->getLimit($this->defaultPageSize);
     // $limit = $this->getRequest()->getQuery('limit',
     // $this->defaultPageSize);
     $page = $this->getRequest()->getQuery('page', 0);
     $sort = $this->getRequest()->getQuery('sort', $this->defaultSort);
     $order = $this->getRequest()->getQuery('order', $this->defaultOrder);
     if (empty($sort)) {
         $sort = $this->defaultSort;
     }
     $offset = $limit * $page - $limit;
     if ($offset < 0) {
         $offset = 0;
     }
     /* @var $qb \Doctrine\ORM\QueryBuilder */
     $qb = $this->getEntityManager()->createQueryBuilder();
     $qb->add('select', 'e')->add('from', $this->getEntityClass() . ' e')->orderBy('e.' . $sort, $order)->setFirstResult($offset)->setMaxResults($limit);
     $qb = $this->handleSearch($qb);
     $pager = $this->getPagerForm($limit);
     $paginator = new Paginator(new DoctrinePaginator(new ORMPaginator($qb->getQuery(), true)));
     $paginator->setDefaultItemCountPerPage($limit);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange($this->paginatorRange);
     $ui = ['table' => ["occurred" => ["col" => 2, "label" => "Date", "sort" => true], "event" => ["col" => 2, "label" => "Event", "sort" => false], "account" => ["col" => 3, "label" => "Account", "sort" => false], "message" => ["col" => 5, "label" => "Info", "sort" => false]]];
     $filters = $this->getFilterForm($this->params()->fromQuery());
     $post = $this->params()->fromPost();
     $redirectUrl = $this->url()->fromRoute($this->getActionRoute(), [], true);
     return ['paginator' => $paginator, 'sort' => $sort, 'order' => $order, 'page' => $page, 'pager' => $pager, 'query' => $this->params()->fromQuery(), 'filters' => $filters, 'ui' => $ui, 'history' => $this->setHistory()];
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:31,代码来源:EventController.php

示例8: listAction

 public function listAction()
 {
     $page = $this->getRequest()->getQuery('page', 0);
     $limit = $this->getRequest()->getQuery('limit', $this->defaultPageSize);
     $sort = $this->getRequest()->getQuery('sort', $this->defaultSort);
     $order = $this->getRequest()->getQuery('order', $this->defaultOrder);
     $id = $this->getEvent()->getRouteMatch()->getParam('id', 0);
     if (empty($sort)) {
         $sort = $this->defaultSort;
     }
     $offset = $limit * $page - $limit;
     if ($offset < 0) {
         $offset = 0;
     }
     /* @var $qb \Doctrine\ORM\QueryBuilder */
     $qb = $this->getEntityManager()->createQueryBuilder();
     $qb->add('select', 'e')->add('from', '\\Lead\\Entity\\Lead e')->innerJoin('e.account', 'a')->andWhere('a.id = :id')->orderBy('e.' . $sort, $order)->setFirstResult($offset)->setMaxResults($limit)->setParameter('id', $id);
     $qb = $this->handleSearch($qb);
     $paginator = new Paginator(new DoctrinePaginator(new LosPaginator($qb, false)));
     $paginator->setDefaultItemCountPerPage($limit);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange($this->paginatorRange);
     $ui = ['table' => ["referrer" => ["col" => 6, "label" => "Source", "sort" => true], "lastsubmitted" => ["col" => 4, "label" => "Submitted", "sort" => true]]];
     $filters = $this->getFilterForm($this->params()->fromQuery())->remove('account');
     return ['id' => $id, 'paginator' => $paginator, 'sort' => $sort, 'order' => $order, 'page' => $page, 'query' => $this->params()->fromQuery(), 'filters' => $filters, 'ui' => $ui];
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:26,代码来源:LeadController.php

示例9: indexAction

 public function indexAction()
 {
     $this->layout('layout/bags');
     $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array('action' => 'getuser'));
     $this->layout()->getuser = $getuser;
     if (!$getuser) {
         // notlogin
         $this->redirect()->toUrl(WEBPATH);
     }
     $this->layout()->getuser = $getuser;
     //$ProductTable = $this->getServiceLocator()->get('ProductTable');
     $allRecord = $this->getSlideTable()->countAll();
     //print_r($allRecord);die;
     $pageNull = new PageNull($allRecord);
     $itemsPerPage = 5;
     $pageRange = 3;
     $page = $this->params()->fromRoute('page', 1);
     $offset = ($page - 1) * $itemsPerPage;
     $paginator = new Paginator($pageNull);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($itemsPerPage);
     $paginator->setPageRange($pageRange);
     $listpr_tmp = $this->getSlideTable()->getList($offset, $itemsPerPage);
     //---------------------------------
     $fetch_slideshow = $this->getSlideTable()->getList($offset, $itemsPerPage);
     $this->layout()->fetch_slideshow = $fetch_slideshow;
     return new ViewModel(array('paginator' => $paginator, 'allRecord' => $allRecord, 'offset' => $offset, 'itemsPerPage' => $itemsPerPage));
 }
开发者ID:gstearmit,项目名称:EshopVegeTable,代码行数:28,代码来源:IndexController.php

示例10: indexAction

 public function indexAction()
 {
     /* $service1=new \Lib\Service1\Custom();
     		echo $service1->demo(); die; */
     /* $plugin=$this->CustomPlugin();
     		print_r($plugin->doSomthing()); die; */
     /* $facebook = new \Facebook(array(
     				'appId'  => 'xxx',
     				'secret' => 'xxx',
     			));
     			print_r($facebook); die; */
     $auth = new AuthenticationService();
     if (!$auth->hasIdentity()) {
         return $this->redirect()->toRoute('home');
     }
     $select = new Select();
     $search = @$_REQUEST['search'];
     if (!empty($search)) {
         $select->where->like('name', '%' . $search . '%')->or->like('email', '%' . $search . '%')->or->like('mob', '%' . $search . '%')->or->like('title', '%' . $search . '%');
     }
     $order_by = $this->params()->fromRoute('order_by') ? $this->params()->fromRoute('order_by') : 'id';
     $order = $this->params()->fromRoute('order') ? $this->params()->fromRoute('order') : Select::ORDER_ASCENDING;
     $page = $this->params()->fromRoute('page') ? (int) $this->params()->fromRoute('page') : 1;
     $album = $this->getAdminTable()->fetchAll($select->order($order_by . ' ' . $order), $search);
     $itemPerPage = 2;
     $album->current();
     $paginator = new Paginator(new PaginatorIterator($album));
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($itemPerPage);
     $paginator->setPageRange(10);
     //print_r($paginator); die;
     return new ViewModel(array('order_by' => $order_by, 'order' => $order, 'page' => $page, 'paginator' => $paginator));
 }
开发者ID:anillaogi016,项目名称:zend-admin,代码行数:33,代码来源:14_des.php

示例11: getUsers

 /**
  * Get users
  *
  * @param integer $page
  * @param integer $perPage
  * @param string $orderBy
  * @param string $orderType
  * @param array $filters
  *      string nickname
  *      string email
  *      string status
  *      integer role
  * @return object
  */
 public function getUsers($page = 1, $perPage = 0, $orderBy = null, $orderType = null, array $filters = [])
 {
     $orderFields = ['id', 'nickname', 'email', 'registered', 'status'];
     $orderType = !$orderType || $orderType == 'desc' ? 'desc' : 'asc';
     $orderBy = $orderBy && in_array($orderBy, $orderFields) ? $orderBy : 'id';
     $select = $this->select();
     $select->from(['a' => 'user_list'])->columns(['id' => 'user_id', 'nickname' => 'nick_name', 'email', 'status', 'registered', 'role_id' => 'role'])->join(['b' => 'acl_role'], 'a.role = b.id', ['role' => 'name'])->order($orderBy . ' ' . $orderType);
     // filter by nickname
     if (!empty($filters['nickname'])) {
         $select->where([new LikePredicate('nick_name', $filters['nickname'] . '%')]);
     }
     // filter by email
     if (!empty($filters['email'])) {
         $select->where(['email' => $filters['email']]);
     }
     // filter by status
     if (!empty($filters['status'])) {
         $select->where(['status' => $filters['status']]);
     }
     // filter by role
     if (!empty($filters['role'])) {
         $select->where(['role' => $filters['role']]);
     }
     $paginator = new Paginator(new DbSelectPaginator($select, $this->adapter));
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage(PaginationUtility::processPerPage($perPage));
     $paginator->setPageRange(SettingService::getSetting('application_page_range'));
     return $paginator;
 }
开发者ID:spooner77,项目名称:dream-cms,代码行数:43,代码来源:UserAdministration.php

示例12: listAction

 public function listAction()
 {
     $pagerAction = $this->handlePager();
     $limit = $this->getLimit($this->defaultPageSize);
     // $limit = $this->getRequest()->getQuery('limit',
     // $this->defaultPageSize);
     $page = $this->getRequest()->getQuery('page', 0);
     $sort = $this->getRequest()->getQuery('sort', $this->defaultSort);
     $order = $this->getRequest()->getQuery('order', $this->defaultOrder);
     if (empty($sort)) {
         $sort = $this->defaultSort;
     }
     $offset = $limit * $page - $limit;
     if ($offset < 0) {
         $offset = 0;
     }
     /* @var $qb \Doctrine\ORM\QueryBuilder */
     $qb = $this->getEntityManager()->createQueryBuilder();
     $qb->add('select', 'e')->add('from', $this->getEntityClass() . ' e')->innerJoin('e.account', 'account')->leftJoin('account.apis', 'apis')->where('apis.name = :email')->orderBy('e.' . $sort, $order)->setFirstResult($offset)->setMaxResults($limit)->setParameter('email', 'Email');
     $qb = $this->handleSearch($qb);
     $pager = $this->getPagerForm($limit);
     $paginator = new Paginator(new DoctrinePaginator(new LosPaginator($qb, false)));
     $paginator->setDefaultItemCountPerPage($limit);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange($this->paginatorRange);
     $ui = ['table' => ["description" => ["col" => 3, "label" => "Name", "sort" => false], "event" => ["col" => 3, "label" => "Latest Email Event", "sort" => false], "account" => ["col" => 2, "label" => "Account", "sort" => false], "timecreated" => ["col" => 2, "label" => "Date", "sort" => true]]];
     $filters = $this->getFilterForm($this->params()->fromQuery());
     $post = $this->params()->fromPost();
     $redirectUrl = $this->url()->fromRoute('services/email', ['action' => 'list'], true);
     if (!$pagerAction) {
         $prg = $this->prg($redirectUrl, true);
     } else {
         $prg = false;
     }
     if ($prg instanceof Response) {
         return $prg;
     } elseif ($prg === false) {
         $form = $this->getListForm($paginator);
         return ['paginator' => $paginator, 'sort' => $sort, 'order' => $order, 'page' => $page, 'pager' => $pager, 'query' => $this->params()->fromQuery(), 'form' => $form, 'filters' => $filters, 'ui' => $ui, 'history' => $this->setHistory()];
     }
     $form = $this->getListForm($paginator, $prg);
     if ($prg && isset($prg['sel'])) {
         $res = true;
         foreach ($prg['sel'] as $lead_id => $one) {
             if ($one) {
                 $response = $this->submit($lead_id);
                 $res = $response ? $res : false;
             }
         }
         if ($res) {
             $this->flashMessenger()->addSuccessMessage($this->getServiceLocator()->get('translator')->translate($this->successSubmitMessage));
         } else {
             $this->flashMessenger()->addErrorMessage($this->getServiceLocator()->get('translator')->translate($this->errorSubmitMessage));
         }
     }
     return $this->redirect()->toRoute('services/email', ['action' => 'list'], true);
 }
开发者ID:arstropica,项目名称:zf2-dashboard,代码行数:57,代码来源:EmailController.php

示例13: listAction

 /**
  * @return \Zend\View\Model\ViewModel
  */
 public function listAction()
 {
     $page = $this->params('page');
     $templateQuery = $this->getGeneralService()->findFiltered(WebInfo::class, []);
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($templateQuery, false)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     return new ViewModel(['paginator' => $paginator]);
 }
开发者ID:debranova,项目名称:general,代码行数:13,代码来源:WebInfoController.php

示例14: fetchList

 public function fetchList($page = 1, $perPage = 15)
 {
     $select = $this->getTable()->getSql()->select();
     $adapter = new DbSelect($select, $this->getTable()->getAdapter(), $this->getTable()->getResultSetPrototype());
     $paginator = new Paginator($adapter);
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage($perPage);
     $paginator->setPageRange(9);
     return $paginator;
 }
开发者ID:andreaszobl,项目名称:software,代码行数:10,代码来源:LastenradService.php

示例15: missingAction

 /**
  * @return ViewModel
  */
 public function missingAction()
 {
     $affiliation = $this->getAffiliationService()->findAffiliationWithMissingLoi();
     $page = $this->params('page');
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($affiliation, false)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     return new ViewModel(['paginator' => $paginator]);
 }
开发者ID:iteaoffice,项目名称:affiliation,代码行数:13,代码来源:LoiManagerController.php


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