Newer
Older
The Great Git Migration
committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
// $Id$
/**
* Argument handler for a full date (CCYYMMDD)
*/
class views_handler_argument_node_created_fulldate extends views_handler_argument_date {
/**
* Constructor implementation
*/
function construct() {
parent::construct();
$this->format = 'F j, Y';
$this->arg_format = 'Ymd';
$this->formula = views_date_sql_format($this->arg_format, "***table***.$this->real_field");
}
/**
* Provide a link to the next level of the view
*/
function summary_name($data) {
$created = $data->{$this->name_alias};
return format_date(strtotime($created), 'custom', $this->format, 0);
}
/**
* Provide a link to the next level of the view
*/
function title() {
return format_date(strtotime($this->argument), 'custom', $this->format, 0);
}
}
/**
* Argument handler for a year (CCYY)
*/
class views_handler_argument_node_created_year extends views_handler_argument_date {
/**
* Constructor implementation
*/
function construct() {
parent::construct();
$this->arg_format = 'Y';
$this->formula = views_date_sql_extract('YEAR', "***table***.$this->real_field");
}
}
/**
* Argument handler for a year plus month (CCYYMM)
*/
class views_handler_argument_node_created_year_month extends views_handler_argument_date {
/**
* Constructor implementation
*/
function construct() {
parent::construct();
$this->format = 'F Y';
$this->arg_format = 'Ym';
$this->formula = views_date_sql_format($this->arg_format, "***table***.$this->real_field");
}
/**
* Provide a link to the next level of the view
*/
function summary_name($data) {
$created = $data->{$this->name_alias};
Earl Miles
committed
return format_date(strtotime($created . "15" . " 00:00:00 UTC"), 'custom', $this->format, 0);
The Great Git Migration
committed
}
/**
* Provide a link to the next level of the view
*/
function title() {
Earl Miles
committed
return format_date(strtotime($this->argument . "15" . " 00:00:00 UTC"), 'custom', $this->format, 0);
The Great Git Migration
committed
}
}
/**
* Argument handler for a month (MM)
*/
class views_handler_argument_node_created_month extends views_handler_argument_date {
/**
* Constructor implementation
*/
function construct() {
parent::construct();
$this->formula = views_date_sql_extract('MONTH', "***table***.$this->real_field");
$this->format = 'F';
$this->arg_format = 'm';
}
/**
* Provide a link to the next level of the view
*/
function summary_name($data) {
$month = str_pad($data->{$this->name_alias}, 2, '0', STR_PAD_LEFT);
Earl Miles
committed
return format_date(strtotime("2005" . $month . "15" . " 00:00:00 UTC" ), 'custom', $this->format);
The Great Git Migration
committed
}
/**
* Provide a link to the next level of the view
*/
function title() {
$month = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
Earl Miles
committed
return format_date(strtotime("2005" . $month . "15" . " 00:00:00 UTC"), 'custom', $this->format, 0);
The Great Git Migration
committed
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
}
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 day (DD)
*/
class views_handler_argument_node_created_day extends views_handler_argument_date {
/**
* Constructor implementation
*/
function construct() {
parent::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);
Earl Miles
committed
// strtotime respects server timezone, so we need to set the time fixed as utc time
return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 0);
The Great Git Migration
committed
}
/**
* Provide a link to the next level of the view
*/
function title() {
$day = str_pad($this->argument, 2, '0', STR_PAD_LEFT);
Earl Miles
committed
return format_date(strtotime("2005" . "05" . $day . " 00:00:00 UTC"), 'custom', $this->format, 0);
The Great Git Migration
committed
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
}
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 {
/**
* Constructor implementation
*/
function construct() {
parent::construct();
$this->arg_format = 'w';
$this->formula = views_date_sql_extract('WEEK', "***table***.$this->real_field");
}
/**
* Provide a link to the next level of the view
*/
function summary_name($data) {
$created = $data->{$this->name_alias};
return t('Week @week', array('@week' => $created));
}
}