You are here

function calendar_week_days in Calendar 5

Returns week day names and thier translated values, corrected for the start of week day settings (mon or sun)

Return value

an associative array containing weekday names

2 calls to calendar_week_days()
calendar_get_calendar in ./calendar_api.inc
Adapted from event_get_calendar() function in the event module Reworked to remove dependency on event module
calendar_week_header in ./calendar_api.inc
Formats the weekday information into table header format

File

./calendar_api.inc, line 419

Code

function calendar_week_days() {
  static $weekdays;
  if (!$weekdays) {
    switch (variable_get('date_first_day', 1)) {
      case 1:
        $weekdays = array(
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
        );
        break;
      case 2:
        $weekdays = array(
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
        );
        break;
      case 3:
        $weekdays = array(
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
        );
        break;
      case 4:
        $weekdays = array(
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
        );
        break;
      case 5:
        $weekdays = array(
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
        );
        break;
      case 6:
        $weekdays = array(
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
        );
        break;
      default:
        $weekdays = array(
          array(
            'day' => 'Sun',
            't' => t('Sun'),
          ),
          array(
            'day' => 'Mon',
            't' => t('Mon'),
          ),
          array(
            'day' => 'Tue',
            't' => t('Tue'),
          ),
          array(
            'day' => 'Wed',
            't' => t('Wed'),
          ),
          array(
            'day' => 'Thu',
            't' => t('Thu'),
          ),
          array(
            'day' => 'Fri',
            't' => t('Fri'),
          ),
          array(
            'day' => 'Sat',
            't' => t('Sat'),
          ),
        );
        break;
    }
  }
  return $weekdays;
}