You are here

function birthdays_lookup in Birthdays 7

Page callback: Evaluates a date format for live display.

Parameters

$year: Whether the year should be displayed or not.

See also

birthdays_menu()

1 string reference to 'birthdays_lookup'
birthdays_menu in ./birthdays.module
Implements hook_menu().

File

./birthdays.module, line 137
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 email on their birthday automatically, and the administrator can receive daily reminders of…

Code

function birthdays_lookup($year) {
  if ($year) {
    $birthday = BirthdaysBirthday::fromDate(date('Y', REQUEST_TIME) - 20, date('m', REQUEST_TIME), date('d', REQUEST_TIME));
  }
  else {
    $birthday = BirthdaysBirthday::fromDate(0, date('m', REQUEST_TIME), date('d', REQUEST_TIME));
  }
  $format = isset($_GET['format']) ? $_GET['format'] : '';
  drupal_json_output($birthday
    ->toString($format, $format));
}