You are here

function event_calendar_ical in Event 5.2

Same name and namespace in other branches
  1. 5 event.module \event_calendar_ical()

Creates an ical feed of events.

Parameters

$date The date for the feed.:

$duration The number of days the feeds duration is.:

$types The content types to filter the feed by.:

$terms The taxonomy term tids to filter the feed by.:

$title The filter title to append to the channel description.:

$rewrite_parameter optional array that will be passed on to queries: in event_database.*.inc files and merged into the fourth argument of db_rewrite_sql.

Return value

A formatted ical feed.

Related topics

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

File

./event.module, line 783

Code

function event_calendar_ical($date, $duration, $types = NULL, $terms = NULL, $title = NULL, $rewrite_parameter = array()) {
  global $base_url, $locale;
  include_once EVENT_PATH . '/ical.inc';
  $end_date = event_date_later($date, $duration);
  $headertitle = event_format_date($date, 'custom', 'F d Y') . '-' . event_format_date($end_date, 'custom', 'F d Y');
  $result = event_get_events(event_implode_date($date), event_implode_date($end_date), 'ASC', $rewrite_parameter);
  $events = array();
  while ($nid = db_fetch_object($result)) {
    $node = node_load($nid->nid);
    if (event_filter_node($node, $types, $terms)) {
      $events[] = _event_node_ical($node);
    }
  }
  $description = $headertitle . ($title ? ' | ' . $title : '');
  return ical_export($events, $description);
}