function merci_holiday_merci_dates_open_alter in MERCI (Manage Equipment Reservations, Checkout and Inventory) 7.3
File
- merci_hours/
merci_holiday.module, line 5
Code
function merci_holiday_merci_dates_open_alter(&$dates, $wc, $context) {
$holidays = array();
$argument = $context['year'];
$argument .= $context['month'] ? '-' . $context['month'] : '';
$argument .= $context['day'] ? '-' . $context['day'] : '';
if (!empty($wc->{MERCI_HOLIDAYS_FIELD})) {
foreach ($wc->{MERCI_HOLIDAYS_FIELD}[LANGUAGE_NONE] as $holiday) {
$target_view = explode('|', $holiday['vname']);
$view = views_get_view($target_view[0]);
$view
->set_display($target_view[1]);
$arguments[0] = $argument;
$view
->set_arguments($arguments);
$view
->build();
$view
->pre_execute();
$view
->execute();
$field_alias = $view->argument['date_argument']->table_alias . '_' . $view->argument['date_argument']->real_field;
foreach ($view->result as $holiday) {
list($holidays[]) = explode(' ', $holiday->{$field_alias});
}
}
}
$dates = array_values(array_diff($dates, $holidays));
}