本文整理汇总了PHP中Kronolith::sendITipNotifications方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::sendITipNotifications方法的具体用法?PHP Kronolith::sendITipNotifications怎么用?PHP Kronolith::sendITipNotifications使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::sendITipNotifications方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _save
/**
* Copyright 1999-2014 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (GPL). If you
* did not receive this file, see http://www.horde.org/licenses/gpl.
*
* @author Chuck Hagenbuch <chuck@horde.org>
* @package Kronolith
*/
function _save(&$event)
{
try {
$event->save();
if (Horde_Util::getFormData('sendupdates', false)) {
Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_REQUEST);
}
} catch (Exception $e) {
$GLOBALS['notification']->push(sprintf(_("There was an error editing the event: %s"), $e->getMessage()), 'horde.error');
}
Kronolith::notifyOfResourceRejection($event);
}
示例2: deleteEvent
/**
* Deletes an event, or an instance of an event series from the backend.
*
* Uses the following request variables:
*<pre>
* - cal: The calendar id.
* - id: The event id.
* - r: If this is an event series, what type of deletion to
* perform [future | current | all].
* - rstart: The start time of the event instance being removed, if
* this is a series instance.
* - cstart: The start date of the client event cache.
* - cend: The end date of the client event cache.
* - sendupdates: Send cancellation notice to attendees?
* </pre>
*/
public function deleteEvent()
{
$result = new stdClass();
$instance = null;
if (!($kronolith_driver = $this->_getDriver($this->vars->cal)) || !isset($this->vars->id)) {
return $result;
}
try {
$event = $kronolith_driver->getEvent($this->vars->id);
if (!$event->hasPermission(Horde_Perms::DELETE)) {
$GLOBALS['notification']->push(_("You do not have permission to delete this event."), 'horde.warning');
return $result;
}
$range = null;
if ($event->recurs() && $this->vars->r != 'all') {
switch ($this->vars->r) {
case 'future':
// Deleting all future instances.
// @TODO: Check if we need to find future exceptions
// that are after $recurEnd and remove those as well.
$instance = new Horde_Date($this->vars->rstart, $event->timezone);
$recurEnd = clone $instance;
$recurEnd->hour = 0;
$recurEnd->min = 0;
$recurEnd->sec = 0;
$recurEnd->mday--;
if ($event->end->compareDate($recurEnd) > 0) {
$kronolith_driver->deleteEvent($event->id);
$result = $this->_signedResponse($this->vars->cal);
$result->events = array();
} else {
$event->recurrence->setRecurEnd($recurEnd);
$result = $this->_saveEvent($event, $event, $this->vars);
}
$range = Kronolith::RANGE_THISANDFUTURE;
break;
case 'current':
// Deleting only the current instance.
$instance = new Horde_Date($this->vars->rstart, $event->timezone);
$event->recurrence->addException($instance->year, $instance->month, $instance->mday);
$result = $this->_saveEvent($event, $event, $this->vars);
}
} else {
// Deleting an entire series, or this is a single event only.
$kronolith_driver->deleteEvent($event->id);
$result = $this->_signedResponse($this->vars->cal);
$result->events = array();
$result->uid = $event->uid;
}
if ($this->vars->sendupdates) {
Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_CANCEL, $instance, $range);
}
$result->deleted = true;
} catch (Horde_Exception_NotFound $e) {
$GLOBALS['notification']->push(_("The requested event was not found."), 'horde.error');
} catch (Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
}
return $result;
}
示例3: elseif
} else {
$event->recurrence->setRecurEnd($recurEnd);
$event->save();
}
$notification_type = Kronolith::ITIP_REQUEST;
} elseif (Horde_Util::getFormData('current')) {
$event->recurrence->addException(Horde_Util::getFormData('year'), Horde_Util::getFormData('month'), Horde_Util::getFormData('mday'));
$event->save();
$instance = new Horde_Date(array('year' => Horde_Util::getFormData('year'), 'month' => Horde_Util::getFormData('month'), 'mday' => Horde_Util::getFormData('mday')));
}
if (!$event->recurs() || Horde_Util::getFormData('all') || !$event->recurrence->hasActiveRecurrence()) {
try {
$kronolith_driver->deleteEvent($event->id);
} catch (Exception $e) {
$notification->push($e, 'horde.error');
}
}
if (Horde_Util::getFormData('sendupdates', false)) {
Kronolith::sendITipNotifications($event, $notification, $notification_type, $instance);
}
}
}
$url = Horde_Util::getFormData('url');
if (!empty($url)) {
$url = new Horde_Url($url, true);
} else {
$date = new Horde_Date(Horde_Util::getFormData('date'));
$url = Horde::url($prefs->getValue('defaultview') . '.php', true)->add('date', Horde_Util::getFormData('date', date('Ymd')));
}
// Make sure URL is unique.
$url->unique()->redirect();
示例4: sprintf
$notification->push(_("You do not have permission to delegate events to this user."), 'horde.warning');
break;
}
$perms = $GLOBALS['injector']->getInstance('Horde_Core_Perms');
if ($perms->hasAppPermission('max_events') !== true && $perms->hasAppPermission('max_events') <= Kronolith::countEvents()) {
Horde::permissionDeniedError('kronolith', 'max_events', sprintf(_("You are not allowed to create more than %d events."), $perms->hasAppPermission('max_events')));
break;
}
$event = Kronolith::getDriver($targetType, $calendar_id)->getEvent();
$event->readForm();
try {
$event->save();
Kronolith::notifyOfResourceRejection($event);
if (Horde_Util::getFormData('sendupdates', false)) {
try {
Kronolith::sendITipNotifications($event, $notification, Kronolith::ITIP_REQUEST);
} catch (Exception $e) {
$notification->push($e, 'horde.error');
}
}
} catch (Exception $e) {
$notification->push(sprintf(_("There was an error adding the event: %s"), $e->getMessage()), 'horde.error');
}
} catch (Exception $e) {
$notification->push(sprintf(_("There was an error accessing the calendar: %s"), $e->getMessage()), 'horde.error');
}
} while (false);
$url = Horde_Util::getFormData('url');
if (!empty($url)) {
$url = new Horde_Url($url, true);
} else {
示例5: davDeleteObject
/**
*/
public function davDeleteObject($collection, $object)
{
$dav = $GLOBALS['injector']->getInstance('Horde_Dav_Storage');
$internal = $dav->getInternalCollectionId($collection, 'calendar') ?: $collection;
if (!Kronolith::hasPermission($internal, Horde_Perms::DELETE)) {
throw new Kronolith_Exception(_("Calendar does not exist or no permission to delete"));
}
try {
$object = $dav->getInternalObjectId($object, $internal) ?: preg_replace('/\\.ics$/', '', $object);
} catch (Horde_Dav_Exception $e) {
}
$kronolith_driver = Kronolith::getDriver(null, $internal);
$event = $kronolith_driver->getEvent($object);
$kronolith_driver->deleteEvent($object);
try {
$dav->deleteExternalObjectId($object, $internal);
} catch (Horde_Dav_Exception $e) {
}
// Send iTip messages unless organizer is external.
// Notifications will get lost, there is no way to return messages to
// clients.
if ($event->organizer && !Kronolith::isUserEmail($event->creator, $event->organizer)) {
return;
}
Kronolith::sendITipNotifications($event, new Horde_Notification_Handler(new Horde_Notification_Storage_Object()), Kronolith::ITIP_CANCEL);
}
示例6: _postSave
protected function _postSave(Kronolith_Event $event)
{
global $registry;
if (!$this->_dav->getInternalObjectId($this->_params['object'], $this->_calendar)) {
$this->_dav->addObjectMap($event->id, $this->_params['object'], $this->_calendar);
}
// Send iTip messages if necessary.
$type = Kronolith::ITIP_REQUEST;
if ($event->organizer && !Kronolith::isUserEmail($event->creator, $event->organizer)) {
$type = Kronolith::ITIP_REPLY;
}
$event_copy = clone $event;
$event_copy->attendees = $event->attendees->without($this->_noItips);
$notification = new Horde_Notification_Handler(new Horde_Notification_Storage_Object());
Kronolith::sendITipNotifications($event_copy, $notification, $type);
// Send ITIP_CANCEL to any attendee that was removed, but only if this
// is the ORGANZIER's copy of the event.
if (empty($event->organizer) || $registry->getAuth() == $event->creator && Kronolith::isUserEmail($event->creator, $event->organizer)) {
$removed_attendees = new Kronolith_Attendee_List();
foreach ($this->_oldAttendees as $old_attendee) {
if (!$event->attendees->has($old_attendee)) {
$removed_attendees->add($old_attendee);
}
}
if (count($removed_attendees)) {
$cancelEvent = clone $event;
Kronolith::sendITipNotifications($cancelEvent, $notification, Kronolith::ITIP_CANCEL, null, null, $removed_attendees);
}
}
}