function birthdays_page_filter in Birthdays 5
Same name and namespace in other branches
- 6 birthdays.page.inc \birthdays_page_filter()
Return a form containing a select box to filter users by month of birth
Parameters
$filter_month:
int $filter_year:
Return value
array of the form
1 string reference to 'birthdays_page_filter'
- theme_birthdays_page in ./
birthdays.module - @desc Theme a birthdays page
File
- ./
birthdays.module, line 353 - 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 birthdays_page_filter($filter_month = NULL, $filter_year = NULL) {
$options_months[0] = '';
for ($i = 1; $i <= 12; $i++) {
$options_months[$i] = format_date(gmmktime(0, 0, 0, $i, 2, 1970), 'custom', 'F', 0);
}
$options_years[0] = '';
$options_years = $options_years + drupal_map_assoc(range(date('Y'), 1900));
$form['#prefix'] = '<div class="container-inline birthdays-filter">';
$form['#suffix'] = "</div>\n";
$form['birthdays_filter_month'] = array(
'#type' => 'select',
'#options' => $options_months,
'#default_value' => $filter_month,
'#title' => t('Filter by month'),
'#attributes' => array(
'onchange' => 'submit()',
),
);
if (variable_get('birthdays_hide_year', BIRTHDAYS_HIDE_YEAR_NO) != BIRTHDAYS_HIDE_YEAR_YES) {
$form['birthdays_filter_year'] = array(
'#type' => 'select',
'#options' => $options_years,
'#default_value' => $filter_year,
'#title' => t('Year'),
'#attributes' => array(
'onchange' => 'submit()',
),
);
}
$form['button'] = array(
'#type' => 'button',
'#prefix' => '<noscript>',
'#value' => t('Filter'),
'#suffix' => '</noscript>',
);
return $form;
}