You are here

function _office_hours_return_defaults in Office Hours 6

2 calls to _office_hours_return_defaults()
office_hours_field_settings in ./office_hours.module
Implementation of hook_field_settings().
office_hours_select_process in ./office_hours.elements.inc
Process the hours selector element.

File

./office_hours.module, line 365
Creates a field and widget for inserting working or office hours per day

Code

function _office_hours_return_defaults($default, $format = 0) {
  $hour = _office_hours_mil_to_tf($default);
  list($defhr, $defmin) = explode(":", $hour);
  if ($format) {
    if ($defhr >= 12) {
      $defhr -= $defhr != 12 ? 12 : 0;
      $ampm = 'pm';
    }
    elseif ($defhr == 0) {
      $defhr += 12;
    }
  }
  else {
    $defhr = str_pad($defhr, 2, '0', STR_PAD_LEFT);
  }
  return array(
    $defhr,
    $defmin,
    $ampm,
  );
}