# HG changeset patch
# User Michael Gorven <michael@gorven.za.net>
# Date 1218396103 -7200
# Node ID bae3ec0be30df690b77c595d7585604587a55e84
# Parent  ee34d550e30044b941c86536e7057494c5b4fc31
Added day of month field.

diff -r ee34d550e300 -r bae3ec0be30d modules/node.views.inc
--- a/modules/node.views.inc	Sun Aug 10 21:00:03 2008 +0200
+++ b/modules/node.views.inc	Sun Aug 10 21:21:43 2008 +0200
@@ -313,6 +313,15 @@ function node_views_data() {
     'argument' => array(
       'field' => 'created',
       'handler' => 'views_handler_argument_node_created_month',
+    ),
+  );
+
+  $data['node']['created_day'] = array(
+    'title' => t('Created day'),
+    'help' => t('In the form of DD (01 - 31).'),
+    'argument' => array(
+      'field' => 'created',
+      'handler' => 'views_handler_argument_node_created_day',
     ),
   );
 
@@ -1008,6 +1017,41 @@ class views_handler_argument_node_create
 }
 
 /**
+ * Argument handler for a day (DD)
+ */
+class views_handler_argument_node_created_day extends views_handler_argument_date {
+  /**
+   * Constructor implementation
+   */
+  function construct() {
+    $this->formula = views_date_sql_extract('DAY', "***table***.$this->real_field");
+    $this->format = 'j';
+    $this->arg_format = 'd';
+  }
+
+  /**
+   * Provide a link to the next level of the view
+   */
+  function summary_name($data) {
+    $day = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
+    return format_date(strtotime("2005" . "05" . $day), 'custom', $this->format);
+  }
+
+  /**
+   * Provide a link to the next level of the view
+   */
+  function title() {
+    $day = str_pad($this->argument+1, 2, '0', STR_PAD_LEFT);
+    return format_date(strtotime("2005" . "05" . $day), 'custom', $this->format, 0);
+  }
+
+  function summary_argument($data) {
+    // Make sure the argument contains leading zeroes.
+    return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
+  }
+}
+
+/**
  * Argument handler for a week.
  */
 class views_handler_argument_node_created_week extends views_handler_argument_date {
