Răsfoiți Sursa

Removed old views handlers that are no longer needed thanks to the new system where all chado tables are integrated

Lacey Sanderson 12 ani în urmă
părinte
comite
3d561c0a46
20 a modificat fișierele cu 0 adăugiri și 3330 ștergeri
  1. 0 6
      tripal_views/tripal_views.views.inc
  2. 0 76
      tripal_views/views/handlers/views_handler_argument_stockprop_id.inc
  3. 0 212
      tripal_views/views/handlers/views_handler_field_chado_rel_by_type.inc
  4. 0 105
      tripal_views/views/handlers/views_handler_field_chado_relationship_all.inc
  5. 0 166
      tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc
  6. 0 173
      tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc.orig
  7. 0 66
      tripal_views/views/handlers/views_handler_field_cvterm_name.inc
  8. 0 88
      tripal_views/views/handlers/views_handler_field_stock_dbxref_all.inc
  9. 0 161
      tripal_views/views/handlers/views_handler_field_stock_dbxref_by_type.inc
  10. 0 68
      tripal_views/views/handlers/views_handler_field_stockprop_all.inc
  11. 0 138
      tripal_views/views/handlers/views_handler_field_stockprop_by_type.inc
  12. 0 75
      tripal_views/views/handlers/views_handler_field_stockrel_all.inc
  13. 0 170
      tripal_views/views/handlers/views_handler_field_stockrel_by_type.inc
  14. 0 16
      tripal_views/views/handlers/views_handler_field_type_name.inc
  15. 0 245
      tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc
  16. 0 258
      tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc.orig
  17. 0 317
      tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
  18. 0 355
      tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc.orig
  19. 0 295
      tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
  20. 0 340
      tripal_views/views/handlers/views_handler_filter_stockprop_id.inc.orig

+ 0 - 6
tripal_views/tripal_views.views.inc

@@ -90,9 +90,6 @@ function tripal_views_views_handlers() {
       'views_handler_field_node_optional' => array(
         'parent' => 'views_handler_field_node',
       ),
-      'views_handler_field_cvterm_name' => array(
-        'parent' => 'views_handler_field',
-      ),
       'views_handler_field_chado_tf_boolean' => array(
         'parent' => 'views_handler_field_boolean',
       ),
@@ -102,9 +99,6 @@ function tripal_views_views_handlers() {
       'views_handler_filter_chado_boolean' => array(
         'parent' => 'views_handler_filter_boolean_operator',
       ),
-      'views_handler_field_chado_rel_by_type' => array(
-        'parent' => 'views_handler_field_prerender_list',
-      ),
       'views_handler_field_dbxref_accession_link' => array(
         'parent' => 'views_handler_field',
       ),

+ 0 - 76
tripal_views/views/handlers/views_handler_argument_stockprop_id.inc

@@ -1,76 +0,0 @@
-<?php
-
-/**
- * @file
- * Allows a stock property in the path to be used to filter a view
- *
- * @ingroup tripal_stock
- * @ingroup views_argument_handlers
- */
-class views_handler_argument_stockprop_id extends views_handler_argument_string {
-
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-    unset($form['glossary']);
-    unset($form['limit']);
-    unset($form['add_table']);
-    unset($form['require_value']);
-
-    //get options & display as options
-    $previous_db = tripal_db_set_active('chado');
-    $result = db_query("SELECT cvt.cvterm_id as type_id, cvt.name FROM cvterm cvt WHERE cvt.cvterm_id IN (SELECT type_id FROM stockprop)");
-    tripal_db_set_active($previous_db);
-    $types = array();
-    while ($r = db_fetch_object($result)) {
-      $types[$r->type_id] = $r->name;
-    }
-    $form['stockprop_type_id'] = array(
-      '#type' => 'radios',
-      '#title' => t('Property Types'),
-      '#options' => $types,
-      '#default_value' => $this->options['stockprop_type_id'],
-      '#required' => TRUE,
-      '#description' => t('Select the type of property represented by this argument.'),
-    );
-
-    $operators = array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-    $form['operator'] = array(
-      '#type' => 'radios',
-      '#title' => 'Operator',
-      '#description' => t('Specify how to compare the argument with the property values.'),
-      '#options' => $operators,
-      '#default_value' => $this->options['operator'],
-      '#required' => TRUE,
-    );
-  }
-
-  /**
-   * Build the query based upon the formula
-   */
-  function query() {
-    $argument = $this->argument;
-    if (!empty($this->options['transform_dash'])) {
-      $argument = strtr($argument, '-', ' ');
-    }
-
-    if (preg_match('/IS NOT NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->options['stockprop_type_id'] . ")";
-    }
-    elseif (preg_match('/IS NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id NOT IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->options['stockprop_type_id'] . ")";
-    }
-    else {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop "
-              . "WHERE stockprop.type_id=" . $this->options['stockprop_type_id'] . " AND stockprop.value" . $this->options['operator'] . "'" . $argument . "')";
-    }
-    $this->query->add_where($this->options['group'], $new_where_sql);
-  }
-
-}

+ 0 - 212
tripal_views/views/handlers/views_handler_field_chado_rel_by_type.inc

@@ -1,212 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all relationships of a specified type for a given chado entity to be displayed in
- * a single cell
- *
- * @ingroup views_field_handlers
- */
-class views_handler_field_chado_rel_by_type extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-
-    // Boolean to determine whether
-    //    TRUE =>  value (property type)      -more than one property type displayed
-    //    FALSE => or just value is rendered  -only 1 porperty type is displayed
-    $this->display_type = TRUE;
-
-    $this->chado_type = $this->table;
-
-    // Check that this chado type has a <chado type>_relationship table
-    $sql = "SELECT true as bool FROM pg_tables WHERE tablename='%s_relationship'";
-    $previous_db = tripal_db_set_active('chado');
-    $exists = db_fetch_object(db_query($sql, $this->table));
-    tripal_db_set_active($previous_db);
-    if (!$exists->bool) {
-      drupal_set_message(t('The Relationship by Type handler cannot be used with this table since the %table_relationship table doesn\'t exist', array('%table' => $this->table)), 'error');
-      $this->broken = TRUE;
-    }
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['rel_type_ids'] = array('default' => array());
-    $options['rel_display_options'] = array('default' => array('subject', 'type', 'object'));
-    return $options;
-  }
-
-  /**
-   * Provide "link to term" option.
-   */
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    if ($this->broken) {
-      $form = array(
-        'broken' => array(
-          '#type' => 'item',
-          '#value' => 'The Relationship by Type handler cannot be used with this table since the ' . $this->table . '_relationship table doesn\'t exist',
-        ),
-      );
-    }
-    else {
-      $form['rel_display_parts'] = array(
-        '#type' => 'checkboxes',
-        '#title' => t('Display Relationship Parts'),
-        '#description' => t('Check each part of the relationship you want displayed where the part '
-          .'of a relationship are: [Subject] [Relationship Type] [Object]. '
-          .'For example, with the relationship Sarah is the maternal parent of Fred '
-          .'if you checked only Object then "Fred" would be displayed.'),
-        '#options' => array(
-          'subject' => 'Subject',
-          'type' => 'Relationship Type',
-          'object' => 'Object',
-        ),
-        '#default_value' => array($this->options['rel_display_parts']['subject'], $this->options['rel_display_parts']['type'], $this->options['rel_display_parts']['object']),
-      );
-
-      $form['rel_display_rels'] = array(
-        '#type' => 'radios',
-        '#title' => t('Display Relationships Where'),
-        '#description' => t('Only relationships where the selected criteria is met will be shown. '
-          .'The parts of a relationship are: [Subject] [Relationship Type] [Object]. '
-          .'For example, with the relationships Sarah is the maternal parent of Fred and '
-          .'Fred is the paternal_parent of Max where Fred is the current ' . $this->chado_type . ', '
-          .'if you selected "Current ' . $this->chado_type . ' is the Object" only Sarah is the maternal parent of Fred'
-          .' would be displayed.'),
-        '#options' => array(
-          'subject' => 'Current ' . $this->chado_type . ' is the Subject',
-          'object' => 'Current ' . $this->chado_type . ' is the Object',
-          'all' => 'Current ' . $this->chado_type . ' is the Subject and/or Object',
-        ),
-        '#default_value' => $this->options['rel_display_rels'],
-      );
-
-      $options = array();
-      $sql = 'SELECT rel.type_id, cvt.name FROM %s_relationship rel LEFT JOIN cvterm cvt ON cvt.cvterm_id=rel.type_id GROUP BY rel.type_id,cvt.name';
-      $previous_db = tripal_db_set_active('chado');
-      $resource = db_query($sql, $this->table);
-      tripal_db_set_active($previous_db);
-      while ($r = db_fetch_object($resource)) {
-        $options[ $r->type_id ] = $r->name;
-      }
-      $form['rel_type_ids'] = array(
-        '#type' => 'checkboxes',
-        '#title' => t('Relationship Types'),
-        '#options' => $options,
-        '#default_value' => $this->options['rel_type_ids'],
-      );
-    }
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['relationships'] = $this->chado_type . '_relationships';
-    $chado_id = $this->table . '_id';
-    $chado_relationship_id = $this->table . '_relationship_id';
-    $this->aliases[$chado_id] = $chado_id;
-    $this->field_alias = $this->aliases[$chado_id];
-
-    //check if relationships added to results, if not then add
-    if (empty( $this->view->result[0]->{$this->aliases['relationships']} )) {
-
-      // retrieve the chado_id for each record in the views current page
-      $chado_ids = array();
-      foreach ($this->view->result as $row_num => $row) {
-        $chado_ids[$row_num] = $row->{$chado_id};
-      }
-
-      // Add relationships to the view results
-      $sql = "SELECT rel.*, cvterm.name as type_name, "
-        ."subject.name as subject_name, object.name as object_name "
-        ."FROM " . $this->table . "_relationship rel "
-        ."LEFT JOIN " . $this->table . " subject ON rel.subject_id=subject." . $chado_id . " "
-        ."LEFT JOIN " . $this->table . " object ON rel.object_id=object." . $chado_id . " "
-        ."LEFT JOIN cvterm cvterm ON rel.type_id = cvterm.cvterm_id "
-        ."WHERE rel.subject_id IN (" . implode(',', $chado_ids) . ") "
-        ."OR rel.object_id IN (" . implode(',', $chado_ids) . ") ";
-      $previous_db = tripal_db_set_active('chado');
-      $resource = db_query($sql);
-      tripal_db_set_active($previous_db);
-
-      while ($r = db_fetch_object($resource)) {
-        if (in_array($r->subject_id, $chado_ids)) {
-          $key = array_search($r->subject_id, $chado_ids);
-          $r->{$chado_id} = $r->subject_id;
-          $this->view->result[$key]->{$this->aliases['relationships']}[] = clone $r;
-        }
-        if (in_array($r->object_id, $chado_ids)) {
-          $key = array_search($r->object_id, $chado_ids);
-          $r->{$chado_id} = $r->object_id;
-          $this->view->result[$key]->{$this->aliases['relationships']}[] = clone $r;
-        }
-      }
-
-    }
-
-    // add relationships to this field
-    foreach ($this->view->result as $result) {
-      if (!empty($result->{$this->aliases['relationships']})) {
-        $relationships2keep = array_filter($this->options['rel_type_ids']);
-
-        // all relationships including the current chado guy
-        foreach ($result->{$this->aliases['relationships']} as $relationship) {
-          // perform filtering------
-          //type
-          if (!empty($this->options['rel_type_ids'])) {
-            if (!in_array($relationship->type_id, $relationships2keep)) {
-              continue;
-            }
-          }
-
-          //"Display Relationships Where" criteria
-          if (preg_match('/subject/', $this->options['rel_display_rels'])) {
-            if ($relationship->{$chado_id} != $relationship->subject_id) {
-              continue;
-            }
-          }
-          elseif (preg_match('/object/', $this->options['rel_display_rels'])) {
-            if ($relationship->{$chado_id} != $relationship->object_id) {
-              continue;
-            }
-          }
-
-          // Add relationship to the list of items to be rendered
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}][$chado_id] = $relationship->{$chado_id};
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}][$chado_relationship_id] = $relationship->{$chado_relationship_id};
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}]['subject_id'] = $relationship->subject_id;
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}]['subject_name'] = $relationship->subject_name;
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}]['object_id'] = $relationship->object_id;
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}]['object_name'] = $relationship->object_name;
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}]['type_id'] = $relationship->type_id;
-          $this->items[$relationship->{$chado_id}][$relationship->{$chado_relationship_id}]['type_name'] = $relationship->type_name;
-        }
-      }
-    }
-
-  }
-
-  function render_item($count, $item) {
-    $text = array();
-
-    // Render Parts
-    if ($this->options['rel_display_parts']['subject']) {
-      $text[] = $item['subject_name'];
-    }
-    if ($this->options['rel_display_parts']['type']) {
-      $text[] = $item['type_name'];
-    }
-    if ($this->options['rel_display_parts']['object']) {
-      $text[] = $item['object_name'];
-    }
-
-    return implode(' ', $text);
-  }
-}

