You are here

function content_plugin_display_references::query in Content Construction Kit (CCK) 6.2

Same name and namespace in other branches
  1. 6.3 includes/views/handlers/content_plugin_display_simple.inc \content_plugin_display_references::query()

File

includes/views/handlers/content_plugin_display_simple.inc, line 22
Handler for 'content_simple' display.

Class

content_plugin_display_references

Code

function query() {
  $options = $this
    ->get_option('content_options');
  if ($options['string'] !== '') {
    $like = $GLOBALS["db_type"] == 'pgsql' ? "ILIKE" : "LIKE";
    $match_clauses = array(
      'contains' => "{$like} '%%%s%%'",
      'equals' => "= '%s'",
      'starts_with' => "{$like} '%s%%'",
    );
    $clause = isset($match_clauses[$options['match']]) ? $match_clauses[$options['match']] : $match_clauses['contains'];
    $alias = $this->view->query
      ->ensure_table($options['table']);
    $this->view->query
      ->add_where(NULL, "{$alias}.{$options['field_string']} {$clause}", $options['string']);
  }
  elseif ($options['ids']) {
    $alias = $this->view->query
      ->ensure_table($options['table']);
    $this->view->query
      ->add_where(NULL, "{$alias}.{$options['field_id']} IN (" . db_placeholders($options['ids']) . ')', $options['ids']);
  }
}