title = $node->title; if ($node->label && !strstr($node->title, $node->label)) { $node->title .= ' ('. $node->label .')'; } if ($node->fields) { foreach ($node->fields as $field) { $node->teaser .= '
'. $field .'
'; } } return theme($theme, $node); } /** * Format the calendar navigation */ function theme_calendar_show_nav($view) { // add links to the top of the calendar to switch from one view to another if ($view->build_type == 'page') { $view->real_url = calendar_get_url($view, $view->args); $base_url = $view->real_url .'/'. $view->year; $month = $view->month ? $view->month : calendar_user_date('month'); $day = $view->day ? $view->day : calendar_user_date('day'); $week = $view->week ? $view->week : calendar_user_date('week'); $append = calendar_url_append(); if ($_GET['view']) { $append .= '&view='. $_GET['view']; } $calendar_links[] = array('title' => t('Year'), 'href' => $view->real_url .'/'. $view->year, 'query' => $append); $calendar_links[] = array('title' => t('Month'), 'href' => $view->real_url .'/'. $view->year .'/'. $month , 'query' => $append); $calendar_links[] = array('title' => t('Week'), 'href' => $view->real_url .'/'. $view->year .'/W'. $week, 'query' => $append); $calendar_links[] = array('title' => t('Day'), 'href' => $view->real_url .'/'. $view->year .'/'. $month .'/'. $day, 'query' => $append); $output .= theme('calendar_links', $calendar_links, 'month'); $output .= '
'. theme('calendar_nav_wrapper', calendar_nav($view, $params['mini']), array()) .'
'; return $output; } } /** * Format the 'next' navigation controls for calendar calendars * * @param link * The url for the navigation */ function theme_calendar_nav_next($url, $text = TRUE, $querystring = NULL) { return ''. l(($text ? t('next') : '') .' »', $url, array(), (!empty($querystring) ? $querystring : NULL)) .''; } /** * Format the 'previous' navigation controls for calendar calendars * * @param link * The url for the navigation */ function theme_calendar_nav_prev($url, $text = TRUE, $querystring = NULL) { return ''. l('« '. ($text ? t('prev') : ''), $url, array(), (!empty($querystring) ? $querystring : NULL)) .''; } /** * Theme for the back/next navigation bar * This is really hackish to put it in a table, but so many themes break otherwise that I gave up on anything else */ function theme_calendar_nav_wrapper($array) { return theme('table', $array, array()); } /** * Format the links for calendar calendars * * @param links * An array of links to render * @param view * The current view being rendered */ function theme_calendar_links($links, $view) { return theme('links', $links); } /** * Format a node stripe legend */ function theme_calendar_stripe_legend($stripe_labels) { $header = array( array('class' => 'legend', 'data' => t('Item')), array('class' => 'legend', 'data' => t('Key')) ); foreach ($stripe_labels as $stripe => $label) { $node = new StdClass(); $node->stripe = $stripe; $rows[] = array($label, theme('calendar_stripe_stripe', $node), array('class' => 'stripe')); } $output = theme('table', $header, $rows, array('class' => 'mini')); return $output; } /** * Format node stripes * Add key value to text, then hide it with css for accessibility to screen readers */ function theme_calendar_stripe_stripe($node) { static $stripe, $stripe_map; if(!$stripe_map[$node->stripe]) { if($stripe >= 10) { $stripe = 1; } else { $stripe++; } $stripe_map[$node->stripe] = $stripe; } $output .= '
Key '.$stripe_map[$node->stripe] .'
'."\n"; return $output; } /** * Format a calendar view * * @param day * The day to display. */ function theme_calendar_year($op, $header, $rows, $month_rows) { $year = array_shift($month_rows); $output = '
'; $output .= $year; $i = 0; foreach ($month_rows as $month) { $i++; $row .= '
'. $month .'
'; if ($i == 3) { $output .= '
'. $row .'
'; $row = ''; $i = 0; } } $output .= "
\n"; return $output; } /** * Format a calendar view * * @param day * The day to display. */ function theme_calendar_month($op, $header, $rows) { $attrs = array(); if ($op == 'mini') { $attrs = array('class' => 'mini'); } $output = theme("table", $header, $rows, $attrs); return '
'. $output ."
\n"; } /** * Format a calendar view * * @param day * The day to display. */ function theme_calendar_week($op, $header, $rows) { $output = theme("table", $header, $rows); return '
'. $output ."
\n"; } /** * Format a calendar view * * @param day * The day to display. */ function theme_calendar_day($op, $header, $rows) { if (strstr($header[0]['data'], '
'. $output ."
\n"; } /** * Format an calendar node for display in an expanded calendar, like a calendar page * * @param node * The node being displayed */ function theme_calendar_node_day($node) { $output .= '
'."\n"; $output .= theme('calendar_stripe_stripe', $node); if ($node->calendar_start != $node->calendar_end && $node->start_time_format) { $start_label = t('Start: '); $end_label = t('End: '); } else { $start_label = ''; $end_label = ''; } $output .= '
'. l($node->title, "node/$node->nid", array('title' => t('view this item'))) .'
'."\n"; $output .= '
'. $start_label . $node->start_format .'
'."\n"; if ($node->calendar_start != $node->calendar_end && $node->calendar_end) { $output .= '
'. $end_label . $node->end_format .'
'."\n"; } if ($node->teaser) { $output .= '
'. check_markup($node->teaser) ."
\n"; } $output .= '"; $output .= "
\n"; return $output; } /** * Format an calendar node for display in an expanded calendar, like a calendar page * * @param node * The node being displayed */ function theme_calendar_node_week($node) { $output .= '
'."\n"; $output .= theme('calendar_stripe_stripe', $node); if ($node->calendar_start != $node->calendar_end && $node->start_time_format) { $start_label = t('Start: '); $end_label = t('End: '); } else { $start_label = ''; $end_label = ''; } switch ($node->calendar_state) { case 'singleday': $times = '
'. $start_label . $node->start_time_format .'
'."\n"; if ($node->calendar_start != $node->calendar_end && $node->calendar_end) { $times .= '
'. $end_label . $node->end_time_format .'
'."\n"; } break; case 'start': $times = '
'. $start_label . $node->start_time_format .'
'."\n"; break; case 'end': $times = '
'. $end_label . $node->end_time_format .'
'."\n"; break; case 'ongoing': $times = '
'. t('all day') .'
'."\n"; break; } $output .= '
'. l($node->title, "node/$node->nid", array('title' => t('view this item'))) .'
'."\n"; $output .= $times; $output .= '"; $output .= '
' . "\n"; return $output; } /** * Format an calendar node for display in an expanded calendar, like a calendar page * * @param node * The node being displayed */ function theme_calendar_node_month($node) { $output .= '
'."\n"; $output .= theme('calendar_stripe_stripe', $node); if ($node->calendar_start != $node->calendar_end && $node->start_time_format) { $start_label = t('Start: '); $end_label = t('End: '); } else { $start_label = ''; $end_label = ''; } switch ($node->calendar_state) { case 'singleday': if ($node->start_time_format != $node->end_time_format) { $times = '
'. $start_label . $node->start_time_format .'
'."\n"; } if ($node->calendar_start != $node->calendar_end && $node->calendar_end) { $times .= '
'. $end_label . $node->end_time_format .'
'."\n"; } else { $times = '
'. $node->start_time_format .'
'."\n"; } break; case 'start': $times = '
'. $start_label . $node->start_time_format .'
'."\n"; break; case 'end': $times = '
'. $end_label . $node->end_time_format .'
'."\n"; break; case 'ongoing': $times = '
'. t('all day') .'
'."\n"; break; } $output .= '
'. l($node->title, "node/$node->nid", array('title' => t('view this item'))) .'
'."\n"; $output .= $times; $output .= $node->teaser; $output .= '"; $output .= '
' . "\n"; return $output; } /** * Format an date's day box in a calendar * * @param day * The day to display. */ function theme_calendar_date_box($year, $month, $day, $view, $mini = FALSE, $selected = FALSE, $url, $append = '') { $url = $url ? $url .'/'. $year .'/'. $month .'/'. $day : 'calendar/'. $year .'/'. $month .'/'. $day; if ($mini) { if ($selected) { return '
'. l($day, $url, NULL, $append) .'
'; } else { return '
'. l($day, $url, NULL, $append) .'
'; } } switch ($view) { case 'table': $output = '
'. l(t('!month / !day', array('!month' => $month, '!day' => $day)), $url, NULL, $append) .'
'."\n"; break; case 'list': $output = '
'. l(format_date(_calendar_mktime(0, 0, 0, $month, $day, $year), 'custom', 'l, F j, Y'), $url, NULL, $append) .'
'."\n"; break; case 'day': break; default: $output = '
'. l($day, $url, NULL, $append) .'
'."\n"; break; } return $output; } /** * Format an empty day on a calendar * * @param day * The day to display. */ function theme_calendar_empty_day($year, $month, $day, $view) { switch ($view) { case 'table': $output = '
'. t('%month / %day', array('%month' => $month, '%day' => $day)) .'
'."\n"; $output .= '
'."\n"; break; case 'day': case 'list': break; default: $output = '
'. $day .'
'."\n"; $output .= '
'."\n"; break; } return $output; } /** @} End of addtogroup themeable */