You are here

function _event_node_ical in Event 5.2

Same name and namespace in other branches
  1. 5 event.module \_event_node_ical()
2 calls to _event_node_ical()
event_calendar_ical in ./event.module
Creates an ical feed of events.
event_node_ical in ./event.module
Return an ical for a specific event

File

./event.module, line 817

Code

function _event_node_ical($node) {
  include_once EVENT_PATH . '/ical.inc';
  $event = array();

  // Allow modules to affect item fields
  node_invoke_nodeapi($node, 'ical item');
  $event['start'] = $node->event['start'];
  $event['end'] = $node->event['end'];
  $event['start_utc'] = $node->event['start_utc'];
  $event['end_utc'] = $node->event['end_utc'];
  $event['has_time'] = $node->event['has_time'];
  if (module_exists('location')) {
    if (isset($node->locations[0])) {
      $posted_locations[0] = location_form2api($node->locations[0]);
      if (!isset($posted_locations[0]['city']) || strlen(trim($posted_locations[0]['city'])) == 0) {
        $postal_data = location_get_postalcode_data($posted_locations[0]);
        $posted_locations[0]['city'] = isset($postal_data['city']) ? $postal_data['city'] : '';
      }
      if (!isset($posted_locations[0]['province']) || strlen(trim($posted_locations[0]['province'])) == 0) {
        $postal_data = isset($postal_data) ? $postal_data : location_get_postalcode_data($posted_locations[0]);
        $posted_locations[0]['province'] = isset($postal_data['province']) ? $postal_data['province'] : '';
      }
      if ($output = theme('locations', $posted_locations, variable_get('location_suppress_country', 0) ? array(
        'country',
      ) : array())) {
        $event['location'] = $output;
      }
    }
  }
  $event['summary'] = $node->title;
  $event['description'] = check_markup($node->teaser ? $node->teaser : $node->body, $node->format);
  $event['uid'] = url("node/{$node->nid}", NULL, NULL, 1);
  $event['url'] = url("node/{$node->nid}", NULL, NULL, 1);
  return $event;
}