function date_views_argument_handler::query in Date 8
Same name and namespace in other branches
- 7.3 date_views/includes/date_views_argument_handler.inc \date_views_argument_handler::query()
- 7 date_views/includes/date_views_argument_handler.inc \date_views_argument_handler::query()
- 7.2 date_views/includes/date_views_argument_handler.inc \date_views_argument_handler::query()
Set up the query for this argument.
The argument sent may be found at $this->argument.
Overrides date_views_argument_handler_simple::query
File
- date_views/
includes/ date_views_argument_handler.inc, line 142 - Date API views argument handler. This argument combines multiple date arguments into a single argument where all fields are controlled by the same date and can be combined with either AND or OR.
Class
- date_views_argument_handler
- Date API argument handler.
Code
function query($group_by = FALSE) {
// @TODO Not doing anything with $group_by yet, need to figure out what has to be done.
if ($this
->date_forbid()) {
return;
}
$this
->get_query_fields();
$this->query
->set_where_group($this->options['date_method'], $this->options['date_group']);
$this->granularity = $this->date_handler
->arg_granularity($this->argument);
$format = $this->date_handler
->views_formats($this->granularity, 'sql');
$this->placeholders = array();
if (!empty($this->query_fields)) {
// Use set_where_group() with the selected date_method
// of 'AND' or 'OR' to create the where clause.
foreach ($this->query_fields as $count => $query_field) {
$field = $query_field['field'];
$this->date_handler = $query_field['date_handler'];
$this->field = $field['field_name'];
$this->real_field = $field['field_name'];
$this->table = $field['table_name'];
$this->original_table = $field['table_name'];
if ($field['table_name'] != $this->table || !empty($this->relationship)) {
$this->table = $this->query
->ensure_table($field['table_name'], $this->relationship);
}
elseif (empty($this->relationship)) {
$this->table_alias = NULL;
}
parent::query($group_by);
$this->placeholders = array_merge($this->placeholders, $this->date_handler->placeholders);
}
}
}