function _calendar_make_node in Calendar 5
A function to create a blank date to force a calendar display when there is no data
1 call to _calendar_make_node()
- calendar_get_nodes in ./
calendar.module - The workhorse function that takes the beginning array of items and alters it to an array of calendar nodes that the theme can handle.
File
- ./
calendar.module, line 469 - Adds calendar filtering and displays to Views.
Code
function _calendar_make_node($node = NULL, $timestamp = NULL, $offset = NULL, $year = NULL, $month = NULL, $day = NULL, $hour = NULL, $minute = NULL) {
calendar_load_date_api();
$offset = $offset ? $offset : _views_get_timezone();
if (!$timestamp) {
$year = calendar_part_is_valid($year, 'year') ? $year : date_format_date('Y', date_time());
$month = calendar_part_is_valid($month, 'month') ? $month : date_format_date('m', date_time());
$day = calendar_part_is_valid($day, 'day') ? $day : date_format_date('j', date_time());
$hour = calendar_part_is_valid($hour, 'hour') ? $hour : date_format_date('H', date_time());
$minute = calendar_part_is_valid($minute, 'minute') ? $minute : date_format_date('i', date_time());
while (!checkdate($month, $day, $year)) {
$day--;
}
// Account for days that don't exist
$timestamp = date_gmmktime(array(
'hours' => $hour,
'minutes' => $minute,
'mon' => $month,
'mday' => $day,
'year' => $year,
));
}
if (!$node) {
$node = new stdClass();
$node->nid = 0;
}
$node->calendar_start = $timestamp;
$node->start_offset = $offset;
$node->calendar_end = $timestamp;
$node->end_offset = $offset;
return $node;
}