123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 |
- <?php
- class views_plugin_pager extends views_plugin {
- var $current_page = NULL;
- var $total_items = 0;
-
- function init(&$view, &$display, $options = array()) {
- $this->view = &$view;
- $this->display = &$display;
- $this->unpack_options($this->options, $options);
- }
-
- function get_items_per_page() {
- return isset($this->options['items_per_page']) ? $this->options['items_per_page'] : 0;
- }
-
- function set_items_per_page($items) {
- $this->options['items_per_page'] = $items;
- }
-
- function get_offset() {
- return isset($this->options['offset']) ? $this->options['offset'] : 0;
- }
-
- function set_offset($offset) {
- $this->options['offset'] = $offset;
- }
-
- function get_current_page() {
- return $this->current_page;
- }
-
- function set_current_page($number = NULL) {
- if (!is_numeric($number) || $number < 0) {
- $number = 0;
- }
- $this->current_page = $number;
- }
-
- function get_total_items() {
- return $this->total_items;
- }
-
- function get_pager_id() {
- return isset($this->options['id']) ? $this->options['id'] : 0;
- }
-
- function options_validate(&$form, &$form_state) { }
-
- function options_submit(&$form, &$form_state) { }
-
- function summary_title() {
- return t('Unknown');
- }
-
- function use_pager() {
- return TRUE;
- }
-
- function use_count_query() {
- return TRUE;
- }
-
- function execute_count_query(&$count_query) {
- $this->total_items = $count_query->execute()->fetchField();
- if (!empty($this->options['offset'])) {
- $this->total_items -= $this->options['offset'];
- }
- $this->update_page_info();
- return $this->total_items;
- }
-
- function update_page_info() {
- }
-
- function query() { }
-
- function pre_execute(&$query) { }
-
- function post_execute(&$result) { }
-
- function pre_render(&$result) { }
-
- function render($input) { }
-
- function has_more_records() {
- return $this->get_items_per_page()
- && $this->total_items > (intval($this->current_page) + 1) * $this->get_items_per_page();
- }
- function exposed_form_alter(&$form, &$form_state) { }
- function exposed_form_validate(&$form, &$form_state) { }
- function exposed_form_submit(&$form, &$form_state, &$exclude) { }
- function uses_exposed() {
- return FALSE;
- }
- function items_per_page_exposed() {
- return FALSE;
- }
- function offset_exposed() {
- return FALSE;
- }
- }
|