summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Stevenson2011-02-28 18:45:13 (GMT)
committer Karen Stevenson2011-02-28 18:45:13 (GMT)
commitf6a467c0da1db52cce8bb1eba4a0f070e4da29d8 (patch)
treeba6e8de19afaad71b2054e4e2987dd71688f084b
parentbdf89331de7de9e9f7bb594a6378fb295fc191d6 (diff)
Get simple summary views working correctly.
-rw-r--r--date_views/date_views.module2
-rw-r--r--date_views/includes/date_views_argument_handler.inc10
-rw-r--r--date_views/includes/date_views_argument_handler_simple.inc23
3 files changed, 24 insertions, 11 deletions
diff --git a/date_views/date_views.module b/date_views/date_views.module
index 6f9dd83..3c91c6f 100644
--- a/date_views/date_views.module
+++ b/date_views/date_views.module
@@ -218,9 +218,11 @@ function date_views_field_views_data_alter(&$result, $field, $module) {
foreach ($data as $column => $value) {
if (array_key_exists('argument', $value)) {
$result[$table][$column]['argument']['handler'] = 'date_views_argument_handler_simple';
+ $result[$table][$column]['argument']['empty field name'] = t('Undated');
}
if (array_key_exists('filter', $value)) {
$result[$table][$column]['filter']['handler'] = 'date_views_filter_handler_simple';
+ $result[$table][$column]['argument']['empty field name'] = t('Undated');
}
// The old 'entity_id' and 'revision_id' values got rewritten in Views.
// The old values are still there with a 'moved to' key, so ignore them.
diff --git a/date_views/includes/date_views_argument_handler.inc b/date_views/includes/date_views_argument_handler.inc
index 230786f..8430ce9 100644
--- a/date_views/includes/date_views_argument_handler.inc
+++ b/date_views/includes/date_views_argument_handler.inc
@@ -133,16 +133,6 @@ class date_views_argument_handler extends date_views_argument_handler_simple {
}
/**
- * Provide a link to the next level of the view from the summary.
- */
- function summary_name($data) {
- $format = $this->date_handler->views_formats($this->options['granularity'], 'display');
- $value = $data->{$this->name_alias};
- $range = $this->date_handler->arg_range($value);
- return date_format_date($range[0], 'custom', $format);
- }
-
- /**
* Provide the argument to use to link from the summary to the next level;
* this will be called once per row of a summary, and used as part of
* $view->get_url().
diff --git a/date_views/includes/date_views_argument_handler_simple.inc b/date_views/includes/date_views_argument_handler_simple.inc
index 2ef39fe..f2d9002 100644
--- a/date_views/includes/date_views_argument_handler_simple.inc
+++ b/date_views/includes/date_views_argument_handler_simple.inc
@@ -32,9 +32,12 @@ class date_views_argument_handler_simple extends views_handler_argument_date {
$this->date_handler->granularity = $this->options['granularity'];
// Set up the formula for this field.
- $this->arg_format = $this->date_handler->views_formats($this->date_handler->granularity, 'display');
+ $this->format = $this->date_handler->views_formats($this->date_handler->granularity, 'display');
+ $this->arg_format = $this->date_handler->views_formats($this->date_handler->granularity, 'sql');
$this->sql_format = $this->date_handler->views_formats($this->date_handler->granularity, 'sql');
$this->formula = $this->date_handler->sql_format($this->sql_format, $this->date_handler->sql_field("***table***.$this->real_field"));
+
+ $this->definition['empty field name'] = t('Undated');
}
/**
@@ -79,4 +82,22 @@ class date_views_argument_handler_simple extends views_handler_argument_date {
form_error($form['year_range'], t('Date year range must be in the format -9:+9, 2005:2010, -9:2010, or 2005:+9'));
}
}
+
+ /**
+ * Provide a link to the next level of the view from the summary.
+ */
+ function summary_name($data) {
+ $value = $data->{$this->name_alias};
+ if (empty($value) && !empty($this->definition['empty field name'])) {
+ return $this->definition['empty field name'];
+ }
+ $format = $this->date_handler->views_formats($this->options['granularity'], 'display');
+ $range = $this->date_handler->arg_range($value);
+ return date_format_date($range[0], 'custom', $format);
+ }
+
+
+
+
+
}