function date_views_filter_handler::admin_summary in Date 7
Same name and namespace in other branches
- 8 date_views/includes/date_views_filter_handler.inc \date_views_filter_handler::admin_summary()
- 7.3 date_views/includes/date_views_filter_handler.inc \date_views_filter_handler::admin_summary()
- 7.2 date_views/includes/date_views_filter_handler.inc \date_views_filter_handler::admin_summary()
Display the filter on the administrative summary.
Overrides views_handler_filter_numeric::admin_summary
File
- date_views/
includes/ date_views_filter_handler.inc, line 366 - A flexible, configurable date filter.
Class
- date_views_filter_handler
- This filter allows you to select a granularity of date parts to filter on, such as year, month, day, etc.
Code
function admin_summary() {
if (empty($this->options['date_fields'])) {
return t('Missing date fields!');
}
$handler = $this->date_handler;
$fields = date_views_fields($this->view->base_table);
if (!empty($this->options['date_fields'])) {
$output = array();
foreach ($this->options['date_fields'] as $field) {
if (array_key_exists($field, $fields['name'])) {
$output[] = $fields['name'][$field]['label'];
}
}
}
$field = implode(' ' . $this->options['date_method'] . ' ', $output);
$output = "{$field} " . check_plain($this->operator) . ' ';
$parts = $handler
->date_parts();
$widget_options = $this
->widget_options();
// If the filter is exposed, display the granularity.
if ($this->options['exposed']) {
return t('(@field) <strong>Exposed</strong> @widget @format', array(
'@field' => $field,
'@format' => $parts[$handler->granularity],
'@widget' => $widget_options[$this->options['form_type']],
));
}
// If not exposed, display the value.
if (in_array($this->operator, $this
->operator_values(2))) {
$min = check_plain(!empty($this->options['default_date']) ? $this->options['default_date'] : $this->options['value']['min']);
$max = check_plain(!empty($this->options['default_to_date']) ? $this->options['default_to_date'] : $this->options['value']['max']);
$output .= t('@min and @max', array(
'@min' => $min,
'@max' => $max,
));
}
else {
$output .= check_plain(!empty($this->options['default_date']) ? $this->options['default_date'] : $this->options['value']['value']);
}
return $output;
}