+ 0 - 105
tripal_views/views/handlers/views_handler_field_chado_relationship_all.inc

@@ -1,105 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler for terms.
- */
-class views_handler_field_chado_relationship_all extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-  }
-
-  function query() {
-    // not sure why this is needed since nothing is added to the query...
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['relationships'] = 'relationships';
-    $this->aliases['primary_id'] = $this->view->base_table . '_id';
-    $this->field_alias = $this->aliases['primary_id'];
-    $relationship_tablename = $this->view->base_table . '_relationship';
-    $this->aliases['relationship_primary_id'] = $relationship_tablename  .  '_id';
-    $table_desc = module_invoke_all('chado_' . $relationship_tablename . '_schema');
-    foreach ($table_desc['foreign keys'][$this->view->base_table]['columns'] as $k => $v) {
-      if (preg_match('/subject/', $k)) {
-        $subject_id = $k;
-      }
-      if (preg_match('/object/', $k)) {
-        $object_id = $k;
-      }
-    }
-    $this->aliases['subject_id'] = $subject_id;
-    $this->aliases['object_id'] = $object_id;
-
-    //Add values for all if possible
-    if (!$this->view->result[0]->relationships) {
-      //get base table primary keys
-      $primary_ids = array();
-      foreach ($this->view->result as $row_num => $row) {
-        $primary_ids[$row_num] = $row->{$this->aliases['primary_id']};
-      }
-
-      //generate results from db
-      $sql = "SELECT " . $relationship_tablename . ".*, cvterm.name as type_name, "
-          ."subject_parent.name as subject_name, object_parent.name as object_name "
-          ."FROM " . $relationship_tablename . " "
-          ."LEFT JOIN " . $this->view->base_table . " subject_parent ON "
-            . $relationship_tablename . "." . $subject_id . "=subject_parent." . $this->aliases['primary_id'] . " "
-          ."LEFT JOIN " . $this->view->base_table . " object_parent ON "
-            . $relationship_tablename . "." . $object_id . "=object_parent." . $this->aliases['primary_id'] . " "
-          ."LEFT JOIN cvterm cvterm ON "
-            . $relationship_tablename . ".type_id = cvterm.cvterm_id "
-          ."WHERE " . $relationship_tablename . "." . $subject_id . " IN (" . implode(',', $primary_ids) . ") "
-          ."OR " . $relationship_tablename . "." . $object_id . " IN (" . implode(',', $primary_ids) . ") ";
-      $previous_db = tripal_db_set_active('chado');
-      $resource = db_query($sql);
-      tripal_db_set_active($previous_db);
-
-      //add results to views results
-      while ($r = db_fetch_object($resource)) {
-        if (in_array($r->{$subject_id}, $primary_ids)) {
-          $key = array_search($r->{$subject_id}, $primary_ids);
-          $r->{$this->aliases['primary_id']} = $r->{$subject_id};
-          $this->view->result[$key]->relationships[] = clone $r;
-        }
-        if (in_array($r->{$object_id}, $primary_ids)) {
-          $key = array_search($r->{$object_id}, $primary_ids);
-          $r->{$this->aliases['primary_id']} = $r->{$object_id};
-          $this->view->result[$key]->relationships[] = clone $r;
-        }
-      } //end of while
-    }// end of if add values
-
-    //for each stock in this view page, add the values
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['relationships']})) {
-
-        // all relationships including the current stock
-        $relationships = $result->{$this->aliases['relationships']};
-        foreach ($relationships as $relationship) {
-          // Add relationship to the list of items to be rendered
-          // Note: $this->aliases['primary_id'] = base table primary key
-
-          $elements = array(
-            $this->aliases['primary_id'] => $relationship->{$this->aliases['primary_id']},
-            $this->aliases['relationship_primary_id'] => $relationship->{$this->aliases['relationship_primary_id']},
-            'subject_id' => $relationship->{$this->aliases['subject_id']},
-            'subject_name' => $relationship->subject_name,
-            'object_id' => $relationship->{$this->aliases['object_id']},
-            'object_name' => $relationship->object_name,
-            'type_id' => $relationship->type_id,
-            'type_name' => $relationship->type_name,
-          );
-          $this->items[$relationship->{$this->aliases['primary_id']}][$relationship->{$this->aliases['relationship_primary_id']}] = $elements;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    return $item['subject_name'] . ' ' . $item['type_name'] . ' ' . $item['object_name'];
-  }
-
-}
-

+ 0 - 166
tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc

@@ -1,166 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler for terms.
- */
-class views_handler_field_chado_relationship_by_type extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-
-    // Boolean to determine whether
-    //    TRUE =>  value (property type)      -more than one property type displayed
-    //    FALSE => or just value is rendered  -only 1 porperty type is displayed
-    $this->display_type = TRUE;
-
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['stockrel_type_ids'] = array('default' => array());
-    $options['stockrel_display_options'] = array('default' => array('subject', 'type', 'object'));
-    return $options;
-  }
-
-  /**
-   * Provide "link to term" option.
-   */
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['stockrel_display_parts'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Display Relationship Parts'),
-      '#description' => t('Check each part of the relationship you want displayed where the part '
-        .'of a relationship are: \<Subject\> \<Relationship Type\> \<Object\>. '
-        .'For example, with the relationship Sarah is the maternal parent of Fred '
-        .'if you checked only Object then "Fred" would be displayed.'),
-      '#options' => array(
-        'subject' => 'Subject',
-        'type' => 'Relationship Type',
-        'object' => 'Object',
-      ),
-      '#default_value' => array($this->options['stockrel_display_parts']['subject'], $this->options['stockrel_display_parts']['type'], $this->options['stockrel_display_parts']['object']),
-    );
-
-    $form['stockrel_display_rels'] = array(
-      '#type' => 'radios',
-      '#title' => t('Display Relationships Where'),
-      '#description' => t('Only relationships where the selected criteria is met will be shown. '
-        .'The parts of a relationship are: \<Subject\> \<Relationship Type\> \<Object\>. '
-        .'For example, with the relationships Sarah is the maternal parent of Fred and '
-        .'Fred is the paternal_parent of Max where Fred is the current stock, '
-        .'if you selected "Current Stock is the Object" only Sarah is the maternal parent of Fred'
-        .' would be displayed.'),
-      '#options' => array(
-        'subject' => 'Current Stock is the Subject',
-        'object' => 'Current Stock is the Object',
-        'all' => 'Current Stock is the Subject and/or Object',
-      ),
-      '#default_value' => $this->options['stockrel_display_rels'],
-    );
-
-    $options = tripal_cv_get_cvterm_options( variable_get('chado_stock_relationship_cv', 'null') );
-    $form['stockrel_type_ids'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Relationship Types'),
-      '#options' => $options,
-      '#default_value' => $this->options['stockrel_type_ids'],
-    );
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['relationships'] = 'relationships';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['relationships']})) {
-
-        // all relationships including the current stock
-        $relationships = $result->{$this->aliases['relationships']};
-        foreach ($relationships as $relationship) {
-          // perform filtering------
-          //type
-          if (!empty($this->options['stockrel_type_ids'])) {
-            $relationships2keep = array_filter($this->options['stockrel_type_ids']);
-            if (!in_array($relationship->type_id, $relationships2keep)) {
-              continue;
-            }
-          }
-
-          //"Display Relationships Where" criteria
-          if (preg_match('/subject/', $this->options['stockrel_display_rels'])) {
-            if ($relationship->stock_id != $relationship->subject_id) {
-              continue;
-            }
-          }
-          elseif (preg_match('/object/', $this->options['stockrel_display_rels'])) {
-            if ($relationship->stock_id != $relationship->object_id) {
-              continue;
-            }
-          }
-
-          // Add relationship to the list of items to be rendered
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_id'] = $relationship->stock_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_relationship_id'] = $relationship->stock_relationship_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_id'] = $relationship->subject_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_name'] = $relationship->subject_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_id'] = $relationship->object_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_name'] = $relationship->object_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_id'] = $relationship->type_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_name'] = $relationship->type_name;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    $text = array();
-
-    // Render Parts
-    if ($this->options['stockrel_display_parts']['subject']) {
-      $text[] = $item['subject_name'];
-    }
-    if ($this->options['stockrel_display_parts']['type']) {
-      $text[] = $item['type_name'];
-    }
-    if ($this->options['stockrel_display_parts']['object']) {
-      $text[] = $item['object_name'];
-    }
-
-    return implode(' ', $text);
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = t('Relationship ID');
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = t('Subject ID');
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = t('Subject Name');
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = t('Object ID');
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = t('Object Name');
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = t('Type ID');
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = t('Type Name');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = $item['stock_relationship_id'];
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = $item['subject_id'];
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = $item['subject_name'];
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = $item['object_id'];
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = $item['object_name'];
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = $item['type_id'];
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = $item['type_name'];
-
-  }
-}
-

+ 0 - 173
tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc.orig

