You are here

function event_calendar_week in Event 5

Same name and namespace in other branches
  1. 5.2 event.module \event_calendar_week()

Displays a weekly event calendar.

Return value

a themed weekly event calendar.

Related topics

1 call to event_calendar_week()
event_page in ./event.module
Displays a page containing event information. The page layout defaults to a graphical calendar.

File

./event.module, line 573

Code

function event_calendar_week($op, $stamp, $types = NULL, $terms = NULL) {

  // get weekdays array and header information
  $weekdays = event_week_days();
  $thead = event_week_header();

  // get GMT current date value
  $today = _event_user_date();

  // apply offset to goto first day of week
  $stamp -= _event_day_of_week($stamp) * 86400;
  for ($x = 0; $x < 7; $x++) {
    $year = gmdate('Y', $stamp);
    $month = gmdate('m', $stamp);
    $cur_day = gmdate('j', $stamp);
    $month_name = gmdate('M', $stamp);
    $row[$x] = array(
      'class' => strtolower("{$month_name} " . $weekdays[$x]['day'] . ($stamp == $today ? ' today' : '') . ($cur_day == $day ? ' selected' : '')),
      'id' => strtolower($month_name . $cur_day),
      'data' => event_render_day($year, $month, $cur_day, 'week', $types, $terms),
    );
    $stamp += 86400;
  }
  $tbody[] = $row;
  return array(
    $thead,
    $tbody,
  );
}