remote && $type == 'calendar_node_day') {
$node = node_load($node->nid);
$node->teaser = node_view($node, TRUE, FALSE);
$node->title = '';
}
// For other views, construct a teaser out of the provided fields.
else {
if ($node->label && !strstr($node->title, $node->label)) {
$node->title .= ' ('. $node->label .')';
}
if ($node->fields) {
foreach ($node->fields as $field) {
$node->teaser .= '
'. $field .'
';
}
}
if (!$node->url && !$node->remote) {
$node->url = "node/$node->nid";
}
}
// Remote nodes may come in with lengthy descriptions that won't fit
// in small boxes of year, month, and week calendars.
if ($type != 'calendar_node_day' && $node->remote) {
$node->teaser = '';
}
return theme($type, $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($view);
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 ''. $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->url", 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 .= '
'. theme('links', $node->calendar_links) ."\n
";
$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->url", array('title' => t('view this item'))) .'
'."\n";
$output .= $times;
$output .= '
'. theme('links', $node->calendar_links) ."\n
";
$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->url", array('title' => t('view this item'))) .'
'."\n";
$output .= $times;
$output .= $node->teaser;
$output .= '
'. theme('links', $node->calendar_links) ."\n
";
$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 */