@@ -1,173 +0,0 @@
-<?php
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_field_chado_relationship_by_type.inc
-=======
-/**
- * @file
- * @todo Add file header description
- */
->>>>>>> 6.x-0.4-dev:tripal_natural_diversity/views/handlers/views_handler_field_chado_relationship_by_type.inc
-
-/**
- * @file
- * Field handler for terms.
- */
-class views_handler_field_chado_relationship_by_type extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-
-    // Boolean to determine whether
-    //    TRUE =>  value (property type)      -more than one property type displayed
-    //    FALSE => or just value is rendered  -only 1 porperty type is displayed
-    $this->display_type = TRUE;
-
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['stockrel_type_ids'] = array('default' => array());
-    $options['stockrel_display_options'] = array('default' => array('subject', 'type', 'object'));
-    return $options;
-  }
-
-  /**
-   * Provide "link to term" option.
-   */
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['stockrel_display_parts'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Display Relationship Parts'),
-      '#description' => t('Check each part of the relationship you want displayed where the part '
-        .'of a relationship are: \<Subject\> \<Relationship Type\> \<Object\>. '
-        .'For example, with the relationship Sarah is the maternal parent of Fred '
-        .'if you checked only Object then "Fred" would be displayed.'),
-      '#options' => array(
-        'subject' => 'Subject',
-        'type' => 'Relationship Type',
-        'object' => 'Object',
-      ),
-      '#default_value' => array($this->options['stockrel_display_parts']['subject'], $this->options['stockrel_display_parts']['type'], $this->options['stockrel_display_parts']['object']),
-    );
-
-    $form['stockrel_display_rels'] = array(
-      '#type' => 'radios',
-      '#title' => t('Display Relationships Where'),
-      '#description' => t('Only relationships where the selected criteria is met will be shown. '
-        .'The parts of a relationship are: \<Subject\> \<Relationship Type\> \<Object\>. '
-        .'For example, with the relationships Sarah is the maternal parent of Fred and '
-        .'Fred is the paternal_parent of Max where Fred is the current stock, '
-        .'if you selected "Current Stock is the Object" only Sarah is the maternal parent of Fred'
-        .' would be displayed.'),
-      '#options' => array(
-        'subject' => 'Current Stock is the Subject',
-        'object' => 'Current Stock is the Object',
-        'all' => 'Current Stock is the Subject and/or Object',
-      ),
-      '#default_value' => $this->options['stockrel_display_rels'],
-    );
-
-    $options = tripal_cv_get_cvterm_options( variable_get('chado_stock_relationship_cv', 'null') );
-    $form['stockrel_type_ids'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Relationship Types'),
-      '#options' => $options,
-      '#default_value' => $this->options['stockrel_type_ids'],
-    );
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['relationships'] = 'relationships';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['relationships']})) {
-
-        // all relationships including the current stock
-        $relationships = $result->{$this->aliases['relationships']};
-        foreach ($relationships as $relationship) {
-          // perform filtering------
-          //type
-          if (!empty($this->options['stockrel_type_ids'])) {
-            $relationships2keep = array_filter($this->options['stockrel_type_ids']);
-            if (!in_array($relationship->type_id, $relationships2keep)) {
-              continue;
-            }
-          }
-
-          //"Display Relationships Where" criteria
-          if (preg_match('/subject/', $this->options['stockrel_display_rels'])) {
-            if ($relationship->stock_id != $relationship->subject_id) {
-              continue;
-            }
-          }
-          elseif (preg_match('/object/', $this->options['stockrel_display_rels'])) {
-            if ($relationship->stock_id != $relationship->object_id) {
-              continue;
-            }
-          }
-
-          // Add relationship to the list of items to be rendered
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_id'] = $relationship->stock_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_relationship_id'] = $relationship->stock_relationship_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_id'] = $relationship->subject_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_name'] = $relationship->subject_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_id'] = $relationship->object_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_name'] = $relationship->object_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_id'] = $relationship->type_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_name'] = $relationship->type_name;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    $text = array();
-
-    // Render Parts
-    if ($this->options['stockrel_display_parts']['subject']) {
-      $text[] = $item['subject_name'];
-    }
-    if ($this->options['stockrel_display_parts']['type']) {
-      $text[] = $item['type_name'];
-    }
-    if ($this->options['stockrel_display_parts']['object']) {
-      $text[] = $item['object_name'];
-    }
-
-    return implode(' ', $text);
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = t('Relationship ID');
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = t('Subject ID');
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = t('Subject Name');
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = t('Object ID');
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = t('Object Name');
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = t('Type ID');
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = t('Type Name');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = $item['stock_relationship_id'];
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = $item['subject_id'];
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = $item['subject_name'];
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = $item['object_id'];
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = $item['object_name'];
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = $item['type_id'];
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = $item['type_name'];
-
-  }
-}
-

+ 0 - 66
tripal_views/views/handlers/views_handler_field_cvterm_name.inc

@@ -1,66 +0,0 @@
-<?php
-
-/**
- * @file
- * @ingroup views_field_handlers
- * @ingroup tripal_core
- */
-class views_handler_field_cvterm_name extends views_handler_field {
-
-  /**
-   * Add join to the cvterm table and cvterm.name field to the query
-   */
-  function query() {
-
-    // if this table isn't a base table
-    // if it is this can be done by describing a join between base table and cvterm
-    if (!preg_match('/^' . $this->view->base_table . '$/', $this->table)) {
-
-      //Want to add join: LEFT JOIN cvterm nd_experimentprop_cvterm ON nd_experimentprop.type_id = nd_experimentprop_cvterm.cvterm_id
-      //===============================================================
-
-      $this->query->ensure_table($this->table);
-
-      // add to table_queue--------------------------------------------
-      $cvterm_join['table'] = 'cvterm';
-      $cvterm_join['num'] = 1;
-      $cvterm_join['alias'] = $this->table . '_cvterm';
-      $cvterm_join['relationship'] = $this->table;
-
-      $cvterm_join['join'] = clone($this->query->table_queue[$this->table]['join']);
-      $cvterm_join['join']->table = 'cvterm';
-      $cvterm_join['join']->field = 'cvterm_id';
-      $cvterm_join['join']->left_table = $this->table;
-      $cvterm_join['join']->left_field = 'type_id';
-
-      $cvterm_join['join']->definition['table'] = 'cvterm';
-      $cvterm_join['join']->definition['field'] = 'cvterm_id';
-      $cvterm_join['join']->definition['left_table'] = $this->table;
-      $cvterm_join['join']->definition['left_field'] = 'type_id';
-
-      $this->query->table_queue[$cvterm_join['alias']] = $cvterm_join;
-
-      // add to table--------------------------------------------------
-      $this->query->tables[$this->view->base_table][$this->table . '_cvterm'] = array(
-        'count' => 1,
-        'alias' => $this->table . '_cvterm',
-      );
-
-      //Want to add field: nd_experimentprop_cvterm.name as nd_experimentprop_type
-      //===============================================================
-      $field_alias = $this->table . '_cvterm_name';
-      $this->query->add_field($this->table . '_cvterm', 'name');
-      $this->add_additional_fields();
-      $this->aliases['name'] = $field_alias;
-
-    }
-  }
-
-  /**
-   * Ensure that the type/cvterm name is rendered
-   */
-  function render($values) {
-    return $values->{$this->aliases['name']};
-  }
-
-}

+ 0 - 88
tripal_views/views/handlers/views_handler_field_stock_dbxref_all.inc

@@ -1,88 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all database references for a given stock to be displayed in a single cell
- *
- * This handler only deals with database references joined to the stock through stock_dbxref. For
- * the database reference joined to the stock by stock.dbxref_id simply join to the dbxref table.
- *
- * @ingroup tripal_stock
- * @ingroup views_field_handlers
- */
-class views_handler_field_stock_dbxref_all extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['dbxref'] = 'dbxref';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['dbxref']})) {
-
-        // all dbxrefs including the current stock
-        $dbxrefs = $result->{$this->aliases['dbxref']};
-        foreach ($dbxrefs as $dbxref) {
-          // Add dbxref to the list of items to be rendered
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['stock_id'] = $dbxref->stock_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['stock_dbxref_id'] = $dbxref->stock_dbxref_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['dbxref_id'] = $dbxref->dbxref_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['is_current'] = $dbxref->is_current;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['db_id'] = $dbxref->db_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['db_name'] = $dbxref->db_name;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['urlprefix'] = $dbxref->urlprefix;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['accession'] = $dbxref->accession;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['version'] = $dbxref->version;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['description'] = $dbxref->description;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    if (!empty($item['urlprefix'])) {
-      return l($item['accession'], $item['urlprefix'] . $item['accession']) . ' (' . $item['db_name'] . ')';
-    }
-    else {
-      return $item['accession'] . ' (' . $item['db_name'] . ')';
-    }
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stock_dbxref_id' . ']'] = t('Stock Database Reference ID');
-    $tokens['[' . $this->options['id'] . '-dbxref_id' . ']'] = t('Database Reference ID');
-    $tokens['[' . $this->options['id'] . '-is_current' . ']'] = t('Is Current');
-    $tokens['[' . $this->options['id'] . '-db_id' . ']'] = t('Database ID');
-    $tokens['[' . $this->options['id'] . '-db_name' . ']'] = t('Database Name');
-    $tokens['[' . $this->options['id'] . '-urlprefix' . ']'] = t('URL Prefix');
-    $tokens['[' . $this->options['id'] . '-accession' . ']'] = t('Accession');
-    $tokens['[' . $this->options['id'] . '-version' . ']'] = t('Version');
-    $tokens['[' . $this->options['id'] . '-description' . ']'] = t('Description');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stock_dbxref_id' . ']'] = $item['stock_dbxref_id'];
-    $tokens['[' . $this->options['id'] . '-dbxref_id' . ']'] =  $item['dbxref_id'];
-    $tokens['[' . $this->options['id'] . '-is_current' . ']'] = $item['is_current'];
-    $tokens['[' . $this->options['id'] . '-db_id' . ']'] = $item['db_id'];
-    $tokens['[' . $this->options['id'] . '-db_name' . ']'] = $item['db_name'];
-    $tokens['[' . $this->options['id'] . '-urlprefix' . ']'] = $item['urlprefix'];
-    $tokens['[' . $this->options['id'] . '-accession' . ']'] = $item['accession'];
-    $tokens['[' . $this->options['id'] . '-version' . ']'] = $item['version'];
-    $tokens['[' . $this->options['id'] . '-description' . ']'] = $item['description'];
-  }
-}
-

+ 0 - 161
tripal_views/views/handlers/views_handler_field_stock_dbxref_by_type.inc

@@ -1,161 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all database references of a specified db for a given stock to be
- * displayed in a single cell.
- *
- * This handler only deals with database references joined to the stock through stock_dbxref. For
- * the database reference joined to the stock by stock.dbxref_id simply join to the dbxref table.
- *
- * @ingroup tripal_stock
- * @ingroup views_field_handlers
- */
-class views_handler_field_stock_dbxref_by_type extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-
-    // Boolean to determine whether
-    //    TRUE =>  value (property type)      -more than one property type displayed
-    //    FALSE => or just value is rendered  -only 1 porperty type is displayed
-    $this->display_type = TRUE;
-
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['stockprop_type_ids'] = array('default' => array());
-    $options['display_options'] = array('default' => array('accession', 'db_name', 'link'));
-    return $options;
-  }
-
-  /**
-   * Provide "link to term" option.
-   */
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['display_options'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Display DB Reference Parts'),
-      '#description' => t('Check each part of the database reference you want displayed where the parts '
-        ."of a database relationship are: \<Accession\> (\<Datbase Name\>). You can also specify whether the accession "
-        .'should be linked to the record in the database by checking "Link to External Record".'),
-      '#options' => array(
-        'accession' => 'Accession',
-        'db_name' => 'Database Name',
-        'link' => 'Link to External Record',
-      ),
-      '#default_value' => array($this->options['display_options']['accession'], $this->options['display_options']['db_name'], $this->options['display_options']['link']),
-    );
-
-    $db_options = tripal_db_get_db_options();
-    $db_options[0] = 'Select a Database';
-    ksort($db_options);
-    $form['db_ids'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Database'),
-      '#options' => $db_options,
-      '#default_value' => $this->options['db_ids'],
-    );
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['dbxref'] = 'dbxref';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['dbxref']})) {
-
-        // all dbxrefs including the current stock
-        $dbxrefs = $result->{$this->aliases['dbxref']};
-        foreach ($dbxrefs as $dbxref) {
-
-          // perform filtering
-          if (!empty($this->options['db_ids'])) {
-            $dbs2keep = array_filter($this->options['db_ids']);
-            if (!in_array($dbxref->db_id, $dbs2keep)) {
-              continue;
-            }
-          }
-
-          // Add dbxref to the list of items to be rendered
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['stock_id'] = $dbxref->stock_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['stock_dbxref_id'] = $dbxref->stock_dbxref_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['dbxref_id'] = $dbxref->dbxref_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['is_current'] = $dbxref->is_current;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['db_id'] = $dbxref->db_id;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['db_name'] = $dbxref->db_name;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['urlprefix'] = $dbxref->urlprefix;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['accession'] = $dbxref->accession;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['version'] = $dbxref->version;
-          $this->items[$dbxref->stock_id][$dbxref->stock_dbxref_id]['description'] = $dbxref->description;        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    $text = array();
-    if ($this->options['display_options']['link']) {
-      if ($this->options['display_options']['accession']) {
-        $text[] = l(t($item['accession']), $item['urlprefix'] . $item['accession']);
-      }
-      else {
-        $text[] = l(t('External Record'), $item['urlprefix'] . $item['accession']);
-      }
-    }
-    else {
-      if ($this->options['display_options']['accession']) {
-        $text[] = $item['accession'];
-      }
-    }
-
-
-    if ($this->options['display_options']['db_name']) {
-      $text[] = $item['db_name'];
-    }
-
-    if (sizeof($text) > 1) {
-      return $text[0] . ' (' . $text[1] . ')';
-    }
-    else {
-      return $text[0];
-    }
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stock_dbxref_id' . ']'] = t('Stock Database Reference ID');
-    $tokens['[' . $this->options['id'] . '-dbxref_id' . ']'] = t('Database Reference ID');
-    $tokens['[' . $this->options['id'] . '-is_current' . ']'] = t('Is Current');
-    $tokens['[' . $this->options['id'] . '-db_id' . ']'] = t('Database ID');
-    $tokens['[' . $this->options['id'] . '-db_name' . ']'] = t('Database Name');
-    $tokens['[' . $this->options['id'] . '-urlprefix' . ']'] = t('URL Prefix');
-    $tokens['[' . $this->options['id'] . '-accession' . ']'] = t('Accession');
-    $tokens['[' . $this->options['id'] . '-version' . ']'] = t('Version');
-    $tokens['[' . $this->options['id'] . '-description' . ']'] = t('Description');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stock_dbxref_id' . ']'] = $item['stock_dbxref_id'];
-    $tokens['[' . $this->options['id'] . '-dbxref_id' . ']'] =  $item['dbxref_id'];
-    $tokens['[' . $this->options['id'] . '-is_current' . ']'] = $item['is_current'];
-    $tokens['[' . $this->options['id'] . '-db_id' . ']'] = $item['db_id'];
-    $tokens['[' . $this->options['id'] . '-db_name' . ']'] = $item['db_name'];
-    $tokens['[' . $this->options['id'] . '-urlprefix' . ']'] = $item['urlprefix'];
-    $tokens['[' . $this->options['id'] . '-accession' . ']'] = $item['accession'];
-    $tokens['[' . $this->options['id'] . '-version' . ']'] = $item['version'];
-    $tokens['[' . $this->options['id'] . '-description' . ']'] = $item['description'];
-  }
-}
-

