Sends email notifications that a event has been added, edited, or
deleted to users that want such notifications.
public static sendNotification ( Kronolith_Event $event, string $action ) | ||
$event | Kronolith_Event | An event. |
$action | string | The event action. One of "add", "edit", or "delete". |
/** * Wrapper for sending notifications, so that we can overwrite this action * in Kronolith_Driver_Resource. * * @param Kronolith_Event $event * @param string $action */ protected function _handleNotifications(Kronolith_Event $event, $action) { Kronolith::sendNotification($event, $action); }
/** * Saves an event in the backend. * * @param Kronolith_Event $event The event to save. * * @return string The event id. * @throws Horde_Mime_Exception */ protected function _saveEvent($event, $edit) { $this->synchronize(); $action = $edit ? array('action' => 'modify') : array('action' => 'add'); if (!$event->uid) { $event->uid = $this->_data->generateUID(); $event->id = Horde_Url::uriB64Encode($event->uid); } $object = $event->toKolab(); if ($edit) { $this->_data->modify($object); } else { $this->_data->create($object); } /* Deal with tags */ if ($edit) { $this->_updateTags($event); } else { $this->_addTags($event); } /* Notify about the changed event. */ Kronolith::sendNotification($event, $edit ? 'edit' : 'add'); /* Log the creation/modification of this item in the history log. */ try { $GLOBALS['injector']->getInstance('Horde_History')->log('kronolith:' . $event->calendar . ':' . $event->uid, $action, true); } catch (Exception $e) { Horde::log($e, 'ERR'); } // refresh IMAP cache $this->synchronize(true); if (is_callable('Kolab', 'triggerFreeBusyUpdate')) { //Kolab::triggerFreeBusyUpdate($this->_data->parseFolder($event->calendar)); } return $event->id; }