コード例 #1
0
ファイル: Pager.php プロジェクト: XaphanBael/Grids
 public function initialize(Grid $grid)
 {
     parent::initialize($grid);
     $this->pagination_factory = $grid->getConfig()->getDataProvider()->getPaginationFactory();
     $this->previous_page_name = $this->pagination_factory->getPageName();
     $this->input_key = $grid->getInputProcessor()->getKey();
     $this->setupPaginationForReading();
 }
コード例 #2
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->bindShared('paginator', function ($app) {
         $paginator = new Factory($app['request'], $app['view'], $app['translator']);
         $paginator->setViewName($app['config']['view.pagination']);
         $app->refresh('request', $paginator, 'setRequest');
         return $paginator;
     });
 }
コード例 #3
0
 /**
  * @return \Illuminate\Pagination\Paginator
  */
 public function index()
 {
     $page = Input::has('page') ? Input::get('page') : PageableRepositoryInterface::FIRST_PAGE;
     $query = Input::has('query') ? Input::get('query') : '';
     $results = $this->filmService->paginate($page, $query);
     $transformedItems = $this->transformer->transformCollection($results->getItems());
     $results->setItems($transformedItems);
     return $this->paginator->make($results->getItems()->toArray(), $results->getTotal(), PageableRepositoryInterface::ITEMS_PER_PAGE);
 }
コード例 #4
0
ファイル: Factory.php プロジェクト: cesarcarvalho/pagination
 /**
  * Get the number of the current page.
  *
  * @return int
  */
 public function getCurrentPage()
 {
     $page = (int) $this->currentPage ?: array_get($this->routeParameters, 'page');
     if ($page < 1 || filter_var($page, FILTER_VALIDATE_INT) === false) {
         return parent::getCurrentPage();
     }
     return $page;
 }
コード例 #5
0
ファイル: _ide_helper.php プロジェクト: nmkr/basic-starter
 /**
  * Get the translator instance.
  *
  * @return \Symfony\Component\Translation\TranslatorInterface 
  * @static 
  */
 public static function getTranslator()
 {
     return \Illuminate\Pagination\Factory::getTranslator();
 }
コード例 #6
0
 /**
  * Create a paginator for an un-grouped pagination statement.
  *
  * @param  \Illuminate\Pagination\Factory  $paginator
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 protected function ungroupedPaginate($paginator, $perPage, $columns)
 {
     $total = $this->getPaginationCount();
     // Once we have the total number of records to be paginated, we can grab the
     // current page and the result array. Then we are ready to create a brand
     // new Paginator instances for the results which will create the links.
     $page = $paginator->getCurrentPage($total);
     $results = $this->forPage($page, $perPage)->get($columns);
     return $paginator->make($results, $total, $perPage);
 }
コード例 #7
0
ファイル: Builder.php プロジェクト: peintune/Ternado
 /**
  * Get a paginator for an ungrouped statement.
  *
  * @param  \Illuminate\Pagination\Factory  $paginator
  * @param  int    $perPage
  * @param  array  $columns
  * @return \Illuminate\Pagination\Paginator
  */
 protected function ungroupedPaginate($paginator, $perPage, $columns)
 {
     $total = $this->query->getPaginationCount();
     // Once we have the paginator we need to set the limit and offset values for
     // the query so we can get the properly paginated items. Once we have an
     // array of items we can create the paginator instances for the items.
     $page = $paginator->getCurrentPage($total);
     $this->query->forPage($page, $perPage);
     return $paginator->make($this->get($columns)->all(), $total, $perPage);
 }
コード例 #8
0
ファイル: Paginator.php プロジェクト: peintune/Ternado
 /**
  * Set the base URL in use by the paginator.
  *
  * @param  string  $baseUrl
  * @return void
  */
 public function setBaseUrl($baseUrl)
 {
     $this->factory->setBaseUrl($baseUrl);
 }