コード例 #1
0
ファイル: Datatable.php プロジェクト: fruition-sciences/phpfw
 /**
  * Initialize the 'pagingInfo' based on parameters that may exist in the
  * request, or using default values.
  *
  * @param Context $ctx
  */
 private function initPagingInfo($ctx)
 {
     $offset = $ctx->getRequest()->getLong('iDisplayStart', 0);
     $pageSize = $ctx->getRequest()->getLong('iDisplayLength', 10);
     if ($pageSize > 0) {
         // if pagination is turned off, iDisplayLength is set to -1 by datatables
         $this->pagingInfo->setPageNumber($offset / $pageSize);
         $this->pagingInfo->setRecordsPerPage($pageSize);
     }
 }
コード例 #2
0
 /**
  * @covers PagingInfo::getRecordsPerPage
  */
 public function testGetRecordsPerPage()
 {
     $this->paging->setRecordsPerPage(27);
     $this->assertSame(27, $this->paging->getRecordsPerPage());
 }
コード例 #3
0
 protected function setUp()
 {
     $this->paging = new \PagingInfo();
     $this->paging->setRecordsPerPage(5);
 }
コード例 #4
0
ファイル: Table.php プロジェクト: fruition-sciences/phpfw
 /**
  * Create a new PagingInfo object, populate with data from the Request.
  *
  * @param Context $ctx
  */
 private function createPagingInfo($ctx)
 {
     $pagingInfoPrefs = new PagingInfoPrefs($ctx, $this->getName());
     $pagingInfo = new PagingInfo();
     if ($pagingInfoPrefs->getPageNumber() >= 0) {
         $pagingInfo->setPageNumber($pagingInfoPrefs->getPageNumber());
     }
     if ($pagingInfoPrefs->getRecodsPerPage() > 0) {
         $pagingInfo->setRecordsPerPage($pagingInfoPrefs->getRecodsPerPage());
     }
     if ($pagingInfoPrefs->getOrderByColumn() != '') {
         $pagingInfo->setOrderByColumn($pagingInfoPrefs->getOrderByColumn());
         $pagingInfo->setOrderByAscending($pagingInfoPrefs->isOrderByAscending());
     }
     return $pagingInfo;
 }