function views_plugin_pager_full::query

Same name in other branches
  1. 7.x-3.x plugins/views_plugin_pager_full.inc \views_plugin_pager_full::query()

Overrides views_plugin_pager::query

File

plugins/views_plugin_pager_full.inc, line 182

Class

views_plugin_pager_full
The plugin to handle full pager.

Code

function query() {
    if ($this->items_per_page_exposed()) {
        if (!empty($_GET['items_per_page']) && $_GET['items_per_page'] > 0) {
            $this->options['items_per_page'] = $_GET['items_per_page'];
        }
        elseif (!empty($_GET['items_per_page']) && $_GET['items_per_page'] == 'All' && $this->options['expose']['items_per_page_options_all']) {
            $this->options['items_per_page'] = 0;
        }
    }
    if ($this->offset_exposed()) {
        if (isset($_GET['offset']) && $_GET['offset'] >= 0) {
            $this->options['offset'] = $_GET['offset'];
        }
    }
    $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);
}