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


PHP Paginator::getDefaultItemCountPerPage方法代码示例

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


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

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

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

示例3: overviewAction

 /**
  * @return ViewModel
  */
 public function overviewAction()
 {
     $which = $this->params('which', CalendarService::WHICH_UPCOMING);
     $page = $this->params('page', 1);
     $calendarItems = $this->getCalendarService()->findCalendarItems($which, $this->zfcUserAuthentication()->getIdentity());
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($calendarItems)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     $whichValues = $this->getCalendarService()->getWhichValues();
     return new ViewModel(['enableCalendarContact' => $this->getModuleOptions()->getCommunityCalendarContactEnabled(), 'which' => $which, 'paginator' => $paginator, 'whichValues' => $whichValues]);
 }
开发者ID:iteaoffice,项目名称:calendar,代码行数:15,代码来源:CalendarCommunityController.php

示例4: listAction

 /**
  * @return \Zend\View\Model\ViewModel
  */
 public function listAction()
 {
     $page = $this->params()->fromRoute('page', 1);
     $filterPlugin = $this->getGeneralFilter();
     $contactQuery = $this->getGeneralService()->findEntitiesFiltered('gender', $filterPlugin->getFilter());
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($contactQuery, false)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 20);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     $form = new GenderFilter($this->getGeneralService());
     $form->setData(['filter' => $filterPlugin->getFilter()]);
     return new ViewModel(['paginator' => $paginator, 'form' => $form, 'encodedFilter' => urlencode($filterPlugin->getHash()), 'order' => $filterPlugin->getOrder(), 'direction' => $filterPlugin->getDirection()]);
 }
开发者ID:iteaoffice,项目名称:general,代码行数:16,代码来源:GenderController.php

示例5: viewAction

 /**
  * @return ViewModel
  */
 public function viewAction()
 {
     $organisationService = $this->getOrganisationService()->setOrganisationId($this->params('id'));
     $page = $this->params()->fromRoute('page', 1);
     $filterPlugin = $this->getInvoiceFilter();
     $invoiceQuery = $this->getInvoiceService()->findEntitiesFiltered('invoice', array_merge($filterPlugin->getFilter(), ['organisation' => [$organisationService->getOrganisation()->getId()]]));
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($invoiceQuery, false)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     $form = new InvoiceFilter($this->getInvoiceService());
     $form->setData(['filter' => $filterPlugin->getFilter()]);
     $projects = $this->getProjectService()->findProjectByOrganisation($organisationService->getOrganisation(), ProjectService::WHICH_ALL);
     return new ViewModel(['paginator' => $paginator, 'form' => $form, 'encodedFilter' => urlencode($filterPlugin->getHash()), 'order' => $filterPlugin->getOrder(), 'direction' => $filterPlugin->getDirection(), 'organisationService' => $organisationService, 'organisationDoa' => $this->getDoaService()->findDoaByOrganisation($organisationService->getOrganisation()), 'organisationLoi' => $this->getLoiService()->findLoiByOrganisation($organisationService->getOrganisation()), 'projects' => $projects, 'projectService' => $this->getProjectService()]);
 }
开发者ID:iteaoffice,项目名称:organisation,代码行数:18,代码来源:OrganisationAdminController.php

示例6: listAction

 /**
  * @return ViewModel
  */
 public function listAction()
 {
     if (!is_null($this->params('call'))) {
         $this->getCallService()->setCallId($this->params('call'));
     }
     if (!is_null($this->params('program'))) {
         $this->getProgramService()->setProgramId($this->params('program'));
     }
     $page = $this->params('page');
     $projects = $this->getProjectService()->findProjectByContactByProgramOrCall($this->zfcUserAuthentication()->getIdentity(), ProjectService::WHICH_ALL, !$this->getProgramService()->isEmpty() ? $this->getProgramService()->getProgram() : null, !$this->getCallService()->isEmpty() ? $this->getCallService()->getCall() : null, null, $this->params()->fromQuery('q'));
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($projects, false)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     return new ViewModel(['paginator' => $paginator, 'search' => $this->params()->fromQuery('q'), 'calls' => $this->getCallService()->findNonEmptyCalls(), 'callId' => $this->getCallService()->isEmpty() ? null : $this->getCallService()->getCall()->getId(), 'selectedProgramId' => $this->getProgramService()->isEmpty() ? null : $this->getProgramService()->getProgram()->getId()]);
 }
开发者ID:debranova,项目名称:project,代码行数:19,代码来源:CommunityController.php

示例7: listAction

 /**
  * @return ViewModel
  */
 public function listAction()
 {
     $paginator = null;
     $searchForm = new Search();
     $search = $this->getRequest()->getQuery()->get('search');
     $page = $this->getRequest()->getQuery()->get('page');
     $searchForm->setData($_GET);
     if ($this->getRequest()->isGet() && $searchForm->isValid() && !empty($search)) {
         $contactSearchQuery = $this->getContactService()->searchContacts($search);
         $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($contactSearchQuery)));
         $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
         $paginator->setCurrentPageNumber($page);
         $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     }
     return new ViewModel(['paginator' => $paginator, 'form' => $searchForm]);
 }
