protected function AvailabilityCalendarICalFeedsProcessor::update1Period in Availability Calendars 7.5
Updates 1 period on the availability calendar.
Parameters
int $cid:
int $newState:
DateTime $from:
DateTime $to:
int $defaultState:
Return value
bool True if some (or all) dates in the period were updated or false if all dates already have $newState as availability state.
Throws
\Exception
1 call to AvailabilityCalendarICalFeedsProcessor::update1Period()
- AvailabilityCalendarICalFeedsProcessor::setTargetElement in ./
AvailabilityCalendarICalFeedsProcessor.inc - Set a concrete target element. Invoked from FeedsProcessor::map().
File
- ./
AvailabilityCalendarICalFeedsProcessor.inc, line 221
Class
- AvailabilityCalendarICalFeedsProcessor
- @class ICalendar processor for availability calendars.
Code
protected function update1Period($cid, $newState, $from, $to, $defaultState) {
$availability = availability_calendar_get_availability($cid, $from, $to, $defaultState);
$currentStates = array_unique($availability, SORT_NUMERIC);
if (count($currentStates) > 1 || reset($currentStates) != $newState) {
availability_calendar_update_availability($cid, $newState, $from, $to);
return TRUE;
}
return FALSE;
}