+ 0 - 68
tripal_views/views/handlers/views_handler_field_stockprop_all.inc

@@ -1,68 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all properties for a given stock to be displayed in a single cell
- *
- * @ingroup tripal_stock
- * @ingroup views_field_handlers
- */
-class views_handler_field_stockprop_all extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['properties'] = 'properties';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['properties']})) {
-
-        // all properties for the current stock
-        $properties = $result->{$this->aliases['properties']};
-        foreach ($properties as $property) {
-          // Add property to the list of items to be rendered
-          $this->items[$property->stock_id][$property->stockprop_id]['stock_id'] = $property->stock_id;
-          $this->items[$property->stock_id][$property->stockprop_id]['stockprop_id'] = $property->stockprop_id;
-          $this->items[$property->stock_id][$property->stockprop_id]['type_id'] = $property->type_id;
-          $this->items[$property->stock_id][$property->stockprop_id]['type_name'] = check_plain($property->type_name);
-          $this->items[$property->stock_id][$property->stockprop_id]['value'] = check_plain($property->value);
-          $this->items[$property->stock_id][$property->stockprop_id]['rank'] = $property->rank;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    return $item['value'] . ' (' . $item['type_name'] . ')';
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stockprop_id' . ']'] = t('The Property ID.');
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = t('The Property Type ID.');
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = t('The Property Type.');
-    $tokens['[' . $this->options['id'] . '-value' . ']'] = t('The Value of the Property.');
-    $tokens['[' . $this->options['id'] . '-rank' . ']'] = t('The Rank of the Property.');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stockprop_id' . ']'] = $item['stockprop_id'];
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = $item['type_id'];
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = $item['type_name'];
-    $tokens['[' . $this->options['id'] . '-value' . ']'] = $item['value'];
-    $tokens['[' . $this->options['id'] . '-rank' . ']'] = $item['rank'];
-  }
-}
-

+ 0 - 138
tripal_views/views/handlers/views_handler_field_stockprop_by_type.inc

@@ -1,138 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all properties of a specified type for a given stock to be displayed in a
- * single cell
- *
- * @ingroup tripal_stock
- * @ingroup views_field_handlers
- */
-class views_handler_field_stockprop_by_type extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['stockprop_type_ids'] = array('default' => array());
-    $options['stockprop_display_options'] = array('default' => array('type', 'value'));
-    return $options;
-  }
-
-  /**
-   * Provide "link to term" option.
-   */
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['stockprop_display_options'] = array(
-      '#prefix' => '<div><div id="edit-options-display_options">',
-      '#suffix' => '</div></div>',
-      '#type' => 'checkboxes',
-      '#title' => t('Display Relationship Parts'),
-      '#description' => t('Check each part of the property you want displayed where the parts '
-        .'of a property are: <type> and <value>. '
-        .'For example, with the property temperature 54 degrees Celcius the type=temperature and the value=54 degrees Celcius. '
-        .'Thus, if you checked only value then "54 degrees Celcius" would be displayed.'),
-      '#options' => array(
-        'type' => 'Type',
-        'value' => 'Value',
-      ),
-      '#default_value' => array($this->options['stockprop_display_options']['type'], $this->options['stockprop_display_options']['value']),
-    );
-
-    $options = tripal_cv_get_cvterm_options( variable_get('chado_stock_prop_types_cv', 'null') );
-    $form['stockprop_type_ids'] = array(
-      '#prefix' => '<div><div id="edit-options-stockprop_type_ids">',
-      '#suffix' => '</div></div>',
-      '#type' => 'checkboxes',
-      '#title' => t('Property Types'),
-      '#options' => $options,
-      '#default_value' => $this->options['stockprop_type_ids'],
-    );
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['properties'] = 'properties';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['properties']})) {
-
-        // all properties for the current stock
-        $properties = $result->{$this->aliases['properties']};
-        foreach ($properties as $property) {
-          // perform filtering
-          if (!empty($this->options['stockprop_type_ids'])) {
-            $types2keep = array_filter($this->options['stockprop_type_ids']);
-            if (!in_array($property->type_id, $types2keep)) {
-              continue;
-            }
-          }
-
-          // Add property to the list of items to be rendered
-          $this->items[$property->stock_id][$property->stockprop_id]['stock_id'] = $property->stock_id;
-          $this->items[$property->stock_id][$property->stockprop_id]['stockprop_id'] = $property->stockprop_id;
-          $this->items[$property->stock_id][$property->stockprop_id]['type_id'] = $property->type_id;
-          $this->items[$property->stock_id][$property->stockprop_id]['type_name'] = check_plain($property->type_name);
-          $this->items[$property->stock_id][$property->stockprop_id]['value'] = check_plain($property->value);
-          $this->items[$property->stock_id][$property->stockprop_id]['rank'] = $property->rank;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    $text = array();
-
-    if ($this->options['stockprop_display_options']['value']) {
-      if ($item['value']) {
-        $text[] =  $item['value'];
-      }
-      else {
-        //display checkmark image
-        $image_path = drupal_get_path('module', 'tripal_core') . '/images/checkmark.gif';
-        $text[] = '<img border="0" src="' . url($image_path) . '" alt="checkmark" />';
-      }
-    }
-    if ($this->options['stockprop_display_options']['type']) {
-      $text[] = $item['type_name'];
-    }
-
-    if (sizeof($text) > 1) {
-      return $text[0] . ' (' . $text[1] . ')';
-    }
-    else {
-      return $text[0];
-    }
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stockprop_id' . ']'] = t('The Property ID.');
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = t('The Property Type ID.');
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = t('The Property Type.');
-    $tokens['[' . $this->options['id'] . '-value' . ']'] = t('The Value of the Property.');
-    $tokens['[' . $this->options['id'] . '-rank' . ']'] = t('The Rank of the Property.');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stockprop_id' . ']'] = $item['stockprop_id'];
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = $item['type_id'];
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = $item['type_name'];
-    $tokens['[' . $this->options['id'] . '-value' . ']'] = $item['value'];
-    $tokens['[' . $this->options['id'] . '-rank' . ']'] = $item['rank'];
-  }
-}
-

+ 0 - 75
tripal_views/views/handlers/views_handler_field_stockrel_all.inc

@@ -1,75 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all relationships for a given stock to be displayed in a single cell
- *
- * @ingroup tripal_stock
- * @ingroup views_field_handlers
- */
-class views_handler_field_stockrel_all extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['relationships'] = 'relationships';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['relationships']})) {
-
-        // all relationships including the current stock
-        $relationships = $result->{$this->aliases['relationships']};
-        foreach ($relationships as $relationship) {
-          // Add relationship to the list of items to be rendered
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_id'] = $relationship->stock_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_relationship_id'] = $relationship->stock_relationship_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_id'] = $relationship->subject_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_name'] = $relationship->subject_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_id'] = $relationship->object_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_name'] = $relationship->object_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_id'] = $relationship->type_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_name'] = $relationship->type_name;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    return $item['subject_name'] . ' ' . $item['type_name'] . ' ' . $item['object_name'];
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = t('Relationship ID');
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = t('Subject ID');
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = t('Subject Name');
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = t('Object ID');
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = t('Object Name');
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = t('Type ID');
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = t('Type Name');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = $item['stock_relationship_id'];
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = $item['subject_id'];
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = $item['subject_name'];
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = $item['object_id'];
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = $item['object_name'];
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = $item['type_id'];
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = $item['type_name'];
-
-  }
-}
-

+ 0 - 170
tripal_views/views/handlers/views_handler_field_stockrel_by_type.inc