开发者ID:debranova,项目名称:contact,代码行数:19,代码来源:ContactManagerController.php

示例8: overviewAction

 /**
  * Display the calendar on the website.
  *
  * @return ViewModel
  */
 public function overviewAction()
 {
     $which = $this->getEvent()->getRouteMatch()->getParam('which', CalendarService::WHICH_UPCOMING);
     $page = $this->getEvent()->getRouteMatch()->getParam('page', 1);
     $year = $this->getEvent()->getRouteMatch()->getParam('year', date("Y"));
     $birthDays = $this->getContactService()->findContactsWithDateOfBirth();
     $calendarItems = $this->getCalendarService()->findCalendarItems($which, $this->zfcUserAuthentication()->getIdentity())->getResult();
     $calender = [];
     $today = new \DateTime();
     foreach ($birthDays as $birthDay) {
         /*
          * Produce a index which holds the current year
          */
         $dateOfBirth = $birthDay->getDateOfBirth();
         $birthDayDate = \DateTime::createFromFormat('Y-m-d', sprintf("%s-%s", date('Y'), $dateOfBirth->format('m-d')));
         if ($birthDayDate < $today) {
             continue;
         }
         $index = $birthDayDate->format('Y-m-d');
         $calender[$index][] = ['item' => sprintf(_("Birthday of %s (%s)"), $birthDay->getDisplayName(), $birthDay->getDateOfBirth()->format("Y")), 'date' => $birthDayDate];
     }
     /**
      * @var $calendarItem Calendar
      */
     foreach ($calendarItems as $calendarItem) {
         if ($calendarItem->getDateFrom() < $today) {
             continue;
         }
         $index = $calendarItem->getDateFrom()->format('Y-m-d');
         $calender[$index][] = ['item' => $calendarItem->getCalendar(), 'calendar' => $calendarItem, 'date' => null];
     }
     ksort($calender);
     $paginator = new Paginator(new ArrayAdapter($calender));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : PHP_INT_MAX);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     $whichValues = $this->getCalendarService()->getWhichValues();
     return new ViewModel(['which' => $which, 'paginator' => $paginator, 'whichValues' => $whichValues]);
 }
开发者ID:debranova,项目名称:calendar,代码行数:44,代码来源:CalendarManagerController.php

示例9: testGetSetDefaultItemCountPerPage

 /**
  * @group ZF-5785
  */
 public function testGetSetDefaultItemCountPerPage()
 {
     Paginator\Paginator::setGlobalConfig(new Config\Config(array()));
     $paginator = new Paginator\Paginator(new Adapter\ArrayAdapter(range(1, 10)));
     $this->assertEquals(10, $paginator->getItemCountPerPage());
     Paginator\Paginator::setDefaultItemCountPerPage(20);
     $this->assertEquals(20, Paginator\Paginator::getDefaultItemCountPerPage());
     $paginator = new Paginator\Paginator(new Adapter\ArrayAdapter(range(1, 10)));
     $this->assertEquals(20, $paginator->getItemCountPerPage());
     $this->_restorePaginatorDefaults();
 }
开发者ID:rajanlamic,项目名称:IntTest,代码行数:14,代码来源:PaginatorTest.php

示例10: testGetSetDefaultItemCountPerPage

 /**
  * @group ZF-5785
  */
 public function testGetSetDefaultItemCountPerPage()
 {
     Paginator\Paginator::setOptions(new Config\Config(array()));
     $paginator = Paginator\Paginator::factory(range(1, 10));
     $this->assertEquals(10, $paginator->getItemCountPerPage());
     Paginator\Paginator::setDefaultItemCountPerPage(20);
     $this->assertEquals(20, Paginator\Paginator::getDefaultItemCountPerPage());
     $paginator = Paginator\Paginator::factory(range(1, 10));
     $this->assertEquals(20, $paginator->getItemCountPerPage());
     $this->_restorePaginatorDefaults();
 }
开发者ID:Rovak,项目名称:zf2,代码行数:14,代码来源:PaginatorTest.php

示例11: searchAction

 /**
  * @return ViewModel
  */
 public function searchAction()
 {
     $searchService = $this->getContactSearchService();
     $page = $this->params('page', 1);
     $form = new SearchResult();
     $data = array_merge(['query' => '*', 'facet' => []], $this->getRequest()->getQuery()->toArray());
     if ($this->getRequest()->isGet()) {
         $searchService->setSearch($data['query']);
         if (isset($data['facet'])) {
             foreach ($data['facet'] as $facetField => $values) {
                 $quotedValues = [];
                 foreach ($values as $value) {
                     $quotedValues[] = sprintf("\"%s\"", $value);
                 }
                 $searchService->addFilterQuery($facetField, implode(' ' . SolariumQuery::QUERY_OPERATOR_OR . ' ', $quotedValues));
             }
         }
         $form->addSearchResults($searchService->getQuery()->getFacetSet(), $searchService->getResultSet()->getFacetSet());
         $form->setData($data);
     }
     $paginator = new Paginator(new SolariumPaginator($searchService->getSolrClient(), $searchService->getQuery()));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 16);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     return new ViewModel(['form' => $form, 'paginator' => $paginator, 'queryParams' => http_build_query($data), 'routeName' => $this->getEvent()->getRouteMatch()->getMatchedRouteName(), 'params' => $this->getEvent()->getRouteMatch()->getParams(), 'currentPage' => $page, 'lastPage' => $paginator->getPageRange(), 'showAlwaysFirstAndLast' => true]);
 }
