Stripping CVS keywords
[project/views.git] / modules / node / views_handler_argument_dates_various.inc
1 <?php
2 /**
3 * Argument handler for a full date (CCYYMMDD)
4 */
5 class views_handler_argument_node_created_fulldate extends views_handler_argument_date {
6 /**
7 * Constructor implementation
8 */
9 function construct() {
10 parent::construct();
11 $this->format = 'F j, Y';
12 $this->arg_format = 'Ymd';
13 $this->formula = views_date_sql_format($this->arg_format, "***table***.$this->real_field");
14 }
15
16 /**
17 * Provide a link to the next level of the view
18 */
19 function summary_name($data) {
20 $created = $data->{$this->name_alias};
21 return format_date(strtotime($created), 'custom', $this->format, 0);
22 }
23
24 /**
25 * Provide a link to the next level of the view
26 */
27 function title() {
28 return format_date(strtotime($this->argument), 'custom', $this->format, 0);
29 }
30 }
31
32 /**
33 * Argument handler for a year (CCYY)
34 */
35 class views_handler_argument_node_created_year extends views_handler_argument_date {
36 /**
37 * Constructor implementation
38 */
39 function construct() {
40 parent::construct();
41 $this->arg_format = 'Y';
42 $this->formula = views_date_sql_extract('YEAR', "***table***.$this->real_field");
43 }
44 }
45
46 /**
47 * Argument handler for a year plus month (CCYYMM)
48 */
49 class views_handler_argument_node_created_year_month extends views_handler_argument_date {
50 /**
51 * Constructor implementation
52 */
53 function construct() {
54 parent::construct();
55 $this->format = 'F Y';
56 $this->arg_format = 'Ym';
57 $this->formula = views_date_sql_format($this->arg_format, "***table***.$this->real_field");
58 }
59
60 /**
61 * Provide a link to the next level of the view
62 */
63 function summary_name($data) {
64 $created = $data->{$this->name_alias};
65 return format_date(strtotime($created . "15"), 'custom', $this->format, 0);
66 }
67
68 /**
69 * Provide a link to the next level of the view
70 */
71 function title() {
72 return format_date(strtotime($this->argument . "15"), 'custom', $this->format, 0);
73 }
74 }
75
76 /**
77 * Argument handler for a month (MM)
78 */
79 class views_handler_argument_node_created_month extends views_handler_argument_date {
80 /**
81 * Constructor implementation
82 */
83 function construct() {
84 parent::construct();
85 $this->formula = views_date_sql_extract('MONTH', "***table***.$this->real_field");
86 $this->format = 'F';
87 $this->arg_format = 'm';
88 }
89
90 /**
91 * Provide a link to the next level of the view
92 */
93 function summary_name($data) {
94 $month = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
95 return format_date(strtotime("2005" . $month . "15"), 'custom', $this->format);
96 }
97
98 /**
99 * Provide a link to the next level of the view
100 */
101 function title() {
102 $month = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
103 return format_date(strtotime("2005" . $month . "15"), 'custom', $this->format, 0);
104 }
105
106 function summary_argument($data) {
107 // Make sure the argument contains leading zeroes.
108 return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
109 }
110 }
111
112 /**
113 * Argument handler for a day (DD)
114 */
115 class views_handler_argument_node_created_day extends views_handler_argument_date {
116 /**
117 * Constructor implementation
118 */
119 function construct() {
120 parent::construct();
121 $this->formula = views_date_sql_extract('DAY', "***table***.$this->real_field");
122 $this->format = 'j';
123 $this->arg_format = 'd';
124 }
125
126 /**
127 * Provide a link to the next level of the view
128 */
129 function summary_name($data) {
130 $day = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
131 return format_date(strtotime("2005" . "05" . $day), 'custom', $this->format, 0);
132 }
133
134 /**
135 * Provide a link to the next level of the view
136 */
137 function title() {
138 $day = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
139 return format_date(strtotime("2005" . "05" . $day), 'custom', $this->format, 0);
140 }
141
142 function summary_argument($data) {
143 // Make sure the argument contains leading zeroes.
144 return str_pad($data->{$this->base_alias}, 2, '0', STR_PAD_LEFT);
145 }
146 }
147
148 /**
149 * Argument handler for a week.
150 */
151 class views_handler_argument_node_created_week extends views_handler_argument_date {
152 /**
153 * Constructor implementation
154 */
155 function construct() {
156 parent::construct();
157 $this->arg_format = 'w';
158 $this->formula = views_date_sql_extract('WEEK', "***table***.$this->real_field");
159 }
160
161 /**
162 * Provide a link to the next level of the view
163 */
164 function summary_name($data) {
165 $created = $data->{$this->name_alias};
166 return t('Week @week', array('@week' => $created));
167 }
168 }