@@ -1,170 +0,0 @@
-<?php
-
-/**
- * @file
- * Field handler allowing all relationships of a specified type for a given stock to be displayed in
- * a single cell
- *
- * @ingroup tripal_stock
- * @ingroup views_field_handlers
- */
-class views_handler_field_stockrel_by_type extends views_handler_field_prerender_list {
-  function init(&$view, $options) {
-    parent::init($view, $options);
-
-    // Boolean to determine whether
-    //    TRUE =>  value (property type)      -more than one property type displayed
-    //    FALSE => or just value is rendered  -only 1 porperty type is displayed
-    $this->display_type = TRUE;
-
-  }
-
-  function option_definition() {
-    $options = parent::option_definition();
-    $options['stockrel_type_ids'] = array('default' => array());
-    $options['stockrel_display_options'] = array('default' => array('subject', 'type', 'object'));
-    return $options;
-  }
-
-  /**
-   * Provide "link to term" option.
-   */
-  function options_form(&$form, &$form_state) {
-    parent::options_form($form, $form_state);
-
-    $form['stockrel_display_parts'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Display Relationship Parts'),
-      '#description' => t('Check each part of the relationship you want displayed where the part '
-        .'of a relationship are: \<Subject\> \<Relationship Type\> \<Object\>. '
-        .'For example, with the relationship Sarah is the maternal parent of Fred '
-        .'if you checked only Object then "Fred" would be displayed.'),
-      '#options' => array(
-        'subject' => 'Subject',
-        'type' => 'Relationship Type',
-        'object' => 'Object',
-      ),
-      '#default_value' => array($this->options['stockrel_display_parts']['subject'], $this->options['stockrel_display_parts']['type'], $this->options['stockrel_display_parts']['object']),
-    );
-
-    $form['stockrel_display_rels'] = array(
-      '#type' => 'radios',
-      '#title' => t('Display Relationships Where'),
-      '#description' => t('Only relationships where the selected criteria is met will be shown. '
-        .'The parts of a relationship are: \<Subject\> \<Relationship Type\> \<Object\>. '
-        .'For example, with the relationships Sarah is the maternal parent of Fred and '
-        .'Fred is the paternal_parent of Max where Fred is the current stock, '
-        .'if you selected "Current Stock is the Object" only Sarah is the maternal parent of Fred'
-        .' would be displayed.'),
-      '#options' => array(
-        'subject' => 'Current Stock is the Subject',
-        'object' => 'Current Stock is the Object',
-        'all' => 'Current Stock is the Subject and/or Object',
-      ),
-      '#default_value' => $this->options['stockrel_display_rels'],
-    );
-
-    $options = tripal_cv_get_cvterm_options( variable_get('chado_stock_relationship_cv', 'null') );
-    $form['stockrel_type_ids'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Relationship Types'),
-      '#options' => $options,
-      '#default_value' => $this->options['stockrel_type_ids'],
-    );
-  }
-
-  /**
-   * Add this term to the query
-   */
-  function query() {
-    $this->add_additional_fields();
-  }
-
-  function pre_render($values) {
-    $this->aliases['relationships'] = 'relationships';
-    $this->aliases['stock_id'] = 'stock_id';
-    $this->field_alias = $this->aliases['stock_id'];
-
-    //for each stock in this view page
-    foreach ($values as $result) {
-      if (!empty($result->{$this->aliases['relationships']})) {
-
-        // all relationships including the current stock
-        $relationships = $result->{$this->aliases['relationships']};
-        foreach ($relationships as $relationship) {
-          // perform filtering------
-          //type
-          if (!empty($this->options['stockrel_type_ids'])) {
-            $relationships2keep = array_filter($this->options['stockrel_type_ids']);
-            if (!in_array($relationship->type_id, $relationships2keep)) {
-              continue;
-            }
-          }
-
-          //"Display Relationships Where" criteria
-          if (preg_match('/subject/', $this->options['stockrel_display_rels'])) {
-            if ($relationship->stock_id != $relationship->subject_id) {
-              continue;
-            }
-          }
-          elseif (preg_match('/object/', $this->options['stockrel_display_rels'])) {
-            if ($relationship->stock_id != $relationship->object_id) {
-              continue;
-            }
-          }
-
-          // Add relationship to the list of items to be rendered
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_id'] = $relationship->stock_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['stock_relationship_id'] = $relationship->stock_relationship_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_id'] = $relationship->subject_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['subject_name'] = $relationship->subject_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_id'] = $relationship->object_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['object_name'] = $relationship->object_name;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_id'] = $relationship->type_id;
-          $this->items[$relationship->stock_id][$relationship->stock_relationship_id]['type_name'] = $relationship->type_name;
-        }
-      }
-    }
-  }
-
-  function render_item($count, $item) {
-    $text = array();
-
-    // Render Parts
-    if ($this->options['stockrel_display_parts']['subject']) {
-      $text[] = $item['subject_name'];
-    }
-    if ($this->options['stockrel_display_parts']['type']) {
-      $text[] = $item['type_name'];
-    }
-    if ($this->options['stockrel_display_parts']['object']) {
-      $text[] = $item['object_name'];
-    }
-
-    return implode(' ', $text);
-  }
-
-  function document_self_tokens(&$tokens) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = t('The Stock ID.');
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = t('Relationship ID');
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = t('Subject ID');
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = t('Subject Name');
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = t('Object ID');
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = t('Object Name');
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = t('Type ID');
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = t('Type Name');
-  }
-
-  function add_self_tokens(&$tokens, $item) {
-    $tokens['[' . $this->options['id'] . '-stock_id' . ']'] = $item['stock_id'];
-    $tokens['[' . $this->options['id'] . '-stock_relationship_id' . ']'] = $item['stock_relationship_id'];
-    $tokens['[' . $this->options['id'] . '-subject_id' . ']'] = $item['subject_id'];
-    $tokens['[' . $this->options['id'] . '-subject_name' . ']'] = $item['subject_name'];
-    $tokens['[' . $this->options['id'] . '-object_id' . ']'] = $item['object_id'];
-    $tokens['[' . $this->options['id'] . '-object_name' . ']'] = $item['object_name'];
-    $tokens['[' . $this->options['id'] . '-type_id' . ']'] = $item['type_id'];
-    $tokens['[' . $this->options['id'] . '-type_name' . ']'] = $item['type_name'];
-
-  }
-}
-

+ 0 - 16
tripal_views/views/handlers/views_handler_field_type_name.inc

@@ -1,16 +0,0 @@
-<?php
-
-/**
- * @file
- * @ingroup views_field_handlers
- * @ingroup tripal_core
- */
-class views_handler_field_type_name extends views_handler_field {
-  function construct() {
-    parent::construct();
-  }
-
-  function render($values) {
-    return $values->property_type_name;
-  }
-}

+ 0 - 245
tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc

