Révision 5d12d676
Ajouté par Assos Assos il y a environ 6 ans
drupal7/sites/all/modules/views/modules/user.views.inc | ||
---|---|---|
12 | 12 |
*/ |
13 | 13 |
function user_views_data() { |
14 | 14 |
// ---------------------------------------------------------------- |
15 |
// users table |
|
16 |
|
|
17 |
// Define the base group of this table. Fields that don't |
|
18 |
// have a group defined will go into this field by default. |
|
15 |
// 'users' table. |
|
16 |
// Define the base group of this table. Fields that don't have a group |
|
17 |
// defined will go into this field by default. |
|
19 | 18 |
$data['users']['table']['group'] = t('User'); |
20 | 19 |
|
21 | 20 |
$data['users']['table']['base'] = array( |
... | ... | |
26 | 25 |
); |
27 | 26 |
$data['users']['table']['entity type'] = 'user'; |
28 | 27 |
|
29 |
|
|
30 | 28 |
$data['users']['table']['default_relationship'] = array( |
31 | 29 |
'node' => array( |
32 | 30 |
'table' => 'node', |
... | ... | |
42 | 40 |
), |
43 | 41 |
); |
44 | 42 |
|
45 |
// uid
|
|
43 |
// User ID / 'uid'.
|
|
46 | 44 |
$data['users']['uid'] = array( |
45 |
// The item it appears as on the UI, |
|
47 | 46 |
'title' => t('Uid'), |
48 |
'help' => t('The user ID'), // The help that appears on the UI, |
|
47 |
// The help that appears on the UI, |
|
48 |
'help' => t('The user ID'), |
|
49 | 49 |
'field' => array( |
50 | 50 |
'handler' => 'views_handler_field_user', |
51 | 51 |
'click sortable' => TRUE, |
52 | 52 |
), |
53 | 53 |
'argument' => array( |
54 | 54 |
'handler' => 'views_handler_argument_user_uid', |
55 |
'name field' => 'name', // display this field in the summary |
|
55 |
// Display this field in the summary. |
|
56 |
'name field' => 'name', |
|
56 | 57 |
), |
57 | 58 |
'filter' => array( |
58 | 59 |
'title' => t('Name'), |
... | ... | |
72 | 73 |
), |
73 | 74 |
); |
74 | 75 |
|
75 |
// uid_raw
|
|
76 |
// The raw user ID / 'uid_raw'.
|
|
76 | 77 |
$data['users']['uid_raw'] = array( |
77 | 78 |
'help' => t('The raw numeric user ID.'), |
78 | 79 |
'real field' => 'uid', |
... | ... | |
82 | 83 |
), |
83 | 84 |
); |
84 | 85 |
|
85 |
// uid
|
|
86 |
// Representative node for the user.
|
|
86 | 87 |
$data['users']['uid_representative'] = array( |
87 | 88 |
'relationship' => array( |
88 | 89 |
'title' => t('Representative node'), |
... | ... | |
92 | 93 |
'relationship field' => 'uid', |
93 | 94 |
'outer field' => 'users.uid', |
94 | 95 |
'argument table' => 'users', |
95 |
'argument field' => 'uid',
|
|
96 |
'argument field' => 'uid', |
|
96 | 97 |
'base' => 'node', |
97 | 98 |
'field' => 'nid', |
98 | 99 |
), |
99 | 100 |
); |
100 | 101 |
|
101 |
// uid
|
|
102 |
// Current user's ID / 'uid'.
|
|
102 | 103 |
$data['users']['uid_current'] = array( |
103 | 104 |
'real field' => 'uid', |
104 | 105 |
'title' => t('Current'), |
... | ... | |
109 | 110 |
), |
110 | 111 |
); |
111 | 112 |
|
112 |
// name
|
|
113 |
// User name.
|
|
113 | 114 |
$data['users']['name'] = array( |
114 |
'title' => t('Name'), // The item it appears as on the UI, |
|
115 |
'help' => t('The user or author name.'), // The help that appears on the UI, |
|
115 |
// The item it appears as on the UI, |
|
116 |
'title' => t('Name'), |
|
117 |
// The help that appears on the UI, |
|
118 |
'help' => t('The user or author name.'), |
|
116 | 119 |
'field' => array( |
117 | 120 |
'handler' => 'views_handler_field_user_name', |
118 | 121 |
'click sortable' => TRUE, |
... | ... | |
126 | 129 |
'filter' => array( |
127 | 130 |
'handler' => 'views_handler_filter_string', |
128 | 131 |
'title' => t('Name (raw)'), |
129 |
'help' => t('The user or author name. This filter does not check if the user exists and allows partial matching. Does not utilize autocomplete.') |
|
132 |
'help' => t('The user or author name. This filter does not check if the user exists and allows partial matching. Does not utilize autocomplete.'),
|
|
130 | 133 |
), |
131 | 134 |
); |
132 | 135 |
|
133 |
// mail
|
|
136 |
// Email address.
|
|
134 | 137 |
// Note that this field implements field level access control. |
135 | 138 |
$data['users']['mail'] = array( |
136 |
'title' => t('E-mail'), // The item it appears as on the UI, |
|
137 |
'help' => t('Email address for a given user. This field is normally not shown to users, so be cautious when using it.'), // The help that appears on the UI, |
|
139 |
// The item it appears as on the UI, |
|
140 |
'title' => t('E-mail'), |
|
141 |
// The help that appears on the UI, |
|
142 |
'help' => t('Email address for a given user. This field is normally not shown to users, so be cautious when using it.'), |
|
138 | 143 |
'field' => array( |
139 | 144 |
'handler' => 'views_handler_field_user_mail', |
140 | 145 |
'click sortable' => TRUE, |
... | ... | |
150 | 155 |
), |
151 | 156 |
); |
152 | 157 |
|
153 |
// language
|
|
158 |
// Language.
|
|
154 | 159 |
$data['users']['language'] = array( |
155 |
'title' => t('Language'), // The item it appears as on the UI, |
|
160 |
// The item it appears as on the UI, |
|
161 |
'title' => t('Language'), |
|
156 | 162 |
'help' => t('Language of the user'), |
157 | 163 |
'field' => array( |
158 | 164 |
'handler' => 'views_handler_field_user_language', |
... | ... | |
169 | 175 |
), |
170 | 176 |
); |
171 | 177 |
|
172 |
// picture
|
|
178 |
// Picture.
|
|
173 | 179 |
$data['users']['picture_fid']['moved to'] = array('users', 'picture'); |
174 | 180 |
$data['users']['picture'] = array( |
181 |
// The item it appears as on the UI, |
|
175 | 182 |
'title' => t('Picture'), |
176 |
'help' => t("The user's picture, if allowed."), // The help that appears on the UI, |
|
177 |
// Information for displaying the uid |
|
183 |
// The help that appears on the UI, |
|
184 |
'help' => t("The user's picture, if allowed."), |
|
185 |
// Information for displaying the uid. |
|
178 | 186 |
'field' => array( |
179 | 187 |
'handler' => 'views_handler_field_user_picture', |
180 | 188 |
'click sortable' => TRUE, |
... | ... | |
189 | 197 |
), |
190 | 198 |
); |
191 | 199 |
|
192 |
// link
|
|
200 |
// Link.
|
|
193 | 201 |
$data['users']['view_user'] = array( |
194 | 202 |
'field' => array( |
195 | 203 |
'title' => t('Link'), |
... | ... | |
198 | 206 |
), |
199 | 207 |
); |
200 | 208 |
|
201 |
// created field
|
|
209 |
// Created field.
|
|
202 | 210 |
$data['users']['created'] = array( |
203 |
'title' => t('Created date'), // The item it appears as on the UI, |
|
204 |
'help' => t('The date the user was created.'), // The help that appears on the UI, |
|
211 |
// The item it appears as on the UI, |
|
212 |
'title' => t('Created date'), |
|
213 |
// The help that appears on the UI, |
|
214 |
'help' => t('The date the user was created.'), |
|
205 | 215 |
'field' => array( |
206 | 216 |
'handler' => 'views_handler_field_date', |
207 | 217 |
'click sortable' => TRUE, |
... | ... | |
269 | 279 |
), |
270 | 280 |
); |
271 | 281 |
|
272 |
// access field
|
|
282 |
// Access field.
|
|
273 | 283 |
$data['users']['access'] = array( |
274 |
'title' => t('Last access'), // The item it appears as on the UI, |
|
275 |
'help' => t("The user's last access date."), // The help that appears on the UI, |
|
284 |
// The item it appears as on the UI, |
|
285 |
'title' => t('Last access'), |
|
286 |
// The help that appears on the UI, |
|
287 |
'help' => t("The user's last access date."), |
|
276 | 288 |
'field' => array( |
277 | 289 |
'handler' => 'views_handler_field_date', |
278 | 290 |
'click sortable' => TRUE, |
... | ... | |
285 | 297 |
), |
286 | 298 |
); |
287 | 299 |
|
288 |
// login field
|
|
300 |
// Login field.
|
|
289 | 301 |
$data['users']['login'] = array( |
290 |
'title' => t('Last login'), // The item it appears as on the UI, |
|
291 |
'help' => t("The user's last login date."), // The help that appears on the UI, |
|
302 |
// The item it appears as on the UI, |
|
303 |
'title' => t('Last login'), |
|
304 |
// The help that appears on the UI, |
|
305 |
'help' => t("The user's last login date."), |
|
292 | 306 |
'field' => array( |
293 | 307 |
'handler' => 'views_handler_field_date', |
294 | 308 |
'click sortable' => TRUE, |
... | ... | |
301 | 315 |
), |
302 | 316 |
); |
303 | 317 |
|
304 |
// active status
|
|
318 |
// Active status.
|
|
305 | 319 |
$data['users']['status'] = array( |
306 |
'title' => t('Active'), // The item it appears as on the UI, |
|
307 |
'help' => t('Whether a user is active or blocked.'), // The help that appears on the UI, |
|
308 |
// Information for displaying a title as a field |
|
320 |
// The item it appears as on the UI, |
|
321 |
'title' => t('Active'), |
|
322 |
// The help that appears on the UI, |
|
323 |
'help' => t('Whether a user is active or blocked.'), |
|
324 |
// Information for displaying a title as a field. |
|
309 | 325 |
'field' => array( |
310 | 326 |
'handler' => 'views_handler_field_boolean', |
311 | 327 |
'click sortable' => TRUE, |
... | ... | |
323 | 339 |
), |
324 | 340 |
); |
325 | 341 |
|
326 |
// log field
|
|
342 |
// Log field.
|
|
327 | 343 |
$data['users']['signature'] = array( |
328 |
'title' => t('Signature'), // The item it appears as on the UI, |
|
329 |
'help' => t("The user's signature."), // The help that appears on the UI, |
|
330 |
// Information for displaying a title as a field |
|
344 |
// The item it appears as on the UI, |
|
345 |
'title' => t('Signature'), |
|
346 |
// The help that appears on the UI, |
|
347 |
'help' => t("The user's signature."), |
|
348 |
// Information for displaying a title as a field. |
|
331 | 349 |
'field' => array( |
332 | 350 |
'handler' => 'views_handler_field_markup', |
333 | 351 |
'format' => filter_fallback_format(), |
... | ... | |
362 | 380 |
); |
363 | 381 |
|
364 | 382 |
// ---------------------------------------------------------------------- |
365 |
// users_roles table |
|
366 |
|
|
383 |
// 'users_roles' table. |
|
367 | 384 |
$data['users_roles']['table']['group'] = t('User'); |
368 | 385 |
|
369 | 386 |
// Explain how this table joins to others. |
... | ... | |
409 | 426 |
); |
410 | 427 |
|
411 | 428 |
// ---------------------------------------------------------------------- |
412 |
// role table |
|
413 |
|
|
429 |
// 'role' table. |
|
414 | 430 |
$data['role']['table']['join'] = array( |
415 | 431 |
// Directly links to users table. |
416 | 432 |
'users' => array( |
... | ... | |
418 | 434 |
'left_field' => 'rid', |
419 | 435 |
'field' => 'rid', |
420 | 436 |
), |
421 |
// needed for many to one helper sometimes
|
|
437 |
// Needed for many to one helper sometimes.
|
|
422 | 438 |
'users_roles' => array( |
423 | 439 |
'left_field' => 'rid', |
424 | 440 |
'field' => 'rid', |
... | ... | |
436 | 452 |
), |
437 | 453 |
); |
438 | 454 |
|
439 |
// permission table
|
|
455 |
// 'permission' table.
|
|
440 | 456 |
$data['role_permission']['table']['group'] = t('User'); |
441 | 457 |
$data['role_permission']['table']['join'] = array( |
442 | 458 |
// Directly links to users table. |
... | ... | |
460 | 476 |
); |
461 | 477 |
|
462 | 478 |
// ---------------------------------------------------------------------- |
463 |
// authmap table |
|
464 |
|
|
479 |
// 'authmap' table. |
|
465 | 480 |
$data['authmap']['table']['group'] = t('User'); |
466 | 481 |
$data['authmap']['table']['join'] = array( |
467 | 482 |
// Directly links to users table. |
... | ... | |
532 | 547 |
*/ |
533 | 548 |
function user_views_plugins() { |
534 | 549 |
return array( |
535 |
'module' => 'views', // This just tells our themes are elsewhere. |
|
550 |
// This just tells our themes are elsewhere. |
|
551 |
'module' => 'views', |
|
536 | 552 |
'row' => array( |
537 | 553 |
'user' => array( |
538 | 554 |
'title' => t('User'), |
539 | 555 |
'help' => t('Display the user with standard user view.'), |
540 | 556 |
'handler' => 'views_plugin_row_user_view', |
541 |
'base' => array('users'), // only works with 'users' as base. |
|
557 |
// Only works with 'users' as base. |
|
558 |
'base' => array('users'), |
|
542 | 559 |
'uses options' => TRUE, |
543 | 560 |
'type' => 'normal', |
544 | 561 |
'help topic' => 'style-users', |
... | ... | |
548 | 565 |
'user' => array( |
549 | 566 |
'title' => t('User ID from URL'), |
550 | 567 |
'handler' => 'views_plugin_argument_default_user', |
551 |
'path' => drupal_get_path('module', 'views') . '/modules/user', // not necessary for most modules |
|
568 |
// Not necessary for most modules. |
|
569 |
'path' => drupal_get_path('module', 'views') . '/modules/user', |
|
552 | 570 |
), |
553 | 571 |
'current_user' => array( |
554 | 572 |
'title' => t('User ID from logged in user'), |
555 | 573 |
'handler' => 'views_plugin_argument_default_current_user', |
556 |
'path' => drupal_get_path('module', 'views') . '/modules/user', // not necessary for most modules |
|
574 |
// Not necessary for most modules. |
|
575 |
'path' => drupal_get_path('module', 'views') . '/modules/user', |
|
557 | 576 |
), |
558 | 577 |
), |
559 | 578 |
'argument validator' => array( |
560 | 579 |
'user' => array( |
561 | 580 |
'title' => t('User'), |
562 | 581 |
'handler' => 'views_plugin_argument_validate_user', |
563 |
'path' => drupal_get_path('module', 'views') . '/modules/user', // not necessary for most modules |
|
582 |
// Not necessary for most modules. |
|
583 |
'path' => drupal_get_path('module', 'views') . '/modules/user', |
|
564 | 584 |
), |
565 | 585 |
), |
566 | 586 |
); |
567 | 587 |
} |
568 | 588 |
|
569 | 589 |
/** |
570 |
* Allow replacement of current userid so we can cache these queries |
|
590 |
* Allow replacement of current userid so we can cache these queries.
|
|
571 | 591 |
*/ |
572 | 592 |
function user_views_query_substitutions($view) { |
573 | 593 |
global $user; |
Formats disponibles : Unified diff
Weekly update of contrib modules