You are here

function kaltura_views_handler_filter_kaltura_text::query in Kaltura 7.2

Same name and namespace in other branches
  1. 7.3 plugins/kaltura_views/kaltura_views_handler_filter_kaltura_text.inc \kaltura_views_handler_filter_kaltura_text::query()

Add this filter to the query.

Due to the nature of fapi, the value and the operator have an unintended level of indirection. You will find them in $this->operator and $this->value respectively.

Overrides views_handler_filter::query

File

plugins/kaltura_views/kaltura_views_handler_filter_kaltura_text.inc, line 48

Class

kaltura_views_handler_filter_kaltura_text
this filter extends the one filed string filter to add all of the text fileds in the kaltura db

Code

function query() {

  //parent::query();
  $this
    ->ensure_my_table();
  $field = "{$this->table_alias}.{$this->real_field}";
  $field1 = "{$this->table_alias}.kaltura_tags";
  $field2 = "{$this->table_alias}.kaltura_description";
  $concat = "({$field} OR  {$field1} OR  {$field2})";
  $placeholder = $this
    ->placeholder();
  $this->query
    ->add_where_expression($this->options['field'], "{$field} LIKE {$placeholder}", array(
    $placeholder => '%' . db_like($this->value) . '%',
  ));
  $this->query
    ->add_where_expression($this->options['field'], "{$field1} LIKE {$placeholder}", array(
    $placeholder => '%' . db_like($this->value) . '%',
  ));
  $this->query
    ->add_where_expression($this->options['field'], "{$field2} LIKE {$placeholder}", array(
    $placeholder => '%' . db_like($this->value) . '%',
  ));
  $this->query
    ->set_where_group('OR', $this->options['field']);
}