@@ -1,245 +0,0 @@
-<?php
-
-/**
- * @file
- * Allows stocks to be filtered by associated database reference accession
- *
- * @ingroup tripal_stock
- * @ingroup views_filter_handlers
- */
-class views_handler_filter_stock_dbxref_id extends views_handler_filter {
-
-  function init(&$view, $options) {
-    parent::init($view, $options);
-    $this->db = $this->options['db'];
-  }
-
-  function options_form(&$form, &$form_state) {
-    if ($this->can_expose()) {
-      $this->show_expose_button($form, $form_state);
-    }
-
-    $form['op_val_start'] = array('#value' => '<div class="clear-block">');
-
-    $this->types_form($form, $form_state);
-
-    $this->show_operator_form($form, $form_state);
-    $form['operator']['#prefix'] = '<div class="views-right-70">';
-    $this->show_value_form($form, $form_state);
-    $form['op_val_end'] = array('#value' => '</div>');
-
-    if ($this->can_expose()) {
-      $this->show_expose_form($form, $form_state);
-    }
-
-  }
-
-  function query() {
-    $this-> db = array_filter($this->db);
-
-    if (preg_match('/IS NOT NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id IN "
-      ."(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id AND dbxref.db_id IN (" . implode(', ', $this->db) . "))";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif (preg_match('/IS NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id NOT IN "
-      ."(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id AND dbxref.db_id IN (" . implode(', ', $this->db) . "))";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    else {
-      if (!empty($this->value)) {
-        $new_where_sql = "stock.stock_id IN "
-          ."(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id "
-          ."AND dbxref.db_id IN (" . implode(', ', $this->db) . ") AND dbxref.accession" . $this->operator . "'" . $this->value . "')";
-        $this->query->add_where($this->options['group'], $new_where_sql);
-      }
-    }
-  }
-
-  /////////// Form Parts/////////////////////////
-  function types_form(&$form, &$form_state) {
-
-    $db_options = tripal_db_get_db_options();
-    ksort($db_options);
-    $form['db'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Databases'),
-      '#options' => $db_options,
-      '#default_value' => $this->db,
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-    );
-
-  }
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-    $form['value'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Accession'),
-      '#default_value' => $this->value,
-    );
-  }
-
-  function operator_options() {
-    return array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    if (!empty($this->options['expose']['use_type']) && !empty($this->options['expose']['type'])) {
-      $type = $this->options['expose']['type'];
-      $form[$type] = array(
-        '#type' => 'select',
-        '#title' => t('Database References'),
-        '#options' => $this->type_options(),
-        '#default_value' => $this->type,
-      );
-
-      if (isset($form[$type]['#title'])) {
-        unset($form[$type]['#title']);
-      }
-    }
-
-    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator'])) {
-      $operator = $this->options['expose']['operator'];
-      $this->operator_form($form, $form_state);
-      $form[$operator] = $form['operator'];
-
-      if (isset($form[$operator]['#title'])) {
-        unset($form[$operator]['#title']);
-      }
-
-      $this->exposed_translate($form[$operator], 'operator');
-
-      unset($form['operator']);
-    }
-
-    if (!empty($this->options['expose']['identifier'])) {
-      $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']);
-      }
-    }
-  }
-
-  function expose_form_left(&$form, &$form_state) {
-    $form['expose']['label'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['label'],
-      '#title' => t('Label'),
-      '#size' => 40,
-    );
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-  }
-
-  function expose_form_right(&$form, &$form_state) {
-    if (!empty($form['type']['#type'])) {
-      $form['expose']['use_type'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock Database Reference'),
-        '#description' => t('When checked, the Database Reference will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_type']),
-      );
-      $form['expose']['type'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['type'],
-        '#title' => t('Database Reference identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this Database Reference.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-type' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['type'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    if (!empty($form['operator']['#type'])) {
-      $form['expose']['use_operator'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock operator'),
-        '#description' => t('When checked, the operator will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_operator']),
-      );
-      $form['expose']['operator'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['operator'],
-        '#title' => t('Operator identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-operator' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['operator'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['optional'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Optional'),
-      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
-      '#default_value' => $this->options['expose']['optional'],
-    );
-  }
-}
-

+ 0 - 258
tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc.orig

@@ -1,258 +0,0 @@
-<?php
-
-/**
- * @file
- * Allows stocks to be filtered by associated database reference accession
- *
- * @ingroup tripal_stock
- * @ingroup views_filter_handlers
- */
-class views_handler_filter_stock_dbxref_id extends views_handler_filter {
-
-  function init(&$view, $options) {
-    parent::init($view, $options);
-    $this->db = $this->options['db'];
-  }
-
-  function options_form(&$form, &$form_state) {
-    if ($this->can_expose()) {
-      $this->show_expose_button($form, $form_state);
-    }
-
-    $form['op_val_start'] = array('#value' => '<div class="clear-block">');
-
-    $this->types_form($form, $form_state);
-
-    $this->show_operator_form($form, $form_state);
-    $form['operator']['#prefix'] = '<div class="views-right-70">';
-    $this->show_value_form($form, $form_state);
-    $form['op_val_end'] = array('#value' => '</div>');
-
-    if ($this->can_expose()) {
-      $this->show_expose_form($form, $form_state);
-    }
-
-  }
-
-  function query() {
-    $this-> db = array_filter($this->db);
-
-    if (preg_match('/IS NOT NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id IN "
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc
-      ."(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id AND dbxref.db_id IN (" . implode(', ', $this->db) . "))";
-=======
-      . "(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id AND dbxref.db_id IN (" . implode(', ', $this->db) . "))";
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_dbxref_id.inc
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif (preg_match('/IS NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id NOT IN "
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc
-      ."(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id AND dbxref.db_id IN (" . implode(', ', $this->db) . "))";
-=======
-      . "(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id AND dbxref.db_id IN (" . implode(', ', $this->db) . "))";
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_dbxref_id.inc
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    else {
-      if (!empty($this->value)) {
-        $new_where_sql = "stock.stock_id IN "
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_dbxref_id.inc
-          ."(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id "
-          ."AND dbxref.db_id IN (" . implode(', ', $this->db) . ") AND dbxref.accession" . $this->operator . "'" . $this->value . "')";
-=======
-          . "(SELECT stock_dbxref.stock_id FROM stock_dbxref, dbxref WHERE stock_dbxref.dbxref_id=dbxref.dbxref_id "
-          . "AND dbxref.db_id IN (" . implode(', ', $this->db) . ") AND dbxref.accession" . $this->operator . "'" . $this->value . "')";
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_dbxref_id.inc
-        $this->query->add_where($this->options['group'], $new_where_sql);
-      }
-    }
-  }
-
-  /////////// Form Parts/////////////////////////
-  function types_form(&$form, &$form_state) {
-
-    $db_options = tripal_db_get_db_options();
-    ksort($db_options);
-    $form['db'] = array(
-      '#type' => 'checkboxes',
-      '#title' => t('Databases'),
-      '#options' => $db_options,
-      '#default_value' => $this->db,
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-    );
-
-  }
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-    $form['value'] = array(
-      '#type' => 'textfield',
-      '#title' => t('Accession'),
-      '#default_value' => $this->value,
-    );
-  }
-
-  function operator_options() {
-    return array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    if (!empty($this->options['expose']['use_type']) && !empty($this->options['expose']['type'])) {
-      $type = $this->options['expose']['type'];
-      $form[$type] = array(
-        '#type' => 'select',
-        '#title' => t('Database References'),
-        '#options' => $this->type_options(),
-        '#default_value' => $this->type,
-      );
-
-      if (isset($form[$type]['#title'])) {
-        unset($form[$type]['#title']);
-      }
-    }
-
-    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator'])) {
-      $operator = $this->options['expose']['operator'];
-      $this->operator_form($form, $form_state);
-      $form[$operator] = $form['operator'];
-
-      if (isset($form[$operator]['#title'])) {
-        unset($form[$operator]['#title']);
-      }
-
-      $this->exposed_translate($form[$operator], 'operator');
-
-      unset($form['operator']);
-    }
-
-    if (!empty($this->options['expose']['identifier'])) {
-      $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']);
-      }
-    }
-  }
-
-  function expose_form_left(&$form, &$form_state) {
-    $form['expose']['label'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['label'],
-      '#title' => t('Label'),
-      '#size' => 40,
-    );
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-  }
-
-  function expose_form_right(&$form, &$form_state) {
-    if (!empty($form['type']['#type'])) {
-      $form['expose']['use_type'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock Database Reference'),
-        '#description' => t('When checked, the Database Reference will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_type']),
-      );
-      $form['expose']['type'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['type'],
-        '#title' => t('Database Reference identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this Database Reference.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-type' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['type'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    if (!empty($form['operator']['#type'])) {
-      $form['expose']['use_operator'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock operator'),
-        '#description' => t('When checked, the operator will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_operator']),
-      );
-      $form['expose']['operator'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['operator'],
-        '#title' => t('Operator identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-operator' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['operator'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['optional'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Optional'),
-      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
-      '#default_value' => $this->options['expose']['optional'],
-    );
-  }
-}
-

+ 0 - 317
tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc

@@ -1,317 +0,0 @@
-<?php
-
-/**
- * @file
- * Filter stocks via stock_relationships
- */
-class views_handler_filter_stock_relationship_id extends views_handler_filter {
-
-  function query() {
-    if ($this->value) {
-
-      // get variable position
-      if ($this->options['fixed_position'] == 'subject_id') {
-        $this->options['variable_position'] = 'object_id';
-      }
-      else {
-        $this->options['variable_position'] = 'subject_id';
-      }
-
-      // determine if just checking presence
-      if (preg_match('/NULL/', $this->operator)) {
-          $where = 'stock.stock_id IN ('
-            .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
-            .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' AND type_id = ' . $this->options['type']
-          .')';
-          $this->query->add_where($this->options['group'], $where);
-      }
-      else {
-
-        // determine whether regex was requested
-        if ($this->operator == '~') {
-          $search_options = array('regex_columns' => array('name', 'uniquename'));
-          $this->operator = '=';
-        }
-        elseif ($this->operator == '!~') {
-          $search_options = array('regex_columns' => array('name', 'uniquename'));
-          $this->operator = '!=';
-        }
-        else {
-          $search_options = array();
-        }
-
-        // get fixed stock id(s)
-        $fixed_stock = tripal_core_chado_select('stock', array('stock_id'), array('uniquename' => $this->value), $search_options);
-        $fixed_stock_ids = array();
-        if ($fixed_stock[0]->stock_id) {
-          $fixed_stock_ids[] = $fixed_stock[0]->stock_id;
-        }
-        else {
-          $fixed_stock = tripal_core_chado_select('stock', array('stock_id'), array('name' => $this->value), $search_options);
-          if (sizeof($fixed_stock) > 1) {
-            foreach ($fixed_stock as $s) {
-              $fixed_stock_ids[] = $s->stock_id;
-            }
-          }
-          elseif (sizeof($fixed_stock) == 1) {
-            $fixed_stock_ids[] = $fixed_stock[0]->stock_id;
-          }
-        }
-
-        // determine operator
-        if ($this->operator == '=' && sizeof($fixed_stock_ids) > 1) {
-          $this->operator = 'IN';
-        }
-        elseif ($this->operator == '!=' && sizeof($fixed_stock_ids) > 1) {
-          $this->operator = 'NOT IN';
-        }
-
-        //generate where
-        if (sizeof($fixed_stock_ids) == 1) {
-          $where = 'stock.stock_id IN ('
-            .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
-            .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' ' . $fixed_stock_ids[0] . ' AND type_id = ' . $this->options['type']
-          .')';
-          $this->query->add_where($this->options['group'], $where);
-        }
-        elseif (sizeof($fixed_stock_ids) > 1) {
-          $where = 'stock.stock_id IN ('
-            .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
-            .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' (' . implode(', ', $fixed_stock_ids) . ') AND type_id = ' . $this->options['type']
-          .')';
-          $this->query->add_where($this->options['group'], $where);
-        }
-        else {
-          drupal_set_message(t('No stock with the name or uniquename %value was found -No filtering done.', array('%value' => $this->value)), 'error');
-        }
-      } //end of not just checking presence
-    }
-  }
-
-  function options_form(&$form, &$form_state) {
-
-    if ($this->can_expose()) {
-      $this->show_expose_button($form, $form_state);
-    }
-
-    $instructions = 'This filter allows you to enter a stock, the position of that stock in the '
-      .'relationship and relationship type and only stocks with a relationship of the type described '
-      .'will be shown. For example, if you want all stocks where Fred is_paternal_parent_of, then '
-      .'you would enter Fred as the value, select is_paternal_parent_of as the Relationship Type '
-      .'and subject as the Fixed Position.';
-    $form['instructions'] = array(
-      '#type' => 'item',
-      '#value' => t($instructions)
-    );
-
-    $form['op_val_start'] = array('#value' => '<div class="clear-block">');
-
-    // left side
-
-    $this->types_form($form, $form_state);
-    $form['type']['#prefix'] = '<div class="views-left-50">';
-    $form['type']['#suffix'] = '</div>';
-
-    $this->show_operator_form($form, $form_state);
-    $form['operator']['#prefix'] = '<div class="views-right-50">';
-    $form['operator']['#suffix'] = '</div>';
-
-    $this->show_value_form($form, $form_state);
-    $form['value']['#prefix'] = '<div class="views-right-50">';
-    $form['value']['#suffix'] = '</div>';
-
-    // right side
-
-
-    $this->fixed_position_form($form, $form_state);
-    $form['fixed_position']['#prefix'] = '<div class="views-right-50">';
-    $form['fixed_position']['#suffix'] = '</div>';
-
-
-    if ($this->can_expose()) {
-      $this->show_expose_form($form, $form_state);
-    }
-
-    $form['op_val_start'] = array('#value' => '</div>');
-
-  }
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-    if ($this->options['label']) {
-      $label = $this->options['label'];
-    }
-    else {
-      $label = 'Stock Name';
-    }
-    $form['value'] = array(
-      '#type' => 'textfield',
-      '#title' => t('%label', array('%label' => $label)),
-      '#default_value' => $this->value,
-      '#size' => 40,
-    );
-
-  }
-
-  function type_options() {
-
-    $previous_db = tripal_db_set_active('chado');
-    $result = db_query("SELECT cvt.cvterm_id as type_id, cvt.name FROM {cvterm} cvt WHERE cvt.cvterm_id IN (SELECT type_id FROM {stock_relationship})");
-    tripal_db_set_active($previous_db);
-
-    $types = array();
-    while ($r = db_fetch_object($result)) {
-      $types[$r->type_id] = $r->name;
-    }
-
-    return $types;
-  }
-
-  function types_form(&$form, &$form_state) {
-
-    $form['type'] = array(
-      '#type' => count($options) < 10 ? 'radios' : 'select',
-      '#title' => t('Relationship Types'),
-      '#options' => $this->type_options(),
-      '#default_value' => $this->options['type'],
-    );
-
-  }
-
-  function fixed_position_form(&$form, &$form_state) {
-
-    $form['fixed_position'] = array(
-      '#type' => 'radios',
-      '#title' => 'Position of Stock to Filter on',
-      '#description' => t('Where a relationship consists of a subject type object, this field indicates '
-        .'what position in the relationship remains fixed (is the stock entered as the value).'),
-      '#options' => array(
-        'subject_id' => 'Subject',
-        'object_id' => 'Object'
-      ),
-      '#default_value' => ($this->options['fixed_position']) ? $this->options['fixed_position'] : 'subject_id',
-    );
-
-  }
-
-  function operator_options() {
-    return array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator'])) {
-      $operator = $this->options['expose']['operator'];
-      $this->operator_form($form, $form_state);
-      $form[$operator] = $form['operator'];
-
-      if (isset($form[$operator]['#title'])) {
-        unset($form[$operator]['#title']);
-      }
-
-      $this->exposed_translate($form[$operator], 'operator');
-
-      unset($form['operator']);
-    }
-
-    if (!empty($this->options['expose']['identifier'])) {
-      $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']);
-      }
-    }
-  }
-
-  function expose_form_left(&$form, &$form_state) {
-    $form['expose']['label'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['label'],
-      '#title' => t('Label'),
-      '#size' => 40,
-    );
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-  }
-
-  function expose_form_right(&$form, &$form_state) {
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    if (!empty($form['operator']['#type'])) {
-      $form['expose']['use_operator'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock operator'),
-        '#description' => t('When checked, the operator will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_operator']),
-      );
-      $form['expose']['operator'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['operator'],
-        '#title' => t('Operator identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-operator' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['operator'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['optional'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Optional'),
-      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
-      '#default_value' => $this->options['expose']['optional'],
-    );
-  }
-}

+ 0 - 355
tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc.orig

@@ -1,355 +0,0 @@
-<?php
-/**
- * @file
- * @todo Add file header description
- */
-
-/**
- * @file
- * Filter stocks via stock_relationships
- */
-class views_handler_filter_stock_relationship_id extends views_handler_filter {
-
-  function query() {
-    if ($this->value) {
-
-      // get variable position
-      if ($this->options['fixed_position'] == 'subject_id') {
-        $this->options['variable_position'] = 'object_id';
-      }
-      else {
-        $this->options['variable_position'] = 'subject_id';
-      }
-
-      // determine if just checking presence
-      if (preg_match('/NULL/', $this->operator)) {
-          $where = 'stock.stock_id IN ('
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
-            .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
-            .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' AND type_id = ' . $this->options['type']
-          .')';
-=======
-            . 'SELECT ' . $this->options['variable_position'] . ' FROM {stock_relationship} '
-            . 'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' AND type_id = ' . $this->options['type']
-          . ')';
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_relationship_id.inc
-          $this->query->add_where($this->options['group'], $where);
-      }
-      else {
-
-        // determine whether regex was requested
-        if ($this->operator == '~') {
-          $search_options = array('regex_columns' => array('name', 'uniquename'));
-          $this->operator = '=';
-        }
-        elseif ($this->operator == '!~') {
-          $search_options = array('regex_columns' => array('name', 'uniquename'));
-          $this->operator = '!=';
-        }
-        else {
-          $search_options = array();
-        }
-
-        // get fixed stock id(s)
-        $fixed_stock = tripal_core_chado_select('stock', array('stock_id'), array('uniquename' => $this->value), $search_options);
-        $fixed_stock_ids = array();
-        if ($fixed_stock[0]->stock_id) {
-          $fixed_stock_ids[] = $fixed_stock[0]->stock_id;
-        }
-        else {
-          $fixed_stock = tripal_core_chado_select('stock', array('stock_id'), array('name' => $this->value), $search_options);
-          if (sizeof($fixed_stock) > 1) {
-            foreach ($fixed_stock as $s) {
-              $fixed_stock_ids[] = $s->stock_id;
-            }
-          }
-          elseif (sizeof($fixed_stock) == 1) {
-            $fixed_stock_ids[] = $fixed_stock[0]->stock_id;
-          }
-        }
-
-        // determine operator
-        if ($this->operator == '=' && sizeof($fixed_stock_ids) > 1) {
-          $this->operator = 'IN';
-        }
-        elseif ($this->operator == '!=' && sizeof($fixed_stock_ids) > 1) {
-          $this->operator = 'NOT IN';
-        }
-
-        //generate where
-        if (sizeof($fixed_stock_ids) == 1) {
-          $where = 'stock.stock_id IN ('
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
-            .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
-            .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' ' . $fixed_stock_ids[0] . ' AND type_id = ' . $this->options['type']
-          .')';
-=======
-            . 'SELECT ' . $this->options['variable_position'] . ' FROM {stock_relationship} '
-            . 'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' ' . $fixed_stock_ids[0] . ' AND type_id = ' . $this->options['type']
-          . ')';
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_relationship_id.inc
-          $this->query->add_where($this->options['group'], $where);
-        }
-        elseif (sizeof($fixed_stock_ids) > 1) {
-          $where = 'stock.stock_id IN ('
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
-            .'SELECT ' . $this->options['variable_position'] . ' FROM stock_relationship '
-            .'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' (' . implode(', ', $fixed_stock_ids) . ') AND type_id = ' . $this->options['type']
-          .')';
-          $this->query->add_where($this->options['group'], $where);
-        }
-        else {
-          drupal_set_message(t('No stock with the name or uniquename %value was found -No filtering done.', array('%value' => $this->value)), 'error');
-=======
-            . 'SELECT ' . $this->options['variable_position'] . ' FROM {stock_relationship} '
-            . 'WHERE ' . $this->options['fixed_position'] . ' ' . $this->operator . ' (' . implode(', ', $fixed_stock_ids) . ') AND type_id = ' . $this->options['type']
-          . ')';
-          $this->query->add_where($this->options['group'], $where);
-        }
-        else {
-          drupal_set_message(t('No stock with the name or uniquename %value was found -No filtering done.',  array('%value' => $this->value ), 'error'));
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_relationship_id.inc
-        }
-      } //end of not just checking presence
-    }
-  }
-
-  function options_form(&$form, &$form_state) {
-
-    if ($this->can_expose()) {
-      $this->show_expose_button($form, $form_state);
-    }
-
-    $instructions = 'This filter allows you to enter a stock, the position of that stock in the '
-      .'relationship and relationship type and only stocks with a relationship of the type described '
-      .'will be shown. For example, if you want all stocks where Fred is_paternal_parent_of, then '
-      .'you would enter Fred as the value, select is_paternal_parent_of as the Relationship Type '
-      .'and subject as the Fixed Position.';
-    $form['instructions'] = array(
-      '#type' => 'item',
-      '#value' => t($instructions)
-    );
-
-    $form['op_val_start'] = array('#value' => '<div class="clear-block">');
-
-    // left side
-
-    $this->types_form($form, $form_state);
-    $form['type']['#prefix'] = '<div class="views-left-50">';
-    $form['type']['#suffix'] = '</div>';
-
-    $this->show_operator_form($form, $form_state);
-    $form['operator']['#prefix'] = '<div class="views-right-50">';
-    $form['operator']['#suffix'] = '</div>';
-
-    $this->show_value_form($form, $form_state);
-    $form['value']['#prefix'] = '<div class="views-right-50">';
-    $form['value']['#suffix'] = '</div>';
-
-    // right side
-
-
-    $this->fixed_position_form($form, $form_state);
-    $form['fixed_position']['#prefix'] = '<div class="views-right-50">';
-    $form['fixed_position']['#suffix'] = '</div>';
-
-
-    if ($this->can_expose()) {
-      $this->show_expose_form($form, $form_state);
-    }
-
-    $form['op_val_start'] = array('#value' => '</div>');
-
-  }
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
-    if (!$this->options['label']) {
-      $label = 'Stock Name';
-    }
-    else {
-      $label = $this->options['label'];
-=======
-    if ($this->options['label']) {
-      $label = $this->options['label'];
-    }
-    else {
-      $label = 'Stock Name';
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_relationship_id.inc
-    }
-    $form['value'] = array(
-      '#type' => 'textfield',
-      '#title' => t('%label', array('%label' => $label)),
-      '#default_value' => $this->value,
-      '#size' => 40,
-    );
-
-  }
-
-  function type_options() {
-
-    $previous_db = tripal_db_set_active('chado');
-    $result = db_query("SELECT cvt.cvterm_id as type_id, cvt.name FROM {cvterm} cvt WHERE cvt.cvterm_id IN (SELECT type_id FROM {stock_relationship})");
-    tripal_db_set_active($previous_db);
-
-    $types = array();
-    while ($r = db_fetch_object($result)) {
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stock_relationship_id.inc
-      $types[$r->type_id] = $r->name;
-    }
-=======
-    $types[$r->type_id] = $r->name; }
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stock_relationship_id.inc
-
-    return $types;
-  }
-
-  function types_form(&$form, &$form_state) {
-
-    $form['type'] = array(
-      '#type' => count($options) < 10 ? 'radios' : 'select',
-      '#title' => t('Relationship Types'),
-      '#options' => $this->type_options(),
-      '#default_value' => $this->options['type'],
-    );
-
-  }
-
-  function fixed_position_form(&$form, &$form_state) {
-
-    $form['fixed_position'] = array(
-      '#type' => 'radios',
-      '#title' => 'Position of Stock to Filter on',
-      '#description' => t('Where a relationship consists of a subject type object, this field indicates '
-        .'what position in the relationship remains fixed (is the stock entered as the value).'),
-      '#options' => array(
-        'subject_id' => 'Subject',
-        'object_id' => 'Object'
-      ),
-      '#default_value' => ($this->options['fixed_position']) ? $this->options['fixed_position'] : 'subject_id',
-    );
-
-  }
-
-  function operator_options() {
-    return array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator'])) {
-      $operator = $this->options['expose']['operator'];
-      $this->operator_form($form, $form_state);
-      $form[$operator] = $form['operator'];
-
-      if (isset($form[$operator]['#title'])) {
-        unset($form[$operator]['#title']);
-      }
-
-      $this->exposed_translate($form[$operator], 'operator');
-
-      unset($form['operator']);
-    }
-
-    if (!empty($this->options['expose']['identifier'])) {
-      $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']);
-      }
-    }
-  }
-
-  function expose_form_left(&$form, &$form_state) {
-    $form['expose']['label'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['label'],
-      '#title' => t('Label'),
-      '#size' => 40,
-    );
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-  }
-
-  function expose_form_right(&$form, &$form_state) {
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    if (!empty($form['operator']['#type'])) {
-      $form['expose']['use_operator'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock operator'),
-        '#description' => t('When checked, the operator will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_operator']),
-      );
-      $form['expose']['operator'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['operator'],
-        '#title' => t('Operator identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-operator' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['operator'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['optional'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Optional'),
-      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
-      '#default_value' => $this->options['expose']['optional'],
-    );
-  }
-}

+ 0 - 295
tripal_views/views/handlers/views_handler_filter_stockprop_id.inc

@@ -1,295 +0,0 @@
-<?php
-
-/**
- * @file
- * Allows stocks to be filtered by proeprty values
- *
- * @ingroup tripal_stock
- * @ingroup views_filter_handlers
- */
-class views_handler_filter_stockprop_id extends views_handler_filter {
-
-  function init(&$view, $options) {
-    parent::init($view, $options);
-    $this->type = $this->options['type'];
-  }
-
-  function options_form(&$form, &$form_state) {
-    if ($this->can_expose()) {
-      $this->show_expose_button($form, $form_state);
-    }
-
-    $form['op_val_start'] = array('#value' => '<div class="clear-block">');
-
-    $this->types_form($form, $form_state);
-
-    $this->show_operator_form($form, $form_state);
-    $form['operator']['#prefix'] = '<div class="views-right-70">';
-    $this->show_value_form($form, $form_state);
-    $form['op_val_end'] = array('#value' => '</div>');
-
-    if ($this->can_expose()) {
-      $this->show_expose_form($form, $form_state);
-    }
-
-  }
-
-  function options_validate(&$form, &$form_state) {
-    parent::options_validate($form, $form_state);
-
-    if (preg_match('/NULL/', $form_state['values']['options']['operator'])) {
-      $value = $form_state['values']['options']['value'];
-      if (!empty($value)) {
-        drupal_set_message(t('The Value (%value) will be IGNORED when the Operator is set to "Is Present" or Is Absent".', array('%value' => $value)), 'warning');
-      }
-    }
-    else {
-      $value = $form_state['values']['options']['value'];
-      if (empty($value)) {
-        form_error($form['value'], t('Value required. The value will be used in conjunction with the operator. For example, if the '
-           .'operator="Is equal to" and the value="2010" then only properties with a value of 2010 and the type specified will be displayed.'));
-      }
-    }
-
-    if (empty($form_state['values']['options']['type'])) {
-      drupal_set_message(t('No Property Type was choosen. As such, any property type whose value %op %value will be displayed.',
-        array('%op' => $form_state['values']['options']['operator'], '%value' => $form_state['values']['options']['value'])), 'warning');
-    }
-  }
-
-  function query() {
-    if (preg_match('/IS NOT NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . ")";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif (preg_match('/IS NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id NOT IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . ")";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif ($this->value) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . " AND stockprop.value" . $this->operator . "'" . $this->value . "')";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-
-  }
-
-  function types_form(&$form, &$form_state) {
-    $previous_db = tripal_db_set_active('chado');
-    $result = db_query("SELECT cvt.cvterm_id as type_id, cvt.name FROM {cvterm} cvt WHERE cvt.cvterm_id IN (SELECT type_id FROM {stockprop})");
-    tripal_db_set_active($previous_db);
-
-    $types = array();
-    while ($r = db_fetch_object($result)) {
-      $types[$r->type_id] = $r->name;
-    }
-
-    $form['type'] = array(
-      '#type' => count($options) < 10 ? 'radios' : 'select',
-      '#title' => t('Property Types'),
-      '#options' => $types,
-      '#default_value' => $this->type,
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-    );
-
-  }
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-    if ($this->options['expose']['display_type'] == 'select') {
-
-      // Get options
-      $previous_db = tripal_db_set_active('chado');
-      $resource = db_query("SELECT value FROM stockprop WHERE type_id=" . $this->type . " ORDER BY value");
-      tripal_db_set_active($previous_db);
-      while ($r = db_fetch_object($resource)) {
-        $options[$r->value] = $r->value;
-      }
-      $form['value'] = array(
-        '#type' => 'select',
-        '#title' => t('%label', array('%label' => $this->options['label'])),
-        '#options' => $options,
-        '#default_value' => $this->value,
-      );
-    }
-    else {
-      $form['value'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Value'),
-        '#default_value' => $this->value,
-      );
-    }
-  }
-
-  function operator_options() {
-    return array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    if (!empty($this->options['expose']['use_type']) && !empty($this->options['expose']['type'])) {
-      $type = $this->options['expose']['type'];
-      $form[$type] = array(
-        '#type' => 'select',
-        '#title' => t('Property Types'),
-        '#options' => $this->type_options(),
-        '#default_value' => $this->type,
-      );
-
-      if (isset($form[$type]['#title'])) {
-        unset($form[$type]['#title']);
-      }
-    }
-
-    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator'])) {
-      $operator = $this->options['expose']['operator'];
-      $this->operator_form($form, $form_state);
-      $form[$operator] = $form['operator'];
-
-      if (isset($form[$operator]['#title'])) {
-        unset($form[$operator]['#title']);
-      }
-
-      $this->exposed_translate($form[$operator], 'operator');
-
-      unset($form['operator']);
-    }
-
-    if (!empty($this->options['expose']['identifier'])) {
-      $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']);
-      }
-    }
-  }
-
-  function expose_form_left(&$form, &$form_state) {
-    $form['expose']['label'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['label'],
-      '#title' => t('Label'),
-      '#size' => 40,
-    );
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    $form['expose']['display_type'] = array(
-      '#type' => 'radios',
-      '#default_value' => $this->options['expose']['display_type'],
-      '#title' => t('Display Type'),
-      '#description' => t('This will change the form item type of the exposed value form. ie: it can be used to let the user select the property value from a select box rather than a textfield.'),
-      '#options' => array(
-        'textfield' => 'Text Field',
-        'select' => 'Drop Down',
-      ),
-    );
-  }
-
-  function expose_form_right(&$form, &$form_state) {
-    if (!empty($form['type']['#type'])) {
-      $form['expose']['use_type'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock Property Type'),
-        '#description' => t('When checked, the property type will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_type']),
-      );
-      $form['expose']['type'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['type'],
-        '#title' => t('Property Type identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this property type.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-type' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['type'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    if (!empty($form['operator']['#type'])) {
-      $form['expose']['use_operator'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock operator'),
-        '#description' => t('When checked, the operator will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_operator']),
-      );
-      $form['expose']['operator'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['operator'],
-        '#title' => t('Operator identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-operator' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['operator'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['optional'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Optional'),
-      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
-      '#default_value' => $this->options['expose']['optional'],
-    );
-  }
-
-
-}

+ 0 - 340
tripal_views/views/handlers/views_handler_filter_stockprop_id.inc.orig

@@ -1,340 +0,0 @@
-<?php
-
-/**
- * @file
- * Allows stocks to be filtered by proeprty values
- *
- * @ingroup tripal_stock
- * @ingroup views_filter_handlers
- */
-class views_handler_filter_stockprop_id extends views_handler_filter {
-
-  function init(&$view, $options) {
-    parent::init($view, $options);
-    $this->type = $this->options['type'];
-  }
-
-  function options_form(&$form, &$form_state) {
-    if ($this->can_expose()) {
-      $this->show_expose_button($form, $form_state);
-    }
-
-    $form['op_val_start'] = array('#value' => '<div class="clear-block">');
-
-    $this->types_form($form, $form_state);
-
-    $this->show_operator_form($form, $form_state);
-    $form['operator']['#prefix'] = '<div class="views-right-70">';
-    $this->show_value_form($form, $form_state);
-    $form['op_val_end'] = array('#value' => '</div>');
-
-    if ($this->can_expose()) {
-      $this->show_expose_form($form, $form_state);
-    }
-
-  }
-
-  function options_validate(&$form, &$form_state) {
-    parent::options_validate($form, $form_state);
-
-    if (preg_match('/NULL/', $form_state['values']['options']['operator'])) {
-      $value = $form_state['values']['options']['value'];
-      if (!empty($value)) {
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-        drupal_set_message(t('The Value (%value) will be IGNORED when the Operator is set to "Is Present" or Is Absent".', array('%value' => $value)), 'warning');
-=======
-        drupal_set_message(t('The Value %value will be IGNORED when the Operator is set to "Is Present" or Is Absent". ', array('%value' => $value), 'warning'));
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-      }
-    }
-    else {
-      $value = $form_state['values']['options']['value'];
-      if (empty($value)) {
-        form_error($form['value'], t('Value required. The value will be used in conjunction with the operator. For example, if the '
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-           .'operator="Is equal to" and the value="2010" then only properties with a value of 2010 and the type specified will be displayed.'));
-=======
-           . 'operator="Is equal to" and the value="2010" then only properties with a value of 2010 and the type specified will be displayed.'));
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-      }
-    }
-
-    if (empty($form_state['values']['options']['type'])) {
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-      drupal_set_message(t('No Property Type was choosen. As such, any property type whose value %op %value will be displayed.',
-        array('%op' => $form_state['values']['options']['operator'], '%value' => $form_state['values']['options']['value'])), 'warning');
-=======
-      drupal_set_message('No Property Type was choosen. As such, any property type whose value '
-                 . $form_state['values']['options']['operator'] . ' ' . $form_state['values']['options']['value'] . ' will be displayed', 'warning');
-    }
-  }
-
-  function query() {
-    if (preg_match('/IS NOT NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . ")";
-      $this->query->add_where($this->options['group'], $new_where_sql);
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-    }
-    elseif (preg_match('/IS NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id NOT IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . ")";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif ($this->value) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . " AND stockprop.value" . $this->operator . "'" . $this->value . "')";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-
-  }
-
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-  function query() {
-    if (preg_match('/IS NOT NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . ")";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif (preg_match('/IS NULL/', $this->options['operator'])) {
-      $new_where_sql = "stock.stock_id NOT IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . ")";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-    elseif ($this->value) {
-      $new_where_sql = "stock.stock_id IN (SELECT stockprop.stock_id FROM stockprop WHERE stockprop.type_id=" . $this->type . " AND stockprop.value" . $this->operator . "'" . $this->value . "')";
-      $this->query->add_where($this->options['group'], $new_where_sql);
-    }
-
-  }
-
-=======
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-  function types_form(&$form, &$form_state) {
-    $previous_db = tripal_db_set_active('chado');
-    $result = db_query("SELECT cvt.cvterm_id as type_id, cvt.name FROM {cvterm} cvt WHERE cvt.cvterm_id IN (SELECT type_id FROM {stockprop})");
-    tripal_db_set_active($previous_db);
-
-    $types = array();
-    while ($r = db_fetch_object($result)) {
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-      $types[$r->type_id] = $r->name;
-    }
-=======
-    $types[$r->type_id] = $r->name; }
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-
-    $form['type'] = array(
-      '#type' => count($options) < 10 ? 'radios' : 'select',
-      '#title' => t('Property Types'),
-      '#options' => $types,
-      '#default_value' => $this->type,
-      '#prefix' => '<div class="views-left-30">',
-      '#suffix' => '</div>',
-    );
-
-  }
-
-  function value_form(&$form, &$form_state) {
-    parent::value_form($form, $form_state);
-
-    if ($this->options['expose']['display_type'] == 'select') {
-
-      // Get options
-      $previous_db = tripal_db_set_active('chado');
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-      $resource = db_query("SELECT value FROM stockprop WHERE type_id=" . $this->type . " ORDER BY value");
-      tripal_db_set_active($previous_db);
-=======
-      $resource = db_query("SELECT value FROM {stockprop} WHERE type_id=" . $this->type . " ORDER BY value");
-     tripal_db_set_active($previous_db);
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-      while ($r = db_fetch_object($resource)) {
-        $options[$r->value] = $r->value;
-      }
-      $form['value'] = array(
-        '#type' => 'select',
-<<<<<<< HEAD:tripal_views/views/handlers/views_handler_filter_stockprop_id.inc
-        '#title' => t('%label', array('%label' => $this->options['label'])),
-=======
-        '#title' => t('%label', array('%title' => $this->options['label'])),
->>>>>>> 6.x-0.4-dev:tripal_stock/views/handlers/views_handler_filter_stockprop_id.inc
-        '#options' => $options,
-        '#default_value' => $this->value,
-      );
-    }
-    else {
-      $form['value'] = array(
-        '#type' => 'textfield',
-        '#title' => t('Value'),
-        '#default_value' => $this->value,
-      );
-    }
-  }
-
-  function operator_options() {
-    return array(
-      '=' => t('Is equal to'),
-      '!=' => t('Is not equal to'),
-      '~' => t('Contains'),
-      '!~' => t('Does not contain'),
-      'IS NOT NULL' => t('Is Present (Not Empty)'),
-      'IS NULL' => t('Is Absent (Empty)'),
-    );
-  }
-
- /**
-  * Render our chunk of the exposed filter form when selecting
-  */
-  function exposed_form(&$form, &$form_state) {
-    if (empty($this->options['exposed'])) {
-      return;
-    }
-
-    if (!empty($this->options['expose']['use_type']) && !empty($this->options['expose']['type'])) {
-      $type = $this->options['expose']['type'];
-      $form[$type] = array(
-        '#type' => 'select',
-        '#title' => t('Property Types'),
-        '#options' => $this->type_options(),
-        '#default_value' => $this->type,
-      );
-
-      if (isset($form[$type]['#title'])) {
-        unset($form[$type]['#title']);
-      }
-    }
-
-    if (!empty($this->options['expose']['use_operator']) && !empty($this->options['expose']['operator'])) {
-      $operator = $this->options['expose']['operator'];
-      $this->operator_form($form, $form_state);
-      $form[$operator] = $form['operator'];
-
-      if (isset($form[$operator]['#title'])) {
-        unset($form[$operator]['#title']);
-      }
-
-      $this->exposed_translate($form[$operator], 'operator');
-
-      unset($form['operator']);
-    }
-
-    if (!empty($this->options['expose']['identifier'])) {
-      $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']);
-      }
-    }
-  }
-
-  function expose_form_left(&$form, &$form_state) {
-    $form['expose']['label'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['label'],
-      '#title' => t('Label'),
-      '#size' => 40,
-    );
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    $form['expose']['display_type'] = array(
-      '#type' => 'radios',
-      '#default_value' => $this->options['expose']['display_type'],
-      '#title' => t('Display Type'),
-      '#description' => t('This will change the form item type of the exposed value form. ie: it can be used to let the user select the property value from a select box rather than a textfield.'),
-      '#options' => array(
-        'textfield' => 'Text Field',
-        'select' => 'Drop Down',
-      ),
-    );
-  }
-
-  function expose_form_right(&$form, &$form_state) {
-    if (!empty($form['type']['#type'])) {
-      $form['expose']['use_type'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock Property Type'),
-        '#description' => t('When checked, the property type will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_type']),
-      );
-      $form['expose']['type'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['type'],
-        '#title' => t('Property Type identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this property type.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-type' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['type'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['identifier'] = array(
-      '#type' => 'textfield',
-      '#default_value' => $this->options['expose']['identifier'],
-      '#title' => t('Filter identifier'),
-      '#size' => 40,
-      '#description' => t('This will appear in the URL after the ? to identify this filter. Cannot be blank.'),
-    );
-
-    if (!empty($form['operator']['#type'])) {
-      $form['expose']['use_operator'] = array(
-        '#type' => 'checkbox',
-        '#title' => t('Unlock operator'),
-        '#description' => t('When checked, the operator will be exposed to the user'),
-        '#default_value' => !empty($this->options['expose']['use_operator']),
-      );
-      $form['expose']['operator'] = array(
-        '#type' => 'textfield',
-        '#default_value' => $this->options['expose']['operator'],
-        '#title' => t('Operator identifier'),
-        '#size' => 40,
-        '#description' => t('This will appear in the URL after the ? to identify this operator.'),
-        '#process' => array('views_process_dependency'),
-        '#dependency' => array(
-          'edit-options-expose-use-operator' => array(1)
-        ),
-      );
-    }
-    else {
-      $form['expose']['operator'] = array(
-        '#type' => 'value',
-        '#value' => '',
-      );
-    }
-
-    $form['expose']['optional'] = array(
-      '#type' => 'checkbox',
-      '#title' => t('Optional'),
-      '#description' => t('This exposed filter is optional and will have added options to allow it not to be set.'),
-      '#default_value' => $this->options['expose']['optional'],
-    );
-  }
-
-
-}