function event_calendar_week in Event 5.2
Same name and namespace in other branches
- 5 event.module \event_calendar_week()
Displays a weekly event calendar.
Return value
a themed weekly event calendar.
Related topics
1 call to event_calendar_week()
- event_page in ./
event.module - Displays a page containing event information. The page layout defaults to a graphical calendar.
File
- ./
event.module, line 591
Code
function event_calendar_week($op, $date, $types = NULL, $terms = NULL, $rewrite_parameter = array()) {
// get weekdays array and header information
$weekdays = event_week_days();
$thead = event_week_header();
// get current date value
$today = _event_user_date();
// apply offset to goto first day of week
$cur_date = event_date_later($date, -1 * _event_day_of_week($date));
event_calendar_data($date, 'week', $types, $terms, 'prepopulate', array(), $rewrite_parameter);
for ($x = 0; $x < 7; $x++) {
$year = $date['year'];
$month = $date['month'];
$month_name = event_format_date($cur_date, 'custom', 'M');
$row[$x] = array(
'class' => strtolower("{$month_name} " . $weekdays[$x]['day'] . ($date == $today ? ' today' : '') . ($cur_date['day'] == $date['day'] ? ' selected' : '')),
'id' => strtolower($month_name . $cur_date['day']),
'data' => event_render_day($cur_date, 'week', $types, $terms, $rewrite_parameter),
);
$cur_date = event_date_later($cur_date, 1);
}
$tbody[] = $row;
return array(
$thead,
$tbody,
);
}