You are here

public function view_custom_table_handler_filter_date::op_between in Views Custom Table 7

Implements op_between().

Overrides views_handler_filter_numeric::op_between

File

views/handlers/view_custom_table_handler_filter_date.inc, line 175
Definition of views_handler_filter_date.

Class

view_custom_table_handler_filter_date
Filter to handle dates stored as a timestamp.

Code

public function op_between($field) {

  // Use the substitutions to ensure a consistent timestamp.
  $query_substitutions = views_views_query_substitutions($this->view);
  $a = intval(strtotime($this->value['min'], $query_substitutions['***CURRENT_TIME***']));
  $b = intval(strtotime($this->value['max'], $query_substitutions['***CURRENT_TIME***']));
  $a = date('Y-m-d H:i:s', $a);
  $b = date('Y-m-d H:i:s', $b);

  // This is safe because we are manually scrubbing the values.
  // It is necessary to do it this way because $a and $b are formulas when
  // using an offset.
  $operator = strtoupper($this->operator);
  $this->query
    ->add_where_expression($this->options['group'], "{$field} {$operator} '{$a}' AND '{$b}'");
}