function views_database_connector_handler_filter_datetime::op_between in Views Database Connector 7
Overrides views_handler_filter_date::op_between
File
- views/
views_database_connector_handler_filter_datetime.inc, line 25
Class
Code
function op_between($field) {
if ($this->operator == 'between') {
$a = intval(strtotime($this->value['min'], 0));
$b = intval(strtotime($this->value['max'], 0));
}
else {
$a = intval(strtotime($this->value['max'], 0));
$b = intval(strtotime($this->value['min'], 0));
$this->query
->set_where_group('OR', $this->options['group']);
}
if ($this->value['type'] == 'offset') {
$now = time();
// keep sign
$a = $now + sprintf('%+d', $a);
// keep sign
$b = $now + sprintf('%+d', $b);
}
$a = $this
->format_date($a);
$b = $this
->format_date($b);
// %s is safe here because strtotime + format_date scrubbed the input
$this->query
->add_where($this->options['group'], $field, $a, '>=');
$this->query
->add_where($this->options['group'], $field, $b, '<=');
}