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


PHP Paginator::__construct方法代碼示例

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


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

示例1: __construct

 /**
  *
  * @param integer $totalRows
  * @param integer $limit
  * @param integer $offset
  * @throws Exception\InvalidUsageException
  */
 public function __construct($totalRows, $limit, $offset = 0)
 {
     $totalRows = filter_var($totalRows, FILTER_VALIDATE_INT);
     $limit = filter_var($limit, FILTER_VALIDATE_INT);
     $offset = filter_var($offset, FILTER_VALIDATE_INT);
     if (!is_int($limit) || $limit < 0) {
         throw new Exception\InvalidUsageException(__METHOD__ . ' expects limit to be an integer greater than 0');
     }
     if (!is_int($totalRows) || $totalRows < 0) {
         throw new Exception\InvalidUsageException(__METHOD__ . ' expects total rows to be an integer greater than 0');
     }
     if (!is_int($offset) || $offset < 0) {
         throw new Exception\InvalidUsageException(__METHOD__ . ' expects offset to be an integer greater than 0');
     }
     if (class_exists('\\Zend\\Paginator\\Adapter\\NullFill')) {
         // In ZF 2.4+
         $adapter = new \Zend\Paginator\Adapter\NullFill($totalRows);
     } elseif (class_exists('\\Zend\\Paginator\\Adapter\\Null')) {
         // In ZF < 2.4
         $adapter = new \Zend\Paginator\Adapter\Null($totalRows);
     } else {
         throw new Exception\RuntimeException(__METHOD__ . " Missing Zend\\Paginator\\Adapter.");
     }
     parent::__construct($adapter);
     $this->setItemCountPerPage($limit);
     $this->setCurrentPageNumber(ceil(($offset + 1) / $limit));
 }
開發者ID:robocoder,項目名稱:solublecomponents,代碼行數:34,代碼來源:Paginator.php

示例2: DbSelect

 function __construct($select, $adapter, $result, $current_page)
 {
     $this->select = $select;
     $this->adapter = $adapter;
     $this->result = new \Zend\Db\ResultSet\ResultSet();
     $this->current_page = $current_page;
     $this->paginatorAdapter = new DbSelect($this->select, $this->adapter, $this->result);
     parent::__construct($this->paginatorAdapter);
     $this->initPaging();
 }
開發者ID:jonathan1212,項目名稱:zend-tutorial,代碼行數:10,代碼來源:Paging.php

示例3: __construct

 public function __construct($paged_object, $page = 1, $limit = 10)
 {
     if ($paged_object instanceof \Doctrine\ORM\Query || $paged_object instanceof \Doctrine\ORM\QueryBuilder) {
         parent::__construct(new Paginator\Adapter\DoctrineQuery($paged_object));
     } elseif (is_array($paged_object)) {
         parent::__construct(new \Zend\Paginator\Adapter\ArrayAdapter($paged_object));
     } else {
         parent::__construct(new \Zend\Paginator\Adapter\NullFill($paged_object));
     }
     $this->setItemCountPerPage($limit);
     $this->setCurrentPageNumber($page);
 }
開發者ID:Lavoaster,項目名稱:PVLive,代碼行數:12,代碼來源:Paginator.php

示例4: __construct

 public function __construct(AdapterInterface $adapter)
 {
     $this->proxy = $adapter;
     parent::__construct(new Callback([$this, 'onGetItems'], [$this, 'onCount']));
 }
開發者ID:zource,項目名稱:zource,代碼行數:5,代碼來源:AbstractProxy.php

示例5: __construct

 public function __construct(Contact $contactTaskService)
 {
     $this->contactTaskService = $contactTaskService;
     $this->paginator = $this->contactTaskService->getOverviewPaginator('company');
     parent::__construct(new Callback([$this, 'onGetItems'], [$this, 'onCount']));
 }
開發者ID:zource,項目名稱:zource,代碼行數:6,代碼來源:ContactCollection.php

示例6: __construct

 public function __construct($userCollection)
 {
     parent::__construct(new ArrayAdapter($userCollection));
 }
開發者ID:jerfeson,項目名稱:apigility_doctrine2,代碼行數:4,代碼來源:UserCollection.php


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