function calendar_week_header in Calendar 7.3
Same name and namespace in other branches
- 5.2 calendar.inc \calendar_week_header()
- 5 calendar_api.inc \calendar_week_header()
- 6.2 calendar.module \calendar_week_header()
- 7 calendar.module \calendar_week_header()
- 7.2 calendar.module \calendar_week_header()
Formats the weekday information into table header format
Return value
array with weekday table header data
3 calls to calendar_week_header()
- calendar_plugin_style::calendar_build_mini_month in includes/
calendar_plugin_style.inc - Build one mini month.
- calendar_plugin_style::calendar_build_month in includes/
calendar_plugin_style.inc - Build one month.
- calendar_plugin_style::render in includes/
calendar_plugin_style.inc - Render the display in this style.
File
- ./
calendar.module, line 367 - Adds calendar filtering and displays to Views.
Code
function calendar_week_header($view) {
$len = isset($view->date_info->style_name_size) ? $view->date_info->style_name_size : (!empty($view->date_info->mini) ? 1 : 3);
$with_week = !empty($view->date_info->style_with_weekno);
// create week header
$untranslated_days = calendar_untranslated_days();
$full_translated_days = date_week_days_ordered(date_week_days(TRUE));
if ($len == 99) {
$translated_days = $full_translated_days;
}
else {
$translated_days = date_week_days_ordered(date_week_days_abbr(TRUE));
}
if ($with_week) {
$row[] = array(
'header' => TRUE,
'class' => "days week",
'data' => ' ',
'header_id' => 'Week',
);
}
foreach ($untranslated_days as $delta => $day) {
$label = $len < 3 ? drupal_substr($translated_days[$delta], 0, $len) : $translated_days[$delta];
$row[] = array(
'header' => TRUE,
'class' => "days " . $day,
'data' => $label,
'header_id' => $full_translated_days[$delta],
);
}
return $row;
}