function theme_calendar_nav in Calendar 5.2
Function to construct back and next navigation from views arguments
5 theme calls to theme_calendar_nav()
- calendar_build_calendar in ./
calendar.inc - Build calendar
- calendar_views_pre_view in ./
calendar.module - Implementation of hook_views_pre_view()
- theme_calendar_view_list in ./
calendar.theme - Display the nodes of a view as a list.
- theme_calendar_view_nodes in ./
calendar.theme - Display the nodes of a view as plain nodes.
- theme_calendar_view_table in ./
calendar.theme - Display the nodes of a view as a table.
File
- ./
calendar.theme, line 261
Code
function theme_calendar_nav($view, $link = FALSE, $format = NULL) {
$mini = $view->mini && $view->calendar_type != 'year';
if (!calendar_part_is_valid($view->year, 'year')) {
return $view->subtitle;
}
// make the navigation into a header, with prev and next links
// use the calendar_nav themes to mimic standard calendar navigation
$paths = calendar_get_paths($view);
$prev_path = implode('/', array_reverse($paths[0]));
$next_path = implode('/', array_reverse($paths[1]));
$prev_query = $next_query = array();
if ($_GET['view']) {
$prev_query['view'] = $_GET['view'];
$next_query['view'] = $_GET['view'];
}
// for embedded calendars or the mini calendar in a block, treat the url as a
// querystring to avoid actually changing the page
if ($mini || $view->build_type == 'embed') {
$block_identifier = isset($view->block_identifier) ? $view->block_identifier : 'mini';
$prev_query[$block_identifier] = $prev_path;
$prev_path = !empty($prev_path) ? $_GET['q'] : '';
$next_query[$block_identifier] = $next_path;
$next_path = !empty($next_path) ? $_GET['q'] : '';
}
$output = '<div class="calendar-calendar"><div class="date-nav clear-block">';
$output .= '<div class="date-prev">';
$querystring = calendar_querystring($view, $prev_query);
$period = $view->build_type != 'block' ? t('prev') : '';
if (!empty($prev_path)) {
$output .= l(t('‹ !period ', array(
'!period' => $period,
)), $prev_path, array(
'rel' => 'nofollow',
), !empty($querystring) ? $querystring : NULL);
}
else {
$output .= ' ';
}
$heading = theme('calendar_nav_title', $view->calendar_type, $view, $link, $format);
$output .= '</div><div class="date-heading"><h3>' . $heading . '</h3></div>';
$output .= '<div class="date-next">';
$querystring = calendar_querystring($view, $next_query);
$period = $view->build_type != 'block' ? t('next') : '';
if (!empty($next_path)) {
$output .= l(t(' !period ›', array(
'!period' => $period,
)), $next_path, array(
'rel' => 'nofollow',
), !empty($querystring) ? $querystring : NULL);
}
else {
$output .= ' ';
}
$output .= '</div></div></div>';
return $output;
}