public function deleteEvent($eventId, $silent = false)
{
$event = $this->_deleteEvent($eventId, $silent);
if (!$event) {
return;
}
/* Log the deletion of this item in the history log. */
if ($event->uid) {
try {
$GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $this->calendar . ':' . $event->uid, array('action' => 'delete'), true);
} catch (Exception $e) {
Horde::log($e, 'ERR');
}
}
/* Remove the event from any resources that are attached to it. */
$resources = $event->getResources();
if (count($resources)) {
$rd = Kronolith::getDriver('Resource');
foreach ($resources as $uid => $resource) {
if ($resource['response'] !== Kronolith::RESPONSE_DECLINED && $resource['response'] !== Kronolith::RESPONSE_NONE) {
try {
$r = $rd->getResource($uid);
$r->removeEvent($event);
} catch (Kronolith_Exception $e) {
}
}
}
}
/* Remove any pending alarms. */
$GLOBALS['injector']->getInstance('Horde_Alarm')->delete($event->uid);
/* Remove any tags */
$tagger = Kronolith::getTagger();
$tagger->replaceTags($event->uid, array(), $event->creator, Kronolith_Tagger::TYPE_EVENT);
/* Tell content we removed the object */
$GLOBALS['injector']->getInstance('Content_Objects_Manager')->delete(array($event->uid), Kronolith_Tagger::TYPE_EVENT);
/* Remove any geolocation data. */
try {
$GLOBALS['injector']->getInstance('Kronolith_Geo')->deleteLocation($event->id);
} catch (Kronolith_Exception $e) {
}
/* Remove any CalDAV mappings. */
try {
$davStorage = $GLOBALS['injector']->getInstance('Horde_Dav_Storage');
try {
$davStorage->deleteInternalObjectId($event->id, $event->calendar);
} catch (Horde_Exception $e) {
Horde::log($e);
}
} catch (Horde_Exception $e) {
}
/* See if this event represents an exception - if so, touch the base
* event's history. The $isRecurring check is to prevent an infinite
* loop in the off chance that an exception is entered as a recurring
* event.
*/
if ($event->baseid && !$event->recurs()) {
try {
$GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $this->calendar . ':' . $event->baseid, array('action' => 'modify'), true);
} catch (Exception $e) {
Horde::log($e, 'ERR');
}
}
}