You are here

function merci_hours_get_open_hours in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3

returns the open and close hours for the given calendar and day of week.

Used to filter the hours widget.

2 calls to merci_hours_get_open_hours()
merci_hours_date_popup_process_alter in merci_hours/merci_hours.module
Implements hook_date_popup_process_alter().
merci_hours_open_hours_ajax in merci_hours/merci_hours.module
Page callback. Returns json array for ajax calls.

File

merci_hours/merci_hours.module, line 447

Code

function merci_hours_get_open_hours($cal = NULL, $day = NULL) {
  $hours = merci_hours_get_open_hours_by_day($cal);
  if (array_key_exists($day, $hours)) {
    $open = $hours[$day][0]['open'];
    $close = $hours[$day][0]['close'];
    return array(
      'open' => $open
        ->format('g:ia'),
      'close' => $close
        ->format('g:ia'),
    );
  }
  else {
    return array(
      'open' => '',
      'close' => '',
    );
  }
}