Tripal v1.0 (6.x-1.0)
tripal_views_handler_filter_sequence.inc
Go to the documentation of this file.
00001 <?php
00002 
00010 class tripal_views_handler_filter_sequence extends views_handler_filter {
00011  
00016   function value_form(&$form, &$form_state) {
00017     parent::value_form($form, $form_state);
00018 
00019     $this->value_form = array(
00020        '#type' => 'sequence_combo',
00021        '#title' => t('%label', array('%label' => $this->options['expose']['label'])),
00022        '#default_value' => $this->value,
00023        '#multiple' => FALSE,       
00024     );
00025     $form['value'] = &$this->value_form;
00026   }
00027 
00032   function exposed_form(&$form, &$form_state) {
00033 
00034     // don't do anything if the form isn't exposed.
00035     if (empty($this->options['exposed'])) {
00036       return;
00037     }
00038     // rebuild the form elements
00039     $value = $this->options['expose']['identifier'];
00040     $this->value_form($form, $form_state);
00041 
00042     $form[$value] = $form['value'];
00043     unset($form[$value]['#title']);
00044 
00045     $this->exposed_translate($form[$value], 'value');
00046 
00047     if ($value != 'value') {
00048       unset($form['value']);
00049     }
00050   }
00051 
00052  
00056   function query() {
00057     $this->ensure_my_table();
00058 
00059     $upstream = $this->value[0]['upstream'];
00060     $downstream = $this->value[0]['downstream'];       
00061     
00062     // we need the values provided by the user so that the field
00063     // handler can generate the results properly.  Saving these as session
00064     // variables may not be the best way but it works.
00065     if ($upstream) {
00066       $_SESSION['upstream'] = $upstream;
00067     }
00068     if ($downstream) {
00069       $_SESSION['downstream'] = $downstream;
00070     }    
00071   }
00072 }
 All Classes Files Functions Variables