开发者ID:iteaoffice,项目名称:contact,代码行数:29,代码来源:ContactController.php

示例12: noFinancialAction

 /**
  * @return ViewModel
  */
 public function noFinancialAction()
 {
     $page = $this->params()->fromRoute('page', 1);
     $filterPlugin = $this->getOrganisationFilter();
     $organisationQuery = $this->getOrganisationService()->findActiveOrganisationWithoutFinancial($filterPlugin->getFilter());
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($organisationQuery, false)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     $form = new OrganisationFilter($this->getOrganisationService());
     $form->setData(['filter' => $filterPlugin->getFilter()]);
     return new ViewModel(['paginator' => $paginator, 'form' => $form, 'encodedFilter' => urlencode($filterPlugin->getHash()), 'order' => $filterPlugin->getOrder(), 'direction' => $filterPlugin->getDirection()]);
 }
开发者ID:iteaoffice,项目名称:organisation,代码行数:16,代码来源:OrganisationFinancialController.php

示例13: parseProjectList

 /**
  * @param int $page
  *
  * @return string
  */
 public function parseProjectList($page = 1)
 {
     //if call is not empty
     $whichProjects = $this->getProjectService()->getOptions()->getProjectHasVersions() ? ProjectService::WHICH_ONLY_ACTIVE : ProjectService::WHICH_ALL;
     $whichTemplate = $this->getProjectService()->getOptions()->getProjectHasVersions() ? 'project/partial/list/project' : 'project/partial/list/project_eu';
     if (!$this->getCallService()->isEmpty()) {
         $cacheKey = 'call_' . $this->getCallService()->getCall()->getId();
         $projectQuery = $this->getProjectService()->findProjectsByCall($this->getCallService()->getCall(), $whichProjects);
     } elseif (!$this->getProgramService()->isEmpty()) {
         $cacheKey = 'program_' . $this->getProgramService()->getProgram()->getId();
         $projectQuery = $this->getProjectService()->findProjectByProgram($this->getProgramService()->getProgram(), $whichProjects);
     } else {
         $cacheKey = 'all';
         $projectQuery = $this->getProjectService()->findAllProjects($whichProjects);
     }
     //Push the yearSpan into the navigation
     $this->getServiceLocator()->get('content_update_navigation_service')->updateNavigationWithCalls($this->getRouteMatch()->getParam('docRef'), $this->getCallService()->findNonEmptyCalls(), (int) $this->getRouteMatch()->getParam('call'));
     $success = false;
     $config = $this->getConfig();
     $key = $config['cache_key'] . '-project-list-html-' . $cacheKey . '-page-' . $page;
     $html = $this->getCache()->getItem($key, $success);
     if (!$success) {
         $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($projectQuery, false)));
         $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
         $paginator->setCurrentPageNumber($page);
         $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
         $html = $this->getZfcTwigRenderer()->render($whichTemplate, ['paginator' => $paginator]);
         $this->getCache()->setItem($key, $html);
     }
     return $html;
 }
开发者ID:debranova,项目名称:project,代码行数:36,代码来源:ProjectHandler.php

示例14: parseOrganisationList

 /**
  * Create a list of organisations for the current country.
  *
  * @param  int $page
  * @throws \InvalidArgumentException
  * @return string
  */
 public function parseOrganisationList($page)
 {
     if (is_null($this->getCountry())) {
         throw new \InvalidArgumentException("The country cannot be null");
     }
     $organisationQuery = $this->getOrganisationService()->findOrganisationByCountry($this->getCountry(), true, true);
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($organisationQuery)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     return $this->getRenderer()->render('general/partial/list/organisation', ['country' => $this->getCountry(), 'paginator' => $paginator]);
 }
开发者ID:iteaoffice,项目名称:general,代码行数:19,代码来源:CountryHandler.php

示例15: parseOrganisationList

 /**
  * Produce a list of organisation.
  *
  * @param $page
  *
  * @return string
  */
 public function parseOrganisationList($page)
 {
     $organisationQuery = $this->getOrganisationService()->findOrganisations(true, true);
     $paginator = new Paginator(new PaginatorAdapter(new ORMPaginator($organisationQuery)));
     $paginator->setDefaultItemCountPerPage($page === 'all' ? PHP_INT_MAX : 15);
     $paginator->setCurrentPageNumber($page);
     $paginator->setPageRange(ceil($paginator->getTotalItemCount() / $paginator->getDefaultItemCountPerPage()));
     return $this->getRenderer()->render('organisation/partial/list/organisation', ['paginator' => $paginator]);
 }
开发者ID:iteaoffice,项目名称:organisation,代码行数:16,代码来源:OrganisationHandler.php


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