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


PHP Paginator::setItemCountPerPage方法代码示例

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


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

示例1: setUp

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

示例2: setUp

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

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

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

示例5: getProfilesPaginator

 public function getProfilesPaginator($iPage = 1, $iCount = null)
 {
     $oPaginator = new Paginator(new MongoCursor($this->mapper->fetchAllIds()));
     $oPaginator->setItemCountPerPage($iCount ? $iCount : $this->oOptions->getProfilesCountPerPage());
     $oPaginator->setCurrentPageNumber($iPage);
     return $oPaginator;
 }
开发者ID:antoinebon,项目名称:zf2,代码行数:7,代码来源:ProfilerService.php

示例6: newPaginator

 /**
  * Creates a paginator
  *
  * @return Paginator Zend Paginator
  */
 public function newPaginator(array $images = array(), $currentPage = 1, $perPage = 25)
 {
     $paginator = new Paginator(new ArrayAdapter($images));
     $paginator->setItemCountPerPage($perPage);
     $paginator->setCurrentPageNumber($currentPage);
     return $paginator;
 }
开发者ID:neophyt3,项目名称:flaming-archer,代码行数:12,代码来源:Pagination.php

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

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

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

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

示例11: dataAction

 public function dataAction()
 {
     $response = $this->getResponse();
     $grid = $this->grid('Application\\Index\\Index', array('-', 'id', 'title', 'category', 'username', 'created_at', '-'));
     if (isset($this->getSessionContainer()->parent_id)) {
         $grid['parent_id'] = $this->getSessionContainer()->parent_id;
     }
     $result = $this->getResourceTable()->fetchDataGrid($grid);
     $adapter = new ArrayAdapter($result);
     $paginator = new Paginator($adapter);
     $page = ceil(intval($grid['start']) / intval($grid['length'])) + 1;
     $paginator->setCurrentPageNumber($page);
     $paginator->setItemCountPerPage(intval($grid['length']));
     $data = array();
     $data['data'] = array();
     foreach ($paginator as $row) {
         $category = array_key_exists('category', $row) ? $row['category'] : '-';
         $title = $row['node_type'] == \Application\Model\Resource::NODE_TYPE_CATEGORY ? '<a href="/admin/resource/parent_id/' . $row['id'] . '" title="' . strip_tags($row['description']) . '">' . strip_tags($row['title']) . '</a>' : '<i>' . strip_tags($row['title']) . '</i>';
         $actions = '';
         if ($row['url']) {
             $actions .= '<a class="btn btn-xs btn-outline blue-steel btn-view" href="' . $row['url'] . '" data-id="' . $row['id'] . '" target="_blank">View</a>&nbsp;';
         }
         $actions .= '<a class="btn btn-xs btn-outline red" href="/admin/resource/delete/id/' . $row['id'] . '" onclick="return confirm("Are you sure you wish to delete selected resources?");">Delete</a>';
         $data['data'][] = array('<input type="checkbox" name="id[' . $row['id'] . ']" value="' . $row['id'] . '" />', '<a class="btn btn-xs btn-outline blue-steel btn-view" href="/admin/resource/edit/id/' . $row['id'] . '/parent_id/' . $row['parent_id'] . '" title="' . $row['id'] . '">Edit: ' . $row['id'] . '</a>', $title, $category, $row['username'], date('F jS Y', strtotime($row['created_at'])), $actions);
     }
     $data['page'] = $page;
     $data['grid'] = $grid;
     $data['draw'] = intval($grid['draw']);
     $data['recordsTotal'] = $paginator->getTotalItemCount();
     $data['recordsFiltered'] = $paginator->getTotalItemCount();
     $response->setStatusCode(200);
     $response->setContent(Json::encode($data));
     return $response;
 }
开发者ID:tomshaw,项目名称:resource-datastore,代码行数:34,代码来源:ResourceController.php

示例12: indexAction

 public function indexAction()
 {
     $this->layout()->setVariable('skipWelcome', false);
     $paginator = new Paginator(new ArrayAdapter($this->modulesList));
     $paginator->setCurrentPageNumber((int) $this->params()->fromQuery('page', 1));
     $paginator->setItemCountPerPage(10);
     return new ViewModel(['paginator' => $paginator]);
 }
开发者ID:sitrunlab,项目名称:learnzf2,代码行数:8,代码来源:IndexController.php

示例13: setItemCountPerPage

 /**
  * Sets the number of items per page.
  *
  * @param  int $itemCountPerPage
  * @return Paginator $this
  */
 public function setItemCountPerPage($itemCountPerPage = -1)
 {
     $adapter = $this->getAdapter();
     if ($adapter instanceof PaginatorAdapterInterface && $itemCountPerPage > 1) {
         $adapter->setLimit($itemCountPerPage);
     }
     return parent::setItemCountPerPage($itemCountPerPage);
 }
开发者ID:nnx-framework,项目名称:data-grid,代码行数:14,代码来源:Paginator.php

示例14: listShortUrls

 /**
  * @param int $page
  * @param string $searchQuery
  * @param array $tags
  * @param null $orderBy
  * @return ShortUrl[]|Paginator
  */
 public function listShortUrls($page = 1, $searchQuery = null, array $tags = [], $orderBy = null)
 {
     /** @var ShortUrlRepository $repo */
     $repo = $this->em->getRepository(ShortUrl::class);
     $paginator = new Paginator(new PaginableRepositoryAdapter($repo, $searchQuery, $tags, $orderBy));
     $paginator->setItemCountPerPage(PaginableRepositoryAdapter::ITEMS_PER_PAGE)->setCurrentPageNumber($page);
     return $paginator;
 }
开发者ID:shlinkio,项目名称:shlink,代码行数:15,代码来源:ShortUrlService.php

示例15: fetchAll

 /**
  * The default action - show the home page
  */
 public function fetchAll(array $filter = null)
 {
     $url = $this->options->getEndpointHost() . sprintf($this->options->getEndpointAlbums());
     $albums = self::doRequest($url);
     $iteratorAdapter = new ArrayAdapter((array) $albums->_embedded->album);
     $paginator = new Paginator($iteratorAdapter);
     $paginator->setItemCountPerPage(25);
     return $paginator;
 }
开发者ID:omusico,项目名称:cursoZf2,代码行数:12,代码来源:AlbumService.php


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