| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 // $Id: views_plugin_style_summary_jump_menu.inc,v 1.1.2.2 2009/10/28 02:22:47 merlinofchaos Exp $ 3 /** 4 * @file 5 * Contains the default summary style plugin, which displays items in an HTML list. 6 */ 7 8 /** 9 * The default style plugin for summaries. 10 * 11 * @ingroup views_style_plugins 12 */ 13 class views_plugin_style_summary_jump_menu extends views_plugin_style { 14 function option_definition() { 15 $options = parent::option_definition(); 16 17 $options['count'] = array('default' => TRUE); 18 $options['hide'] = array('default' => FALSE); 19 $options['text'] = array('default' => t('Go'), 'translatable' => TRUE); 20 21 return $options; 22 } 23 24 function query() { 25 $this->view->set_items_per_page(0); 26 $this->view->set_use_pager(0); 27 } 28 29 function options_form(&$form, &$form_state) { 30 parent::options_form($form, $form_state); 31 $form['count'] = array( 32 '#type' => 'checkbox', 33 '#default_value' => !empty($this->options['count']), 34 '#title' => t('Display record count with link'), 35 ); 36 37 $form['hide'] = array( 38 '#type' => 'checkbox', 39 '#title' => t('Hide the "Go" button.'), 40 '#default_value' => !empty($this->options['hide']), 41 '#description' => t('If hidden, this button will only be hidden for users with javascript and the page will automatically jump when the select is changed.'), 42 ); 43 44 $form['text'] = array( 45 '#type' => 'textfield', 46 '#title' => t('Button text'), 47 '#default_value' => $this->options['text'], 48 ); 49 } 50 51 function render() { 52 $argument = $this->view->argument[$this->view->build_info['summary_level']]; 53 54 $url_options = array(); 55 56 if (!empty($this->view->exposed_raw_input)) { 57 $url_options['query'] = $this->view->exposed_raw_input; 58 } 59 60 $options = array(); 61 foreach ($this->view->result as $id => $row) { 62 $args = $this->view->args; 63 $args[$argument->position] = $argument->summary_argument($row); 64 $path = url($this->view->get_url($args), $url_options); 65 66 $options[$path] = strip_tags($argument->summary_name($row)); 67 if (!empty($this->options['count'])) { 68 $options[$path] .= ' (' . intval($row->{$argument->count_alias}) . ')'; 69 } 70 } 71 72 ctools_include('jump-menu'); 73 $settings = array( 74 'hide' => $this->options['hide'], 75 'button' => $this->options['text'], 76 ); 77 78 return drupal_get_form('ctools_jump_menu', $options, $settings); 79 } 80 } 81
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |