function theme_birthdays_page in Birthdays 5
@desc Theme a birthdays page
1 theme call to theme_birthdays_page()
- birthdays_view_page in ./
birthdays.module - Show birthdays page @desc Callback for birthdays menu item to show a page which lists all users.
File
- ./
birthdays.module, line 397 - The Birthdays module allows users to add their birthday to their profile. It lists birthdays on a seperate page and in different blocks. Users can receive an e-mail on their birthday automatically, and the administrator can receive daily reminders of…
Code
function theme_birthdays_page($accounts = array(), $filter_month, $filter_year) {
global $_birthdays_field;
// $header contains the column headers
$header = array(
t('User'),
t('Birthday'),
);
if (variable_get('birthdays_hide_year', BIRTHDAYS_HIDE_YEAR_NO) != BIRTHDAYS_HIDE_YEAR_YES) {
$header[] = t('Age');
}
if (variable_get('birthdays_show_starsign', BIRTHDAYS_STARSIGN_OFF)) {
$header[] = t('Starsign');
}
if (variable_get('user_pictures', false)) {
$header[] = ' ';
}
// $rows contains all cells
$rows = array();
$accounts = is_array($accounts) ? $accounts : array();
$i = 0;
// For each user
foreach ($accounts as $account) {
//Theme username (with link and such) and format date field.
$rows[$i] = array(
theme('username', $account),
_birthdays_show_date($account->{$_birthdays_field->name}, $account),
);
if (variable_get('birthdays_hide_year', BIRTHDAYS_HIDE_YEAR_NO) != BIRTHDAYS_HIDE_YEAR_YES) {
$age = _birthdays_show_age($account);
$rows[$i][] = isset($age) ? $age : '';
}
if (variable_get('birthdays_show_starsign', BIRTHDAYS_STARSIGN_OFF)) {
$rows[$i][] = birthdays_get_starsign_image($account->birthdays_starsign, variable_get('birthdays_show_starsign', BIRTHDAYS_STARSIGN_OFF));
}
if (variable_get('user_pictures', false)) {
$rows[$i][] = theme_user_picture($account);
}
$i++;
}
$output = '';
// Return a table. Everthing else (titles, and such) is handled by the page system.
if (variable_get('birthdays_page_show_filters', 1)) {
$output .= drupal_get_form('birthdays_page_filter', $filter_month, $filter_year);
}
$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, variable_get('birthdays_page_list_number', 25), 0);
return $output;
}