You are here

function views_php_pager_helper::__construct in Views PHP 6

File

./views_php.module, line 172
Allows to use PHP in views.

Class

views_php_pager_helper
Helper class to deal with pager differences between Views 2 and 3.

Code

function __construct($view) {
  $this->view = $view;
  if (version_compare(views_api_version(), '3', '<')) {

    // Views 2
    $this->pager = $this->view->pager;
    $this->view
      ->set_items_per_page(0);
  }
  else {

    // Views 3
    $this->pager = array(
      'limit' => $this->view->query->limit,
      'offset' => $this->view->query->offset,
      'use_pager' => $this->view->query->pager
        ->use_pager(),
    );
    $this->view->query
      ->set_limit(0);
    $this->view->query
      ->set_offset(0);
  }
}