You are here

function views_exclude_previous_handler_filter::query in Views exclude previous 7

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_in_operator::query

File

views/views_exclude_previous_handler_filter.inc, line 35
Class definition of views_exclude_previous_handler_filter.

Class

views_exclude_previous_handler_filter
@file Class definition of views_exclude_previous_handler_filter.

Code

function query() {
  $alias = $this->query
    ->ensure_table('node');
  if (!$alias) {
    return;
  }
  if (!$this->value) {
    return;
  }
  $excludes = array();
  foreach ($this->value as $category) {
    $excludes += _views_exclude_previous($category);
  }
  if (!empty($excludes)) {
    $this->query
      ->add_where($this->options['group'], $alias . '.nid', $excludes, 'NOT IN');
  }
}