You are here

public function views_handler_filter_group_by_numeric::op_between in Views (for Drupal 7) 7.3

Same name and namespace in other branches
  1. 6.3 handlers/views_handler_filter_group_by_numeric.inc \views_handler_filter_group_by_numeric::op_between()

Overrides views_handler_filter_numeric::op_between

File

handlers/views_handler_filter_group_by_numeric.inc, line 31
Definition of views_handler_filter_group_by_numeric.

Class

views_handler_filter_group_by_numeric
Simple filter to handle greater than/less than filters

Code

public function op_between($field) {
  $placeholder_min = $this
    ->placeholder();
  $placeholder_max = $this
    ->placeholder();
  if ($this->operator == 'between') {
    $this->query
      ->add_having_expression($this->options['group'], "{$field} >= {$placeholder_min}", array(
      $placeholder_min => $this->value['min'],
    ));
    $this->query
      ->add_having_expression($this->options['group'], "{$field} <= {$placeholder_max}", array(
      $placeholder_max => $this->value['max'],
    ));
  }
  else {
    $this->query
      ->add_having_expression($this->options['group'], "{$field} <= {$placeholder_min} OR {$field} >= {$placeholder_max}", array(
      $placeholder_min => $this->value['min'],
      $placeholder_max => $this->value['max'],
    ));
  }
}