event_calendar_week

Versions
5
event_calendar_week($op, $stamp, $types = NULL, $terms = NULL)
6
event_calendar_week($op, $date, $types = NULL, $terms = NULL, $rewrite_parameter = array())

Displays a weekly event calendar.

Return value

a themed weekly event calendar.

Related topics

▾ 1 function calls event_calendar_week()

event_page in contrib/event/event.module
Displays a page containing event information. The page layout defaults to a graphical calendar.

Code

contrib/event/event.module, line 717

<?php
function event_calendar_week($op, $date, $types = NULL, $terms = NULL, $rewrite_parameter = array()) {
  // get weekdays array and header information
  $weekdays = event_week_days();
  $thead = event_week_header();

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

  // apply offset to goto first day of week
  $cur_date = event_date_later($date, -1 * _event_day_of_week($date));
  event_calendar_data($date, 'week', $types, $terms, 'prepopulate', array(), $rewrite_parameter);

  for ($x = 0; $x < 7; $x++) {

    $year = $date['year'];
    $month = $date['month'];
    $month_name = event_format_date($cur_date, 'custom', 'M');

    $row[$x] = array(
      'class' => strtolower("$month_name ". $weekdays[$x]['day'] . ($cur_date == $today ? ' today' : '') . ($cur_date['day'] == $date['day'] ? ' selected' : '')),
      'id' => strtolower($month_name . $cur_date['day']),
      'data' => event_render_day($cur_date, 'week', $types, $terms, $rewrite_parameter));
    $cur_date = event_date_later($cur_date, 1);
  }
  $tbody[] = $row;
  return array($thead, $tbody);
}
?>