function availability_calendar_update_multiple_availability in Availability Calendars 7.3
Same name and namespace in other branches
- 7.5 availability_calendar.inc \availability_calendar_update_multiple_availability()
- 7.4 availability_calendar.inc \availability_calendar_update_multiple_availability()
Updates/inserts the states for the given ranges.
Parameters
NULL|int $cid: The calendar id. If NULL, a new calendar will be created.
array $changes: An array of changes each entry is an array with keys state, from and to.
Return value
int The cid (of the existing or newly created calendar).
1 call to availability_calendar_update_multiple_availability()
- availability_calendar_field_attach_submit in ./
availability_calendar.widget.inc - Implements hook_field_attach_submit. @link http://api.drupal.org/api/drupal/modules--field--field.api.php/function/...
File
- ./
availability_calendar.inc, line 504 - General helper methods for Availability Calendar
Code
function availability_calendar_update_multiple_availability($cid, $changes) {
if (empty($cid)) {
$cid = availability_calendar_create_calendar();
}
else {
availability_calendar_update_calendar($cid);
}
foreach ($changes as $change) {
availability_calendar_update_availability($cid, $change['state'], $change['from'], $change['to'], FALSE);
}
return $cid;
}