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

plugins/views_plugin_pager_none.inc

00001 <?php
00002 
00008 class views_plugin_pager_none extends views_plugin_pager {
00009 
00010   function init(&$view, &$display, $options = array()) {
00011     parent::init($view, $display, $options);
00012 
00013     // If the pager is set to none, then it should show all items.
00014     $this->set_items_per_page(0);
00015   }
00016 
00017   function summary_title() {
00018     if (!empty($this->options['offset'])) {
00019       return t('All items, skip @skip', array('@skip' => $this->options['offset']));
00020     }
00021     return t('All items');
00022   }
00023 
00024   function option_definition() {
00025     $options = parent::option_definition();
00026     $options['offset'] = array('default' => 0);
00027 
00028     return $options;
00029   }
00030 
00034   function options_form(&$form, &$form_state) {
00035     parent::options_form($form, $form_state);
00036     $form['offset'] = array(
00037       '#type' => 'textfield',
00038       '#title' => t('Offset'),
00039       '#description' => t('The number of items to skip. For example, if this field is 3, the first 3 items will be skipped and not displayed.'),
00040       '#default_value' => $this->options['offset'],
00041     );
00042   }
00043 
00044   function use_pager() {
00045     return FALSE;
00046   }
00047 
00048   function use_count_query() {
00049     return FALSE;
00050   }
00051 
00052   function get_items_per_page() {
00053     return 0;
00054   }
00055 
00056   function execute_count_query(&$count_query) {
00057     // If we are displaying all items, never count. But we can update the count in post_execute.
00058   }
00059 
00060   function post_execute(&$result) {
00061     $this->total_items = count($result);
00062   }
00063 
00064   function query() {
00065     // The only query modifications we might do are offsets.
00066     if (!empty($this->options['offset'])) {
00067       $this->view->query->set_offset($this->options['offset']);
00068     }
00069   }
00070 }

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