/[drupal]/contributions/modules/activity_log/activity_log.views.inc
ViewVC logotype

Contents of /contributions/modules/activity_log/activity_log.views.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download) (as text)
Wed Sep 24 08:57:20 2008 UTC (14 months ago) by mercmobily
Branch: MAIN
CVS Tags: HEAD
Changes since 1.3: +115 -236 lines
File MIME type: text/x-php
First version UP
1 <?php
2
3 /*
4 http://www.garfieldtech.com/blog/drupal-handler-rfc
5 This is a general description of "handlers". Not specific to Views.
6
7 http://blue.live4all.co.il/~mooffie/tmp/views_illustrated/
8 This is a collection of notes I wrote. I have more stuff I'm planning to put there. But please don't distribute the link: it's a temporary address.
9
10 http://views.doc.logrus.com/
11 There's the inline documentation.
12
13 http://groups.drupal.org/views-developers
14 Ask for advice here as well.
15 */
16
17 function activity_log_views_handlers() {
18 return array(
19 'info' => array(
20 'path' => drupal_get_path('module', 'activity_log'),
21 ),
22 'handlers' => array(
23
24 /*
25 'views_handler_field_XXXXXX' => array(
26 'parent' => 'views_handler_field',
27 ),
28
29 */
30
31 ),
32 );
33
34 }
35
36
37
38 function activity_log_views_data(){
39
40 $data = array(
41
42 'activity_log' => array(
43
44 'table' => array(
45 'group' => t('Activity log'),
46
47 'base' => array(
48 'field' => 'aid',
49 'title' => t('Activities'),
50 'help' => t("User activities on the site"),
51 ),
52
53
54 ),
55
56
57 'aid' => array(
58 'title' => t('Activity ID'),
59 'help' => t('Activity ID'),
60 'field' => array(
61 'handler' => 'views_handler_field_numeric',
62 'click sortable' => FALSE,
63 ),
64 ),
65
66 'uid_creator' => array(
67 'title' => t('Creating User'),
68 'help' => t('The user who created the activity'),
69 'relationship' => array(
70 'base' => 'users',
71 'field' => 'uid',
72 'handler' => 'views_handler_relationship',
73 'label' => t('User'),
74 ),
75 ),
76
77 'uid_current' => array(
78 'real field' => 'uid',
79 'title' => t('Currently logged in user carried out the activity'),
80 'help' => t('The user who did the activity is the currently logged in user'),
81 'filter' => array(
82 'handler' => 'views_handler_filter_user_current',
83 ),
84 ),
85
86
87 'verb' => array(
88 'title' => t('Verb'),
89 'help' => t('The verb'),
90 'field' => array(
91 'handler' => 'views_handler_field',
92 ),
93 ),
94 'verb_you' => array(
95 'title' => t('Verb "you"'),
96 'help' => t('The verb to be used if the user is the viewer'),
97 'field' => array(
98 'handler' => 'views_handler_field',
99 ),
100 ),
101
102
103 'action' => array(
104 'title' => t('Action'),
105 'help' => t('The action'),
106 'field' => array(
107 'handler' => 'views_handler_field',
108 ),
109 ),
110 'action_multiple' => array(
111 'title' => t('Action Multiple'),
112 'help' => t('The action string to be used if there are several targets'),
113 'field' => array(
114 'handler' => 'views_handler_field',
115 ),
116 ),
117 'action_multiple_separator' => array(
118 'title' => t('Action Multiple Separator'),
119 'help' => t('The separator to be used between targets'),
120 'field' => array(
121 'handler' => 'views_handler_field',
122 ),
123 ),
124
125
126 'activity_timestamp' => array(
127 'title' => t('Activity timestamp'),
128 'help' => t('When the activity happened'),
129 'field' => array(
130 'handler' => 'views_handler_field_date',
131 'click sortable' => TRUE,
132 ),
133 'sort' => array(
134 'handler' => 'views_handler_sort_date',
135 ),
136 'filter' => array(
137 'handler' => 'views_handler_filter_date',
138 ),
139 ),
140
141
142
143 ),
144
145
146
147 'activity_log_targets' => array(
148
149 'table' => array(
150 'group' => t('Activity log targets'),
151
152 'base' => array(
153 'field' => 'atid',
154 'title' => t('Activities targets'),
155 'help' => t("Targets of an activity"),
156 ),
157
158 // FIXME: Not sure at all if this is the way to go
159 'join' => array(
160 'activity_log' => array(
161 'left_field' => 'aid',
162 'field' => 'aid',
163 ),
164 ),
165
166 ),
167
168 'aid' => array(
169 'title' => t('Activity ID'),
170 'help' => t('The activity of which this record is a target of'),
171 'relationship' => array(
172 'base' => 'activity_log',
173 'field' => 'aid',
174 'handler' => 'views_handler_relationship',
175 'label' => t('Activity Log'),
176 ),
177 ),
178
179 'uid_target' => array(
180 'title' => t('Target User'),
181 'help' => t('The user who was the target of the activity (if present)'),
182 'relationship' => array(
183 'base' => 'users',
184 'field' => 'uid',
185 'handler' => 'views_handler_relationship',
186 'label' => t('User'),
187 ),
188 ),
189
190 'uid_target_current' => array(
191 'real field' => 'uid_target',
192 'title' => t('Currently logged in user is the activity\'s recipient'),
193 'help' => t('The user who was the target of the activity is the currently logged in user'),
194 'filter' => array(
195 'handler' => 'views_handler_filter_user_current',
196 ),
197 ),
198
199
200
201 'oid_target_type' => array(
202 'title' => t('The type of oid'),
203 'help' => t('The type of oid, which can be a user, a comment or a node'),
204 'field' => array(
205 'handler' => 'views_handler_field',
206 ),
207 ),
208 'oid_target' => array(
209 'title' => t('ID of the target'),
210 'help' => t('The id of a comment, a node or a user'),
211 'field' => array(
212 'handler' => 'views_handler_field_numeric',
213 ),
214 ),
215
216
217 'target_timestamp' => array(
218 'title' => t('Target timestamp'),
219 'help' => t('When the target was added'),
220 'field' => array(
221 'handler' => 'views_handler_field_date',
222 'click sortable' => TRUE,
223 ),
224 'sort' => array(
225 'handler' => 'views_handler_sort_date',
226 ),
227 'filter' => array(
228 'handler' => 'views_handler_filter_date',
229 ),
230 ),
231
232 ),
233
234 );
235
236 return $data;
237
238 }
239
240
241 // THIS SHOULD LIVE IN THE friendlist_views module
242 //
243 function activity_log_views_data_alter(&$data){
244
245 // Add the right joins for the "friendlist_api" module
246 if ( module_exists('friendlist_api') ){
247 $data['activity_log']['table']['join']= array(
248 'friendlist_statuses' => array(
249 'left_field' => 'requestee_id',
250 'field' => 'uid',
251 )
252 );
253 }
254
255 }
256
257

  ViewVC Help
Powered by ViewVC 1.1.2