You are here

function views_simple_pager::query in Views Simple Pager 7

Modify the query for paging

This is called during the build phase and can directly modify the query.

Overrides views_plugin_pager::query

File

./views_simple_pager.views.inc, line 165
Views plugin implementations for Views Simple Pager.

Class

views_simple_pager
The plugin to provide the Views Simple Pager.

Code

function query() {
  $limit = $this->options['items_per_page'];
  $offset = $this->current_page * $this->options['items_per_page'] + $this->options['offset'];
  if (!empty($this->options['total_pages'])) {
    if ($this->current_page >= $this->options['total_pages']) {
      $limit = $this->options['items_per_page'];
      $offset = $this->options['total_pages'] * $this->options['items_per_page'];
    }
  }
  $this->view->query
    ->set_limit($limit);
  $this->view->query
    ->set_offset($offset);
}