You are here

function _birthdays_get_starsign in Birthdays 6

Same name and namespace in other branches
  1. 5 birthdays.module \_birthdays_get_starsign()

Get starsign based on date of birth

Return value

The name of the starsign

1 call to _birthdays_get_starsign()
birthdays_save_user in ./birthdays.module
Inject information and save birthday when editing or adding a user.

File

./birthdays.module, line 830
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_get_starsign($day, $month) {
  switch ($month) {
    case 1:
      $starsign = $day < 20 ? 'capricorn' : 'aquarius';
      break;
    case 2:
      $starsign = $day < 19 ? 'aquarius' : 'pisces';
      break;
    case 3:
      $starsign = $day < 21 ? 'pisces' : 'aries';
      break;
    case 4:
      $starsign = $day < 20 ? 'aries' : 'taurus';
      break;
    case 5:
      $starsign = $day < 21 ? 'taurus' : 'gemini';
      break;
    case 6:
      $starsign = $day < 22 ? 'gemini' : 'cancer';
      break;
    case 7:
      $starsign = $day < 23 ? 'cancer' : 'leo';
      break;
    case 8:
      $starsign = $day < 23 ? 'leo' : 'virgo';
      break;
    case 9:
      $starsign = $day < 23 ? 'virgo' : 'libra';
      break;
    case 10:
      $starsign = $day < 23 ? 'libra' : 'scorpio';
      break;
    case 11:
      $starsign = $day < 23 ? 'scorpio' : 'sagittarius';
      break;
    case 12:
      $starsign = $day < 22 ? 'sagittarius' : 'capricorn';
      break;
  }
  return $starsign;
}