function rooms_availability_ajax_event_status_change in Rooms - Drupal Booking for Hotels, B&Bs and Vacation Rentals 7
The callback for the change_event_status widget of the event manager form.
1 string reference to 'rooms_availability_ajax_event_status_change'
- rooms_availability_event_manager_form in modules/
rooms_availability/ rooms_availability.module - The Event Manager Form.
File
- modules/
rooms_availability/ rooms_availability.module, line 808 - Manages availability for Bookable Units and displaying dates on the jquery FullCalendar plugin.
Code
function rooms_availability_ajax_event_status_change($form, $form_state) {
$start_date = $form_state['values']['rooms_start_date'];
$end_date = $form_state['values']['rooms_end_date'];
$unit_id = $form_state['values']['unit_id'];
$event_id = $form_state['values']['event_id'];
$new_event_id = $form_state['values']['change_event_status'];
// If we have a new event id go ahead and update event.
if ($event_id != $new_event_id && $new_event_id != -1) {
$event = new BookingEvent($unit_id, $new_event_id, $start_date, $end_date);
$uc = new UnitCalendar($unit_id);
$responses = $uc
->updateCalendar(array(
$event,
));
$state_options = rooms_unit_state_options();
if ($event_id >= -1) {
$form['form_wrapper_bottom']['#markup'] = t('Updated event from <strong>@old_status</strong> to <strong>@new_status</strong>.', array(
'@old_status' => $state_options[$event_id],
'@new_status' => $state_options[$new_event_id],
));
}
else {
$form['form_wrapper_bottom']['#markup'] = t('New Event state is <strong>@state</strong>.', array(
'@state' => $state_options[$new_event_id],
));
}
}
return $form;
}