function tripal_views_handler_filter_select_string::get_select_option_where

2.x tripal_views_handler_filter_select_string.inc tripal_views_handler_filter_select_string::get_select_option_where($table = NULL, $generic_placeholder = TRUE)
3.x tripal_views_handler_filter_select_string.inc tripal_views_handler_filter_select_string::get_select_option_where($table = NULL, $generic_placeholder = TRUE)

For the SQL generating the options, determine the WHERE clauses

Return value

An array of full qualified where clauses (ie: table.myfield = 'fred')

3 calls to tripal_views_handler_filter_select_string::get_select_option_where()
tripal_views_handler_filter_select_cvterm::get_select_option_where in tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc
For the SQL generating the options, determine the WHERE clauses
tripal_views_handler_filter_select_id::get_select_option_where in tripal_views/views/handlers/tripal_views_handler_filter_select_id.inc
For the SQL generating the options, determine the WHERE clauses
tripal_views_handler_filter_select_string::get_select_options in tripal_views/views/handlers/tripal_views_handler_filter_select_string.inc
Provide the options used in the select list. Override this function in extended handlers to easily change option list.
2 methods override tripal_views_handler_filter_select_string::get_select_option_where()
tripal_views_handler_filter_select_cvterm::get_select_option_where in tripal_views/views/handlers/tripal_views_handler_filter_select_cvterm.inc
For the SQL generating the options, determine the WHERE clauses
tripal_views_handler_filter_select_id::get_select_option_where in tripal_views/views/handlers/tripal_views_handler_filter_select_id.inc
For the SQL generating the options, determine the WHERE clauses

File

tripal_views/views/handlers/tripal_views_handler_filter_select_string.inc, line 128
Contains tripal_views_handler_filter_select_string Filter Handler

Class

tripal_views_handler_filter_select_string
This Handler provides a generic select list for any chado field that is a string The select list includes all distinct values for that field.

Code

function get_select_option_where($table = NULL, $generic_placeholder = TRUE) {

  $where = array();
  $values = array();

  $table = (is_null($table)) ? $this->table : $table;

  // Build a where clause that will filter the list in the drop box
  // using fields that are not exposed and that are for the table
  // from whcih the values in the drop box will be slected and
  // we only want to use non-exposed fields because these are not
  // available to the user to edit--they're fixed.
  $where = array();
  $filters = (is_array($this->view->filter)) ? $this->view->filter : array();
  $placeholder_prefix = 'arg';
  $i = 0;
  foreach ($filters as $filter_name => $details) {
    // we only want to inclue non-exposed filters
    if ($details->options['exposed'] == FALSE) {
      $i++;

      $value = $details->value;
      if (is_array($details->value) AND isset($details->value['value'])) {
        $value = $details->value['value'];
      }

      // Generate the current placeholder.
      if ($generic_placeholder) {
        $placeholder = ':' . $placeholder_prefix . $i;
      }
      else {
        $placeholder = $details->real_field;
      }

      // we only want to filter on the table we're getting the list from
      if (strcmp($details->table, $table) == 0 AND !empty($value)) {

        // If the value is an array then use IN instead of the choosen operator.
        if (is_array($value)) {
          $where[] = "$details->field IN ($placeholder)";
          $values[$placeholder] = $value;
        }
        // Otherwise, just use the operator choosen by the admin.
        else {
          $where[] = "$details->field $details->operator $placeholder";
          $values[$placeholder] = $value;
        }
      }
    }
  }

  return array(
    'where_clauses' => $where,
    'arguments' => $values
  );
}