Selaa lähdekoodia

Organism common name filter now uses chado select string rather then an organism-specific handler

Lacey Sanderson 13 vuotta sitten
vanhempi
commit
0e63c4138a

+ 2 - 2
base/tripal_core/views/handlers/views_handler_filter_chado_select_string.inc

@@ -37,10 +37,10 @@ class views_handler_filter_chado_select_string extends views_handler_filter_stri
     
     // Get Options
     if ($this->options['exposed']) {    
-      $options['All'] = 'Any';
+      $options['All'] = '--Any--';
     }
     if ($this->options['optional']) {
-      $options['<select '.$this->table.'>'] = '<None>';
+      $options['<select '.$this->table.'>'] = '--None--';
     }
     $results = tripal_core_chado_select(
       $this->table,

+ 0 - 64
base/tripal_organism/views/handlers/views_handler_filter_organism_common_name.inc

@@ -1,64 +0,0 @@
-<?php
-
-class views_handler_filter_organism_common_name extends views_handler_filter_string {
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-    // Get Options
-    $options['<select organism>'] = '<None>';
-    if ($this->options['exposed']) {
-      $options['All'] = '<Any>';
-    }
-    $results = tripal_core_chado_select(
-      'organism',
-      array('common_name','abbreviation'),
-      array()
-    );
-    foreach ($results as $r) {
-      $options[$r->common_name] = $r->common_name . ' ('.$r->abbreviation.')';    
-    }
-    
-    //Select List
-    $form['value'] = array(
-        '#type' => 'select',
-        '#title' => $this->options['label'],
-        '#options' => $options,
-        '#default_value' => $this->value,
-    );
-    
-
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    $value = $this->options['expose']['identifier'];
-    $this->value_form($form, $form_state);
-    $form[$value] = $form['value'];
-
-    if (isset($form[$value]['#title']) && !empty($form[$value]['#type']) && $form[$value]['#type'] != 'checkbox') {
-      unset($form[$value]['#title']);
-    }
-
-    $this->exposed_translate($form[$value], 'value');
-
-    if (!empty($form['#type']) && ($form['#type'] == 'checkboxes' || ($form['#type'] == 'select' && !empty($form['#multiple'])))) {
-      unset($form[$value]['#default_value']);
-    }
-
-    if (!empty($form['#type']) && $form['#type'] == 'select' && empty($form['#multiple'])) {
-      $form[$value]['#default_value'] = 'All';
-    }
-
-    if ($value != 'value') {
-      unset($form['value']);
-    }
-
-  }
-}

+ 1 - 1
base/tripal_organism/views/organism.views.inc

@@ -186,7 +186,7 @@ function retrieve_organism_views_data() {
        'handler' => 'views_handler_sort',
      ),
      'filter' => array(
-       'handler' => 'views_handler_filter_organism_common_name',
+       'handler' => 'views_handler_filter_chado_select_string',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',