You are here

function theme_calendar_node_month in Calendar 5

Same name and namespace in other branches
  1. 5.2 calendar.theme \theme_calendar_node_month()

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

Parameters

node: The node being displayed

1 theme call to theme_calendar_node_month()
calendar_add_items in ./calendar.module
Call hooks in other modules to add other items to a calendar view.

File

./calendar.theme, line 512

Code

function theme_calendar_node_month($node) {
  $output .= '<div class="calendar monthview">' . "\n";
  $output .= theme('calendar_stripe_stripe', $node);
  switch ($node->calendar_state) {
    case 'singleday':
      if ($node->start_time_format != $node->end_time_format) {
        $times = '<span class="start">' . $node->start_time_format . '</span>' . "\n";
      }
      if ($node->calendar_start != $node->calendar_end && $node->calendar_end) {
        $times .= '<span class="end"> - ' . $node->end_time_format . '</span>' . "\n";
      }
      else {
        $times = '<span class="start">' . $node->start_time_format . '</span>' . "\n";
      }
      break;
    case 'start':
      $times = '<span class="start">' . $start_label . $node->start_time_format . '</span>' . "\n";
      break;
    case 'end':
      $times = '<span class="end">' . $end_label . $node->end_time_format . '</span>' . "\n";
      break;
    case 'ongoing':
      $times = '<span class="ongoing">' . t('all day') . '</span>' . "\n";
      break;
  }

  // Force spaces into titles wherever possible so long unbroken title strings
  // won't screw up the calendar layout.
  $replace = array(
    '-' => '- ',
    ':' => ': ',
    ';' => '; ',
    '/' => '/ ',
    ',' => ', ',
    '.' => '. ',
  );
  $output .= '<div class="title">' . l(strtr($node->title, $replace), $node->url, array(
    'title' => t('view this item'),
  )) . '</div>' . "\n";
  $output .= '<div class="times">' . $times . '</div>';
  $output .= $node->teaser;
  $output .= '</div>' . "\n";
  return $output;
}