You are here

function weight_handler_filter_weight::op_between in Weight 6

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

File

views/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} >= %d", $this->value['min']);
    $this->query
      ->add_where($this->options['group'], "{$field} <= %d", $this->value['max']);
  }
  else {
    $this->query
      ->add_where($this->options['group'], "{$field} <= %d OR {$field} >= %d", $this->value['min'], $this->value['max']);
  }
}