/** * checks if all attendee of given event are not busy for given event * * @param Calendar_Model_Event $_event * @return void * @throws Calendar_Exception_AttendeeBusy */ public function checkBusyConflicts($_event) { $ignoreUIDs = !empty($_event->uid) ? array($_event->uid) : array(); if ($_event->transp == Calendar_Model_Event::TRANSP_TRANSP || count($_event->attendee) < 1) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Skipping free/busy check because event is transparent or has no attendee"); } return; } $periods = $this->getBlockingPeriods($_event, array('from' => $_event->dtstart, 'until' => $_event->dtstart->getClone()->addMonth(2))); $fbInfo = $this->getFreeBusyInfo($periods, $_event->attendee, $ignoreUIDs); if (count($fbInfo) > 0) { $busyException = new Calendar_Exception_AttendeeBusy(); $busyException->setFreeBusyInfo($fbInfo); Calendar_Model_Attender::resolveAttendee($_event->attendee, false); $busyException->setEvent($_event); throw $busyException; } if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Free/busy check: no conflict found"); } }
/** * checks if all attendee of given event are not busy for given event * * @param Calendar_Model_Event $_event * @return void * @throws Calendar_Exception_AttendeeBusy */ public function checkBusyConflicts($_event) { $ignoreUIDs = !empty($_event->uid) ? array($_event->uid) : array(); if ($_event->transp == Calendar_Model_Event::TRANSP_TRANSP || count($_event->attendee) < 1) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Skipping free/busy check because event is transparent or has no attendee"); } return; } $eventSet = new Tinebase_Record_RecordSet('Calendar_Model_Event', array($_event)); if (!empty($_event->rrule)) { $checkUntil = clone $_event->dtstart; $checkUntil->add(1, Tinebase_DateTime::MODIFIER_MONTH); Calendar_Model_Rrule::mergeRecurrenceSet($eventSet, $_event->dtstart, $checkUntil); } $periods = array(); foreach ($eventSet as $event) { $periods[] = array('from' => $event->dtstart, 'until' => $event->dtend); } $fbInfo = $this->getFreeBusyInfo($periods, $_event->attendee, $ignoreUIDs); if (count($fbInfo) > 0) { $busyException = new Calendar_Exception_AttendeeBusy(); $busyException->setFreeBusyInfo($fbInfo); Calendar_Model_Attender::resolveAttendee($_event->attendee, false); $busyException->setEvent($_event); throw $busyException; } if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Free/busy check: no conflict found"); } }
/** * checks if all attendee of given event are not busy for given event * * @param Calendar_Model_Event $_event * @return void * @throws Calendar_Exception_AttendeeBusy */ public function checkBusyConflicts($_event) { $ignoreUIDs = !empty($_event->uid) ? array($_event->uid) : array(); // don't check if event is trasparent if ($_event->transp == Calendar_Model_Event::TRANSP_TRANSP || count($_event->attendee) < 1) { return; } $eventSet = new Tinebase_Record_RecordSet('Calendar_Model_Event', array($_event)); if (!empty($_event->rrule)) { $checkUntil = clone $_event->dtstart; $checkUntil->add(1, Tinebase_DateTime::MODIFIER_MONTH); Calendar_Model_Rrule::mergeRecurrenceSet($eventSet, $_event->dtstart, $checkUntil); } $periods = array(); foreach ($eventSet as $event) { $periods[] = array('from' => $event->dtstart, 'until' => $event->dtend); } $fbInfo = $this->getFreeBusyInfo($periods, $_event->attendee, $ignoreUIDs); //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . ' (' . __LINE__ . ') value: ' . print_r($fbInfo->toArray(), true)); if (count($fbInfo) > 0) { $busyException = new Calendar_Exception_AttendeeBusy(); $busyException->setFreeBusyInfo($fbInfo); throw $busyException; } }