-
Notifications
You must be signed in to change notification settings - Fork 0
/
tracker.views.inc
181 lines (175 loc) · 4.43 KB
/
tracker.views.inc
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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
132
133
134
135
136
137
138
139
140
141
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
171
172
173
174
175
176
177
178
179
180
181
<?php
/**
* @file
* Provide views data for tracker.module.
*
* @ingroup views_module_handlers
*/
/**
* Implements hook_views_data().
*/
function tracker_views_data() {
$data = array();
$data['tracker_node']['table']['group'] = t('Tracker');
$data['tracker_node']['table']['join'] = array(
'node' => array(
'type' => 'INNER',
'left_field' => 'nid',
'field' => 'nid',
),
);
$data['tracker_node']['nid'] = array(
'title' => t('Nid'),
'help' => t('The node ID of the node.'),
'field' => array(
'id' => 'node',
),
'argument' => array(
'id' => 'node_nid',
'name field' => 'title',
'numeric' => TRUE,
'validate type' => 'nid',
),
'filter' => array(
'id' => 'numeric',
),
'sort' => array(
'id' => 'standard',
),
);
$data['tracker_node']['published'] = array(
'title' => t('Published'),
'help' => t('Whether or not the node is published.'),
'field' => array(
'id' => 'boolean',
),
'filter' => array(
'id' => 'boolean',
'label' => t('Published'),
'type' => 'yes-no',
'accept null' => TRUE,
'use_equal' => TRUE,
),
'sort' => array(
'id' => 'standard',
),
);
$data['tracker_node']['changed'] = array(
'title' => t('Updated date'),
'help' => t('The date the node was last updated.'),
'field' => array(
'id' => 'date',
),
'sort' => array(
'id' => 'date',
),
'filter' => array(
'id' => 'date',
),
);
$data['tracker_user']['table']['group'] = t('Tracker - User');
$data['tracker_user']['table']['join'] = array(
'node' => array(
'type' => 'INNER',
'left_field' => 'nid',
'field' => 'nid',
),
'user' => array(
'type' => 'INNER',
'left_field' => 'uid',
'field' => 'uid',
),
);
$data['tracker_user']['nid'] = array(
'title' => t('Nid'),
'help' => t('The node ID of the node a user created or commented on. You must use an argument or filter on UID or you will get misleading results using this field.'),
'field' => array(
'id' => 'node',
),
'argument' => array(
'id' => 'node_nid',
'name field' => 'title',
'numeric' => TRUE,
'validate type' => 'nid',
),
'filter' => array(
'id' => 'numeric',
),
'sort' => array(
'id' => 'standard',
),
);
$data['tracker_user']['uid'] = array(
'title' => t('Uid'),
'help' => t('The user ID of a user who touched the node (either created or commented on it).'),
'field' => array(
'id' => 'user_name',
),
'argument' => array(
'id' => 'user_uid',
'name field' => 'name',
),
'filter' => array(
'title' => t('Name'),
'id' => 'user_name',
),
'sort' => array(
'id' => 'standard',
),
);
$data['tracker_user']['published'] = array(
'title' => t('Published'),
'help' => t('Whether or not the node is published. You must use an argument or filter on UID or you will get misleading results using this field.'),
'field' => array(
'id' => 'boolean',
),
'filter' => array(
'id' => 'boolean',
'label' => t('Published'),
'type' => 'yes-no',
'accept null' => TRUE,
'use_equal' => TRUE,
),
'sort' => array(
'id' => 'standard',
),
);
$data['tracker_user']['changed'] = array(
'title' => t('Updated date'),
'help' => t('The date the node was last updated or commented on. You must use an argument or filter on UID or you will get misleading results using this field.'),
'field' => array(
'id' => 'date',
),
'sort' => array(
'id' => 'date',
),
'filter' => array(
'id' => 'date',
),
);
return $data;
}
/**
* Implements hook_views_data_alter().
*/
function tracker_views_data_alter(&$data) {
// Provide additional uid_touch handlers which are handled by tracker
$data['node']['uid_touch_tracker'] = array(
'group' => t('Tracker - User'),
'title' => t('User posted or commented'),
'help' => t('Display nodes only if a user posted the node or commented on the node.'),
'argument' => array(
'field' => 'uid',
'name table' => 'users',
'name field' => 'name',
'id' => 'tracker_user_uid',
'no group by' => TRUE,
),
'filter' => array(
'field' => 'uid',
'name table' => 'users',
'name field' => 'name',
'id' => 'tracker_user_uid'
),
);
}