function date_api_filter_handler::admin_summary in Date 6
Same name and namespace in other branches
- 6.2 includes/date_api_filter_handler.inc \date_api_filter_handler::admin_summary()
File
- ./
date_api.views.inc, line 733 - Defines date-related Views data and plugins:
Class
- date_api_filter_handler
- A flexible, configurable date filter.
Code
function admin_summary() {
$handler = $this->date_handler;
$output = check_plain($this->operator) . ' ';
$parts = $handler
->date_parts();
// If the filter is exposed, display the granularity.
if ($this->options['exposed']) {
return t('<strong>Exposed</strong> Granularity: @format', array(
'@format' => $parts[$handler->granularity],
));
}
// If the filter is not exposed, display the selected values.
// Check both empty and is_numeric to show all non-blank values,
// including zero values.
$min = '';
$max = '';
$handler = $this->date_handler;
$separators = $handler
->part_info('sep');
if (in_array($this->operator, $this
->operator_values(2))) {
foreach ($handler
->date_parts($this->value['granularity']) as $key => $part) {
if (!empty($this->value['min' . $key]) || !empty($this->value['max' . $key]) || is_numeric($this->value['min' . $key]) || is_numeric($this->value['max' . $key])) {
$min .= $separators[$key] . check_plain($this->value['min' . $key]);
$max .= $separators[$key] . check_plain($this->value['max' . $key]);
}
}
$output .= t('@min and @max', array(
'@min' => $min,
'@max' => $max,
));
}
else {
foreach ($handler
->date_parts($handler->granularity) as $key => $part) {
if (!empty($this->value['value' . $key]) || is_numeric($this->value['value' . $key])) {
$min .= $separators[$key] . check_plain($this->value['value' . $key]);
}
}
$output .= $min;
}
return $output;
}