function bat_api_services_update_availability in Booking and Availability Management API 7
Update the availability for a given unit.
Parameters
$unit_id:
$availability_info:
1 string reference to 'bat_api_services_update_availability'
- bat_api_services_resources in ./
bat_api.module - Implements hook_services_resources().
File
- ./
bat_api.module, line 546
Code
function bat_api_services_update_availability($unit_id, $availability_info) {
$return = new stdClass();
$return->sessid = session_id();
$event_id = $availability_info['event_id'];
$start_date = new DateTime($availability_info['start_date']);
$end_date = new DateTime($availability_info['end_date']);
$be = new BookingEvent($unit_id, $event_id, $start_date, $end_date);
$events = array(
$be,
);
$rc = new UnitCalendar($unit_id);
$response = $rc
->updateCalendar($events);
if ($response[$event_id] == ROOMS_BLOCKED) {
$return->status = 0;
}
elseif ($response[$event_id] == ROOMS_UPDATED) {
$return->status = 1;
}
return $return;
}