function _signup_date_format_date in Signup 6.2
Same name and namespace in other branches
- 5.2 includes/date.5x-2.inc \_signup_date_format_date()
- 5.2 includes/date.5x-1.inc \_signup_date_format_date()
- 6 includes/date.inc \_signup_date_format_date()
- 7 includes/date.inc \_signup_date_format_date()
1 call to _signup_date_format_date()
- signup_format_date in includes/
scheduler.inc
File
- includes/
date.inc, line 499 - Code to support using CCK date fields for time-based signup functionality.
Code
function _signup_date_format_date($node, $include_to_date = FALSE) {
$field = signup_date_field($node->type);
if (!$field || $field == 'none') {
return '';
}
if ($field['tz_handling'] == 'date') {
if (isset($node->{$field['field_name']})) {
$tz = $node->{$field['field_name']}[0]['timezone'];
}
else {
$tz = $node->{$field['database']['columns']['timezone']['column']};
}
}
else {
$tz = date_default_timezone_name();
}
$display_tz = date_get_timezone($field['tz_handling'], $tz);
$db_tz = date_get_timezone_db($field['tz_handling'], $tz);
if (isset($node->{$field['field_name']})) {
$date_value = $node->{$field['field_name']}[0]['value'];
}
else {
$date_value = $node->{$field['database']['columns']['value']['column']};
}
$date = date_make_date($date_value, $db_tz, $field['type']);
if ($db_tz != $display_tz) {
date_timezone_set($date, timezone_open($display_tz));
}
$format = date_formatter_format('default', $field['field_name']);
$date_out = date_format_date($date, 'custom', $format);
if ($include_to_date) {
if (isset($node->{$field['field_name']})) {
$date_value = $node->{$field['field_name']}[0]['value2'];
}
else {
$date_value = $node->{$field['database']['columns']['value2']['column']};
}
$date = date_make_date($date_value, $db_tz, $field['type']);
if ($db_tz != $display_tz) {
date_timezone_set($date, timezone_open($display_tz));
}
$date = date_format_date($date, 'custom', $format);
if ($date_value) {
$date_out .= t(' to ') . date_format_date(date_make_date($date_value), 'custom', $format);
}
}
return $date_out;
}