當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Paginator::setDefaultScrollingStyle方法代碼示例

本文整理匯總了PHP中Zend\Paginator\Paginator::setDefaultScrollingStyle方法的典型用法代碼示例。如果您正苦於以下問題:PHP Paginator::setDefaultScrollingStyle方法的具體用法?PHP Paginator::setDefaultScrollingStyle怎麽用?PHP Paginator::setDefaultScrollingStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Zend\Paginator\Paginator的用法示例。


在下文中一共展示了Paginator::setDefaultScrollingStyle方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testUsesDefaultScrollingStyleIfNoneSupplied

 /**
  * @group ZF-4037
  */
 public function testUsesDefaultScrollingStyleIfNoneSupplied()
 {
     // First we'll make sure the base case works
     $output = $this->_viewHelper->__invoke($this->_paginator, 'All', 'testPagination.phtml');
     $this->assertContains('page count (11) equals pages in range (11)', $output, $output);
     Paginator\Paginator::setDefaultScrollingStyle('All');
     $output = $this->_viewHelper->__invoke($this->_paginator, null, 'testPagination.phtml');
     $this->assertContains('page count (11) equals pages in range (11)', $output, $output);
     Helper\PaginationControl::setDefaultViewPartial('testPagination.phtml');
     $output = $this->_viewHelper->__invoke($this->_paginator);
     $this->assertContains('page count (11) equals pages in range (11)', $output, $output);
 }
開發者ID:pnaq57,項目名稱:zf2demo,代碼行數:15,代碼來源:PaginationControlTest.php

示例2: loadData

 /**
  * Load the data
  */
 public function loadData()
 {
     if (true === $this->isDataLoaded) {
         return true;
     }
     if ($this->isInit() !== true) {
         throw new \Exception('The init() method has to be called, before you can call loadData()!');
     }
     if ($this->hasDataSource() === false) {
         throw new \Exception('No datasource defined! Please call "setDataSource()" first"');
     }
     /**
      * Apply cache
      */
     $renderer = $this->getRenderer();
     /**
      * Step 1.1) Only select needed columns (performance)
      */
     $this->getDataSource()->setColumns($this->getColumns());
     /**
      * Step 1.2) Sorting
      */
     foreach ($renderer->getSortConditions() as $condition) {
         $this->getDataSource()->addSortCondition($condition['column'], $condition['sortDirection']);
     }
     /**
      * Step 1.3) Filtering
      */
     foreach ($renderer->getFilters() as $filter) {
         $this->getDataSource()->addFilter($filter);
     }
     $this->getDataSource()->execute();
     $paginatorAdapter = $this->getDataSource()->getPaginatorAdapter();
     \Zend\Paginator\Paginator::setDefaultScrollingStyle('Sliding');
     $this->paginator = new Paginator($paginatorAdapter);
     $this->paginator->setCurrentPageNumber($renderer->getCurrentPageNumber());
     $this->paginator->setItemCountPerPage($renderer->getItemsPerPage($this->getDefaultItemsPerPage()));
     /* @var $currentItems \ArrayIterator */
     $data = $this->paginator->getCurrentItems();
     if (!is_array($data)) {
         if ($data instanceof \Zend\Db\ResultSet\ResultSet) {
             $data = $data->toArray();
         } elseif ($data instanceof ArrayIterator) {
             $data = $data->getArrayCopy();
         } else {
             if (is_object($data)) {
                 $add = get_class($data);
             } else {
                 $add = '[no object]';
             }
             throw new \Exception(sprintf('The paginator returned an unknown result: %s (allowed: \\ArrayIterator or a plain php array)', $add));
         }
     }
     /*
      * Save cache
      */
     if ($renderer->isExport() === false) {
         $cacheData = ['sortConditions' => $renderer->getSortConditions(), 'filters' => $renderer->getFilters(), 'currentPage' => $this->getPaginator()->getCurrentPageNumber()];
         $success = $this->getCache()->setItem($this->getCacheId(), $cacheData);
         if ($success !== true) {
             /** @var \Zend\Cache\Storage\Adapter\FilesystemOptions $options */
             $options = $this->getCache()->getOptions();
             throw new \Exception(sprintf('Could not save the datagrid cache. Does the directory "%s" exists and is writeable? CacheId: %s', $options->getCacheDir(), $this->getCacheId()));
         }
     }
     /*
      * Step 3) Format the data - Translate - Replace - Date / time / datetime - Numbers - ...
      */
     $prepareData = new PrepareData($data, $this->getColumns());
     $prepareData->setRendererName($this->getRendererName());
     if ($this->hasTranslator()) {
         $prepareData->setTranslator($this->getTranslator());
     }
     $prepareData->prepare();
     $this->preparedData = $prepareData->getData();
     $this->isDataLoaded = true;
 }
開發者ID:rezix,項目名稱:ZfcDatagrid,代碼行數:80,代碼來源:Datagrid.php

示例3: _initPaginator

 /**
  *
  * @param array|object $offers
  * @return \Zend\Paginator\Paginator
  */
 private function _initPaginator($offers)
 {
     \Zend\Paginator\Paginator::setDefaultScrollingStyle('Sliding');
     \Zend\View\Helper\PaginationControl::setDefaultViewPartial('layout/pagination_control.phtml');
     $page = $this->params()->fromRoute('page');
     $page = $page ? $page : 1;
     if (is_object($offers)) {
         $offers = $offers->getArrayCopy();
     }
     $paginator = new \Zend\Paginator\Paginator(new \Zend\Paginator\Adapter\ArrayAdapter($offers));
     $paginator->setCurrentPageNumber($page);
     return $paginator;
 }
開發者ID:nouron,項目名稱:nouron,代碼行數:18,代碼來源:IndexController.php

示例4: testGetsAndSetsDefaultScrollingStyle

 public function testGetsAndSetsDefaultScrollingStyle()
 {
     $this->assertEquals(Paginator\Paginator::getDefaultScrollingStyle(), 'Sliding');
     Paginator\Paginator::setDefaultScrollingStyle('Scrolling');
     $this->assertEquals(Paginator\Paginator::getDefaultScrollingStyle(), 'Scrolling');
     Paginator\Paginator::setDefaultScrollingStyle('Sliding');
 }
開發者ID:rajanlamic,項目名稱:IntTest,代碼行數:7,代碼來源:PaginatorTest.php

示例5: getViewHelperConfig

 public function getViewHelperConfig()
 {
     \Zend\Paginator\Paginator::setDefaultScrollingStyle('Sliding');
     \Zend\View\Helper\PaginationControl::setDefaultViewPartial("layout/paginatorItem");
     return array('invokables' => array(), 'factories' => array('App' => 'Home\\View\\Helper\\AppFactory'));
 }
開發者ID:NguyenQuiDuong,項目名稱:Funix,代碼行數:6,代碼來源:Module.php


注:本文中的Zend\Paginator\Paginator::setDefaultScrollingStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。