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


PHP Paginator::setDefaultItemCountPerPage方法代码示例

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


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

示例1: 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

示例2: __invoke

 public function __invoke($page, $entity)
 {
     $auditModuleOptions = $this->getServiceLocator()->getServiceLocator()->get('auditModuleOptions');
     $entityManager = $auditModuleOptions->getEntityManager();
     $auditService = $this->getServiceLocator()->getServiceLocator()->get('auditService');
     if (gettype($entity) != 'string' and in_array(get_class($entity), array_keys($auditModuleOptions->getAuditedClassNames()))) {
         $auditEntityClass = 'ZF\\Doctrine\\Audit\\Entity\\' . str_replace('\\', '_', get_class($entity));
         $identifiers = $auditService->getEntityIdentifierValues($entity);
     } elseif ($entity instanceof AbstractAudit) {
         $auditEntityClass = get_class($entity);
         $identifiers = $auditService->getEntityIdentifierValues($entity, true);
     } else {
         $auditEntityClass = 'ZF\\Doctrine\\Audit\\Entity\\' . str_replace('\\', '_', $entity);
     }
     $search = array('auditEntityClass' => $auditEntityClass);
     if (isset($identifiers)) {
         $search['entityKeys'] = serialize($identifiers);
     }
     $queryBuilder = $entityManager->getRepository('ZF\\Doctrine\\Audit\\Entity\\RevisionEntity')->createQueryBuilder('rev');
     $queryBuilder->orderBy('rev.id', 'DESC');
     $i = 0;
     foreach ($search as $key => $val) {
         $i++;
         $queryBuilder->andWhere("rev.{$key} = ?{$i}");
         $queryBuilder->setParameter($i, $val);
     }
     $adapter = new DoctrineAdapter(new ORMPaginator($queryBuilder));
     $paginator = new Paginator($adapter);
     $paginator->setDefaultItemCountPerPage($auditModuleOptions->getPaginatorLimit());
     $paginator->setCurrentPageNumber($page);
     return $paginator;
 }
开发者ID:TomHAnderson,项目名称:SoliantEntityAudit,代码行数:32,代码来源:RevisionEntityPaginator.php

示例3: 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

示例4: 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

示例5: 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

示例6: getPaginator

 protected function getPaginator($conditions)
 {
     $select = $this->buildSelect($conditions);
     //vo($select->getSqlString());exit;
     $pagerAdapter = new DbSelect($select, $this->getAdapter());
     Paginator::setDefaultItemCountPerPage(50);
     return new Paginator($pagerAdapter);
 }
开发者ID:shiqizhang,项目名称:php-sample,代码行数:8,代码来源:AbstractBusinessDb.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')->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

示例8: indexAction

 public function indexAction()
 {
     $list = $this->getEm()->getRepository($this->entity)->findBy(array(), array('nome' => 'asc'));
     $page = $this->params()->fromRoute('page');
     $paginator = new Paginator(new ArrayAdapter($list));
     $paginator->setCurrentPageNumber($page);
     $paginator->setDefaultItemCountPerPage(20);
     return new ViewModel(array('data' => $paginator, 'page' => $page));
 }
开发者ID:lucasfbr,项目名称:assistente,代码行数:9,代码来源:CrudController.php

示例9: indexAction

 public function indexAction()
 {
     $especies = $this->getRepository()->findAll();
     $page = (int) $this->getRequest()->getQuery('page', '1');
     $paginator = new Paginator(new ArrayAdapter($especies));
     $paginator->setCurrentPageNumber($page);
     $paginator->setDefaultItemCountPerPage(20);
     return array('data' => $paginator, 'page' => $page);
 }
开发者ID:caferrari,项目名称:zf2-simple-crud-module,代码行数:9,代码来源:AbstractController.php

示例10: indexAction

 public function indexAction()
 {
     $list = $this->getEm()->getRepository('Seerc\\Entity\\Cidade')->findAll();
     $page = $this->params()->fromRoute('page');
     $paginator = new Paginator(new ArrayAdapter($list));
     $paginator->setCurrentPageNumber($page);
     $paginator->setDefaultItemCountPerPage(2);
     return new ViewModel(array('data' => $paginator, 'page' => $page));
 }
开发者ID:jonatasbh32,项目名称:pagi,代码行数:9,代码来源:CidadesController.php

示例11: IndexAction

 /**
  * list
  *
  * @return ViewModel
  */
 public function IndexAction()
 {
     $list = $this->getEm()->getRepository($this->entity)->findAll();
     $page = $this->params()->fromRoute('page');
     $pagination = new Paginator(new ArrayAdapter($list));
     $pagination->setCurrentPageNumber($page);
     $pagination->setDefaultItemCountPerPage(10);
     return new ViewModel(['data' => $pagination, 'page' => $page]);
 }
开发者ID:argentinaluiz,项目名称:Learning-ZF2,代码行数:14,代码来源:CrudController.php

示例12: paginator

 public function paginator($data, $currentPage = null, $countPerPage = 30)
 {
     if ($currentPage == null) {
         $currentPage = $this->params()->fromRoute('page');
     }
     $paginator = new Paginator(new ArrayAdapter($data));
     $paginator->setCurrentPageNumber($currentPage);
     $paginator->setDefaultItemCountPerPage($countPerPage);
     return $paginator;
 }
开发者ID:helintonf,项目名称:CommercePlace_WebAPI,代码行数:10,代码来源:AbstractController.php

示例13: getActiveNews

 /**
  * @param int $page
  * @return \PServerCore\Entity\News[]|Paginator
  */
 public function getActiveNews($page = 1)
 {
     $queryBuilder = $this->getNewsQueryBuilder();
     $queryBuilder->where('p.active = :active')->setParameter('active', 1);
     $adapter = new DoctrineAdapter(new ORMPaginator($queryBuilder));
     $paginator = new Paginator($adapter);
     $paginator->setDefaultItemCountPerPage($this->collectionOptions->getConfig()['news']['limit']);
     $paginator->setCurrentPageNumber($page);
     return $paginator;
 }
开发者ID:kokspflanze,项目名称:PServerCore,代码行数:14,代码来源:News.php

示例14: 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

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