You are here

function office_hours_handler_filter_day::query in Office Hours 7

Same name and namespace in other branches
  1. 6.2 includes/office_hours_handler_filter_day.inc \office_hours_handler_filter_day::query()
  2. 6 includes/office_hours_handler_filter_day.inc \office_hours_handler_filter_day::query()

File

includes/office_hours_handler_filter_day.inc, line 97
Implements Views integration: day filter.

Class

office_hours_handler_filter_day
@file Implements Views integration: day filter.

Code

function query() {
  if (empty($this->value)) {
    return;
  }
  $this
    ->ensure_my_table();
  $placeholder = !empty($this->definition['numeric']) ? '%d' : "'%s'";
  $replace = array_fill(0, sizeof($this->value), $placeholder);
  $in = ' (' . implode(", ", $replace) . ')';

  // We use array_values() because the checkboxes keep keys and that can cause
  // array addition problems.
  $this->query
    ->add_where($this->options['group'], "{$this->table_alias}.{$this->real_field} " . $this->operator . $in, array_keys($this->value));
}