public function date_views_filter_handler_simple::op_simple in Date 7.3
Same name and namespace in other branches
- 8 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::op_simple()
- 7.2 date_views/includes/date_views_filter_handler_simple.inc \date_views_filter_handler_simple::op_simple()
@todo Document this.
Overrides views_handler_filter_date::op_simple
1 method overrides date_views_filter_handler_simple::op_simple()
- date_views_filter_handler::op_simple in date_views/
includes/ date_views_filter_handler.inc - @todo Document this.
File
- date_views/
includes/ date_views_filter_handler_simple.inc, line 202 - A standard Views filter for a single date field.
Class
- date_views_filter_handler_simple
- A standard Views filter for a single date field.
Code
public function op_simple($field) {
// Add the delta field to the view so we can later find the value that
// matched our query.
list($table_name, $field_name) = explode('.', $field);
if (!empty($this->options['add_delta']) && (substr($field_name, -6) == '_value' || substr($field_name, -7) == '_value2')) {
$this->query
->add_field($table_name, 'delta');
$real_field_name = str_replace(array(
'_value',
'_value2',
), '', $this->real_field);
$this->query
->add_field($table_name, 'entity_id', 'date_id_' . $real_field_name);
$this->query
->add_field($table_name, 'delta', 'date_delta_' . $real_field_name);
}
$value = $this
->get_filter_value('value', $this->value['value']);
$comp_date = new DateObject($value, date_default_timezone(), $this->format);
$field = $this->date_handler
->sql_field($field, NULL, $comp_date);
$field = $this->date_handler
->sql_format($this->format, $field);
$placeholder = $this
->placeholder();
$group = !empty($this->options['date_group']) ? $this->options['date_group'] : $this->options['group'];
$this->query
->add_where_expression($group, "{$field} {$this->operator} {$placeholder}", array(
$placeholder => $value,
));
}