You are here

function theme_event_node_week in Event 5.2

Same name and namespace in other branches
  1. 5 event.theme \theme_event_node_week()

Format an event node for display in an expanded calendar, like a calendar page

Parameters

node: The node being displayed

File

./event.theme, line 99

Code

function theme_event_node_week($node) {
  static $stripe, $stripe_map;
  if (!$stripe_map[$node->nid]) {
    if ($stripe >= 10) {
      $stripe = 1;
    }
    else {
      $stripe++;
    }
    $stripe_map[$node->nid] = $stripe;
  }
  $output .= '<div class="event weekview vevent">' . "\n";
  $output .= '<div class="stripe-' . $stripe_map[$node->nid] . '"></div>' . "\n";
  switch ($node->event['state']) {
    case 'singleday':
      $times = '<div class="start dtstart" title="' . event_format_date($node->event['start'], 'custom', "Y-m-d\\TH:i:s\\Z") . '">' . t('Start: ') . $node->event['start_time_format'] . '</div>' . "\n";
      if ($node->event['start'] != $node->event['end']) {
        $times .= '<div class="end dtend" title="' . event_format_date($node->event['end'], 'custom', "Y-m-d\\TH:i:s\\Z") . '">' . t('End: ') . $node->event['end_time_format'] . '</div>' . "\n";
      }
      break;
    case 'start':
      $times = '<div class="start dtstart" title="' . event_format_date($node->event['start'], 'custom', "Y-m-d\\TH:i:s\\Z") . '">' . t('Start: ') . $node->event['start_time_format'] . '</div>' . "\n";
      break;
    case 'end':
      $times .= '<div class="end dtend" title="' . event_format_date($node->event['end'], 'custom', "Y-m-d\\TH:i:s\\Z") . '">' . t('End: ') . $node->event['end_time_format'] . '</div>' . "\n";
      break;
    case 'allday':
    case 'ongoing':

      /*TODO: not sure if using dtstart in this case is correct,
       * or even if it should be marked up at all! skipping
       * marking it up!
       */
      $times .= '<div class="ongoing" >' . t('all day') . '</div>' . "\n";
      break;
  }
  if (variable_get('event_type_control', 'all') != 'never') {
    if (count(event_get_types('all')) + count(event_get_types('solo')) > 1) {
      $output .= '<div class="type">' . l('(' . $node->event['node_type'] . ')', 'event/' . _event_format_url($node->event['current_date']) . '/month/' . $node->type, array(
        'title' => t('limit view to events of this type'),
      )) . '</div>' . "\n";
    }
  }
  $output .= '<div class="title">' . l($node->title, "node/{$node->nid}", array(
    'title' => t('view this event'),
  )) . '</div>' . "\n";
  $output .= $times;
  $output .= '<div class="links">' . theme('links', $node->event['links']) . "\n</div>";
  $output .= '</div>' . "\n";
  return $output;
}