You are here

function availability_calendar_theme_day in Availability Calendars 7.3

Same name and namespace in other branches
  1. 7.5 availability_calendar.theme.inc \availability_calendar_theme_day()
  2. 7.4 availability_calendar.theme.inc \availability_calendar_theme_day()

Helper function that returns the html for 1 day.

Because this function is called very often it is called directly and is thus not a real theme function.

Parameters

int $day: The day number.

array $settings:

1 call to availability_calendar_theme_day()
availability_calendar_month_cells in ./availability_calendar.theme.inc
Helper function that returns the cells for a month table.

File

./availability_calendar.theme.inc, line 319

Code

function availability_calendar_theme_day($day, $settings) {

  // Represent whole days with 1 div, split days with 2 span's.
  // This allows to generate all css at once and then just switch settings
  if ($settings['allocation_type'] === ALLOCATION_TYPE_OVERNIGHT && $settings['show_split_day']) {

    // Split day:
    // - The border-color of the outer span will take care of the coloring.
    //    the outer span will have zero sized content and full sized borders.
    // - The inner span will contain the day number and the selectable border
    //   It will be positioned absolute, half way up and left.
    // However, to be able to position it absolute, it needs to be within
    // another positioned element, and td's cannot be positioned.
    $result = "<span><span>{$day}</span></span>";
  }
  else {

    // Whole day, the background and border color will take care of the
    // coloring. Border color may change on hover for "selectable" cells.
    $result = "<div>{$day}</div>";
  }
  return $result;
}