| 1 |
<?php |
<?php |
| 2 |
// $Id: bio_views.inc,v 1.1.2.5 2008/01/25 07:33:54 webchick Exp $ |
// $Id: bio_views.inc,v 1.1.2.6 2008/01/30 19:11:15 webchick Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 436 |
|
|
| 437 |
return $views; |
return $views; |
| 438 |
} |
} |
| 439 |
|
|
| 440 |
|
/** |
| 441 |
|
* Real implemenation of hook_views_tables(). |
| 442 |
|
* |
| 443 |
|
* Exposes data from the {user} table, such as the full username, account |
| 444 |
|
* status, e-mail address, etc, to views of the corresponding bio nodes. |
| 445 |
|
*/ |
| 446 |
|
function _bio_views_tables() { |
| 447 |
|
$tables['bio'] = array( |
| 448 |
|
'name' => 'bio', |
| 449 |
|
'join' => array( |
| 450 |
|
'type' => 'inner', |
| 451 |
|
'left' => array( |
| 452 |
|
'table' => 'node', |
| 453 |
|
'field' => 'nid' |
| 454 |
|
), |
| 455 |
|
'right' => array( |
| 456 |
|
'field' => 'nid' |
| 457 |
|
), |
| 458 |
|
), |
| 459 |
|
); |
| 460 |
|
$tables['bio_users'] = array( |
| 461 |
|
'name' => 'users', |
| 462 |
|
'join' => array( |
| 463 |
|
'type' => 'inner', |
| 464 |
|
'left' => array( |
| 465 |
|
'table' => 'bio', |
| 466 |
|
'field' => 'uid' |
| 467 |
|
), |
| 468 |
|
'right' => array( |
| 469 |
|
'field' => 'uid' |
| 470 |
|
), |
| 471 |
|
), |
| 472 |
|
'fields' => array( |
| 473 |
|
'name' => array( |
| 474 |
|
'name' => t('Bio: User: Username'), |
| 475 |
|
'uid' => 'uid', |
| 476 |
|
'addlfields' => array('uid'), |
| 477 |
|
'sortable' => TRUE, |
| 478 |
|
'help' => t('The username of the user associated with a given bio.'), |
| 479 |
|
'handler' => 'views_handler_field_username', |
| 480 |
|
), |
| 481 |
|
'mail' => array( |
| 482 |
|
'name' => t('Bio: User: E-mail'), |
| 483 |
|
'handler' => 'views_handler_field_email', |
| 484 |
|
'help' => t('The e-mail address of the user associated with a given bio.'), |
| 485 |
|
'sortable' => TRUE, |
| 486 |
|
), |
| 487 |
|
'status' => array( |
| 488 |
|
'name' => t('Bio: User: Account status'), |
| 489 |
|
'help' => t('The account status of the user associated with a given bio.'), |
| 490 |
|
'handler' => 'bio_views_handler_field_user_status', |
| 491 |
|
'sortable' => TRUE, |
| 492 |
|
), |
| 493 |
|
'picture' => array( |
| 494 |
|
'name' => t('Bio: User: Picture'), |
| 495 |
|
'field' => 'uid', |
| 496 |
|
'help' => t('The picture of the user associated with a given bio.'), |
| 497 |
|
'handler' => 'views_handler_field_userpic', |
| 498 |
|
'sortable' => FALSE, |
| 499 |
|
), |
| 500 |
|
'signature' => array( |
| 501 |
|
'name' => t('Bio: User: Signature'), |
| 502 |
|
'help' => t('The signature of the user associated with a given bio.'), |
| 503 |
|
'sortable' => FALSE, |
| 504 |
|
), |
| 505 |
|
'created' => array( |
| 506 |
|
'name' => t('Bio: User: Created time'), |
| 507 |
|
'help' => t("The creation time of the user associated with a given bio. The option field may be used to specify the custom date format as it's required by the date() function or if 'as time ago' has been chosen to customize the granularity of the time interval."), |
| 508 |
|
'handler' => views_handler_field_dates(), |
| 509 |
|
'option' => 'string', |
| 510 |
|
'sortable' => TRUE, |
| 511 |
|
), |
| 512 |
|
'access' => array( |
| 513 |
|
'name' => t('Bio: User: Access time'), |
| 514 |
|
'help' => t("The last access time of the user associated with a given bio. The option field may be used to specify the custom date format as it's required by the date() function or if 'as time ago' has been chosen to customize the granularity of the time interval."), |
| 515 |
|
'handler' => views_handler_field_dates(), |
| 516 |
|
'option' => 'string', |
| 517 |
|
'sortable' => TRUE, |
| 518 |
|
), |
| 519 |
|
'login' => array( |
| 520 |
|
'name' => t('Bio: User: Login time'), |
| 521 |
|
'help' => t("The last login time of the user associated with a given bio. The option field may be used to specify the custom date format as it's required by the date() function or if 'as time ago' has been chosen to customize the granularity of the time interval."), |
| 522 |
|
'handler' => views_handler_field_dates(), |
| 523 |
|
'option' => 'string', |
| 524 |
|
'sortable' => TRUE, |
| 525 |
|
), |
| 526 |
|
), |
| 527 |
|
); |
| 528 |
|
return $tables; |
| 529 |
|
} |
| 530 |
|
|
| 531 |
|
function bio_views_handler_field_user_status($fieldinfo, $fielddata, $value, $data) { |
| 532 |
|
return $value == 0 ? t('Blocked') : t('Active'); |
| 533 |
|
} |
| 534 |
|
|
| 535 |
|
if (!function_exists('views_handler_field_email')) { |
| 536 |
|
function views_handler_field_email($fieldinfo, $fielddata, $value, $data) { |
| 537 |
|
return l($value, 'mailto:' . $value); |
| 538 |
|
} |
| 539 |
|
} |