function event_calendar_rss in Event 5.2
Same name and namespace in other branches
- 5 event.module \event_calendar_rss()
Creates an rss feed of events.
Parameters
$date The starting 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 rss feed.
Related topics
1 call to event_calendar_rss()
- event_page in ./
event.module - Displays a page containing event information. The page layout defaults to a graphical calendar.
File
- ./
event.module, line 723
Code
function event_calendar_rss($date, $duration, $types = NULL, $terms = NULL, $title = NULL, $rewrite_parameter = array()) {
global $base_url, $locale;
$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);
$nodes = array();
while ($nid = db_fetch_object($result)) {
$node = node_load($nid->nid);
node_invoke_nodeapi($node, 'view', FALSE, FALSE);
$nodes[] = $node;
}
$filtered = event_filter_nodes($nodes, $types, $terms);
foreach ($filtered as $node) {
$body = '<div class="start">' . t('Start') . ': ' . $node->event['start_format'] . '</div>' . "\n";
$body .= '<div class="end">' . t('End') . ': ' . $node->event['end_format'] . '</div>' . "\n";
$body .= check_markup($node->teaser, $node->format);
$link = url("node/{$node->nid}", NULL, NULL, 1);
// Allow modules to add additional item fields
$extra = node_invoke_nodeapi($node, 'rss item');
$extra = array_merge($extra, array(
array(
'key' => 'pubDate',
'value' => date('r', $node->changed),
),
));
$items .= format_rss_item($node->title, $link, $body, $extra);
}
$description = $headertitle . ($title ? ' | ' . $title : '');
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
if (module_exists('location')) {
$output .= "<rss version=\"2.0\" xmlns:geo=\"http://www.w3.org/2003/01/geo/wgs84_pos#\" xmlns:geourl=\"http://geourl.org/rss/module/\" xmlns:icbm=\"http://postneo.com/icbm\" xml:base=\"" . $base_url . "\">\n";
}
else {
$output .= "<rss version=\"2.0\" xml:base=\"" . $base_url . "\">\n";
}
$output .= format_rss_channel(variable_get('site_name', 'drupal') . t(' - Events Feed'), url('event/feed', NULL, NULL, TRUE), $description, $items, $locale);
$output .= "</rss>\n";
return $output;
}