You are here

function _signup_date_format_date in Signup 5.2

Same name in this branch
  1. 5.2 includes/date.5x-2.inc \_signup_date_format_date()
  2. 5.2 includes/date.5x-1.inc \_signup_date_format_date()
Same name and namespace in other branches
  1. 6.2 includes/date.inc \_signup_date_format_date()
  2. 6 includes/date.inc \_signup_date_format_date()
  3. 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.5x-2.inc, line 140
Code required to support version 5.x-2.* of the CCK date field module.

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));
  }
  $date_out = date_format_date($date, 'custom', $field['output_format_date']);
  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', $field['output_format_date']);
    if ($date_value) {
      $date_out .= t(' to ') . date_format_date(date_make_date($date_value), 'custom', $field['output_format_date']);
    }
  }
  return $date_out;
}