• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

plugins/views_plugin_pager.inc

00001 <?php
00002 
00008 class views_plugin_pager extends views_plugin {
00009   var $current_page = NULL;
00010   var $total_items = 0;
00011 
00020   function init(&$view, &$display, $options = array()) {
00021     $this->view = &$view;
00022     $this->display = &$display;
00023 
00024     $this->unpack_options($this->options, $options);
00025   }
00026 
00033   function get_items_per_page() {
00034     return isset($this->options['items_per_page']) ? $this->options['items_per_page'] : 0;
00035   }
00036 
00042   function set_items_per_page($items) {
00043     $this->options['items_per_page'] = $items;
00044   }
00045 
00052   function get_offset() {
00053     return isset($this->options['offset']) ? $this->options['offset'] : 0;
00054   }
00055 
00059   function set_offset($offset) {
00060     $this->options['offset'] = $offset;
00061   }
00062 
00068   function get_current_page() {
00069     return $this->current_page;
00070   }
00071 
00079   function set_current_page($number = NULL) {
00080     if (!is_numeric($number) || $number < 0) {
00081       $number = 0;
00082     }
00083     $this->current_page = $number;
00084   }
00085 
00091   function get_total_items() {
00092     return $this->total_items;
00093   }
00094 
00098   function get_pager_id() {
00099     return isset($this->options['id']) ? $this->options['id'] : 0;
00100   }
00101 
00105   function options_validate(&$form, &$form_state) { }
00106 
00110   function options_submit(&$form, &$form_state) { }
00111 
00116   function summary_title() {
00117     return t('Unknown');
00118   }
00119 
00125   function use_pager() {
00126     return TRUE;
00127   }
00128 
00134   function use_count_query() {
00135     return TRUE;
00136   }
00137 
00142   function execute_count_query(&$count_query) {
00143     $this->total_items = $count_query->execute()->fetchField();
00144     if (!empty($this->options['offset'])) {
00145       $this->total_items -= $this->options['offset'];
00146     }
00147 
00148     $this->update_page_info();
00149     return $this->total_items;
00150   }
00151 
00156   function update_page_info() {
00157 
00158   }
00159 
00165   function query() { }
00166 
00170   function pre_execute(&$query) { }
00171 
00175   function post_execute(&$result) { }
00176 
00180   function pre_render(&$result) { }
00181 
00192   function render($input) { }
00193 
00199   function has_more_records() {
00200     return $this->get_items_per_page()
00201       && $this->total_items > (intval($this->current_page) + 1) * $this->get_items_per_page();
00202   }
00203 
00204   function exposed_form_alter(&$form, &$form_state) { }
00205 
00206   function exposed_form_validate(&$form, &$form_state) { }
00207 
00208   function exposed_form_submit(&$form, &$form_state, &$exclude) { }
00209 
00210   function uses_exposed() {
00211     return FALSE;
00212   }
00213 
00214   function items_per_page_exposed() {
00215     return FALSE;
00216   }
00217 
00218   function offset_exposed() {
00219     return FALSE;
00220   }
00221 }

Generated on Sun Feb 26 2012 12:52:52 for Views by  doxygen 1.7.1