You are here

function weight_handler_filter_weight::op_between in Weight 7

Same name and namespace in other branches
  1. 6 views/weight_handler_filter_weight.inc \weight_handler_filter_weight::op_between()

Overrides views_handler_filter_numeric::op_between

File

./weight_handler_filter_weight.inc, line 9
Filter handler for Weight module.

Class

weight_handler_filter_weight
@file Filter handler for Weight module.

Code

function op_between($field) {

  // convert min value
  $this->value['min'] = -($this->value['min'] + 100);

  // convert max value
  $this->value['max'] = -($this->value['max'] + 100);

  // swap min and max
  $tmp = $this->value['max'];
  $this->value['max'] = $this->value['min'];
  $this->value['min'] = $tmp;
  unset($tmp);
  if ($this->operator == 'between') {
    $this->query
      ->add_where($this->options['group'], $field, array(
      $this->value['min'],
      $this->value['max'],
    ), 'BETWEEN');
  }
  else {
    $this->query
      ->add_where($this->options['group'], db_or()
      ->condition($field, $this->value['min'], '<=')
      ->condition($field, $this->value['max'], '>='));
  }
}