function calendar_build_week in Calendar 7
Same name in this branch
- 7 includes/calendar.inc \calendar_build_week()
- 7 calendar_multiday/includes/calendar.inc \calendar_build_week()
Same name and namespace in other branches
- 5.2 calendar.inc \calendar_build_week()
- 6.2 includes/calendar.inc \calendar_build_week()
- 6.2 calendar_multiday/includes/calendar.inc \calendar_build_week()
- 7.2 includes/calendar.inc \calendar_build_week()
- 7.2 calendar_multiday/includes/calendar.inc \calendar_build_week()
Build one week row.
4 calls to calendar_build_week()
- calendar_build_calendar in includes/
calendar.inc - Build calendar
- calendar_build_calendar in calendar_multiday/
includes/ calendar.inc - Build calendar
- calendar_build_month in includes/
calendar.inc - Build one month.
- calendar_build_month in calendar_multiday/
includes/ calendar.inc - Build one month.
File
- calendar_multiday/
includes/ calendar.inc, line 387 - Calendar building functions for the Calendar module.
Code
function calendar_build_week(&$curday, $view, $items, $check_month = FALSE) {
$curday_date = date_format($curday, DATE_FORMAT_DATE);
$weekdays = calendar_untranslated_days($items, $view);
$month = date_format($curday, 'n');
$first_day = variable_get('date_first_day', 0);
// Set up buckets
$total_rows = 0;
$multiday_buckets = array(
array(),
array(),
array(),
array(),
array(),
array(),
array(),
);
$singleday_buckets = array(
array(),
array(),
array(),
array(),
array(),
array(),
array(),
);
// move backwards to the first day of the week
$day_wday = date_format($curday, 'w');
date_modify($curday, '-' . strval((7 + $day_wday - $first_day) % 7) . ' days');
$curday_date = date_format($curday, DATE_FORMAT_DATE);
for ($i = 0; $i < 7; $i++) {
if ($check_month && ($curday_date < $view->date_info->min_date_date || $curday_date > $view->date_info->max_date_date || date_format($curday, 'n') != $month)) {
$class = strtolower($weekdays[$i]) . ' empty';
$singleday_buckets[$i][][] = array(
'entry' => theme('calendar_empty_day', array(
'curday' => $curday_date,
'view' => $view,
)),
'item' => NULL,
);
}
else {
calendar_build_week_day($curday, $view, $items, $i, $multiday_buckets, $singleday_buckets);
}
$total_rows = max(count($multiday_buckets[$i]) + 1, $total_rows);
date_modify($curday, '+1 day');
$curday_date = date_format($curday, DATE_FORMAT_DATE);
}
$rows = array(
'multiday_buckets' => $multiday_buckets,
'singleday_buckets' => $singleday_buckets,
'total_rows' => $total_rows,
);
return $rows;
}