本文整理汇总了PHP中Kronolith::notifyOfResourceRejection方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::notifyOfResourceRejection方法的具体用法?PHP Kronolith::notifyOfResourceRejection怎么用?PHP Kronolith::notifyOfResourceRejection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::notifyOfResourceRejection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: updateEvent
/**
* Update event details as a result of a drag/drop operation (which would
* only affect the event's start/end times).
*
* Uses the following request variables:
*<pre>
* -cal: The calendar id.
* -id: The event id.
* -att: Attribute hash of changed values. Can contain:
* -start: A new start datetime for the event.
* -end: A new end datetime for the event.
* -offDays: An offset of days to apply to the event.
* -offMins: An offset of minutes to apply to the event.
* -rstart: The orginal start datetime of a series instance.
* -rend: The original end datetime of a series instance.
* -rday: A new start value for a series instance (used when
* dragging on the month view where only the date can
* change, and not the start/end times).
* -u: Send update to attendees.
*</pre>
*/
public function updateEvent()
{
$result = $this->_signedResponse($this->vars->cal);
if (!($kronolith_driver = $this->_getDriver($this->vars->cal)) || !isset($this->vars->id)) {
return $result;
}
try {
$oevent = $kronolith_driver->getEvent($this->vars->id);
} catch (Exception $e) {
$GLOBALS['notification']->push($e, 'horde.error');
return $result;
}
if (!$oevent) {
$GLOBALS['notification']->push(_("The requested event was not found."), 'horde.error');
return $result;
} elseif (!$oevent->hasPermission(Horde_Perms::EDIT)) {
$GLOBALS['notification']->push(_("You do not have permission to edit this event."), 'horde.warning');
return $result;
}
$attributes = Horde_Serialize::unserialize($this->vars->att, Horde_Serialize::JSON);
// If this is a recurring event, need to create an exception.
if ($oevent->recurs()) {
$this->_addException($oevent, $attributes);
$event = $this->_copyEvent($oevent, null, $attributes);
} else {
$event = clone $oevent;
}
foreach ($attributes as $attribute => $value) {
switch ($attribute) {
case 'start':
$newDate = new Horde_Date($value);
$newDate->setTimezone($event->start->timezone);
$event->start = clone $newDate;
break;
case 'end':
$newDate = new Horde_Date($value);
$newDate->setTimezone($event->end->timezone);
$event->end = clone $newDate;
if ($event->end->hour == 23 && $event->end->min == 59 && $event->end->sec == 59) {
$event->end->mday++;
$event->end->hour = $event->end->min = $event->end->sec = 0;
}
break;
case 'offDays':
$event->start->mday += $value;
$event->end->mday += $value;
break;
case 'offMins':
$event->start->min += $value;
$event->end->min += $value;
break;
}
}
$result = $this->_saveEvent($event, $oevent->recurs() ? $oevent : null, $attributes);
if ($this->vars->u) {
Kronolith::sendITipNotifications($event, $GLOBALS['notification'], Kronolith::ITIP_REQUEST);
}
Kronolith::notifyOfResourceRejection($event);
return $result;
}
示例3: sprintf
break;
}
if ($user != $GLOBALS['registry']->getAuth() && !$kronolith_calendar->hasPermission(Kronolith::PERMS_DELEGATE)) {
$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');
示例4: saveEvent
//.........这里部分代码省略.........
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')));
return $result;
}
}
if ($this->vars->event && $this->vars->cal && $this->vars->cal != $this->vars->targetcalendar) {
if (strpos($kronolith_driver->calendar, '\\')) {
list($target, $user) = explode('\\', $kronolith_driver->calendar, 2);
} else {
$target = $kronolith_driver->calendar;
$user = $GLOBALS['registry']->getAuth();
}
$kronolith_driver = $this->_getDriver($this->vars->cal);
// Only delete the event from the source calendar if this user has
// permissions to do so.
try {
$sourceShare = Kronolith::getInternalCalendar($kronolith_driver->calendar);
$share = Kronolith::getInternalCalendar($target);
if ($sourceShare->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::DELETE) && ($user == $GLOBALS['registry']->getAuth() && $share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT) || $user != $GLOBALS['registry']->getAuth() && $share->hasPermission($GLOBALS['registry']->getAuth(), Kronolith::PERMS_DELEGATE))) {
$kronolith_driver->move($this->vars->event, $target);
$kronolith_driver = $this->_getDriver($this->vars->targetcalendar);
}
} catch (Exception $e) {
$GLOBALS['notification']->push(sprintf(_("There was an error moving the event: %s"), $e->getMessage()), 'horde.error');
return $result;
}
}
if ($this->vars->as_new) {
$event = $kronolith_driver->getEvent();
} else {
try {
$event = $kronolith_driver->getEvent($this->vars->event);
} catch (Horde_Exception_NotFound $e) {
$GLOBALS['notification']->push(_("The requested event was not found."), 'horde.error');
return $result;
} catch (Exception $e) {
$GLOBALS['notification']->push($e);
return $result;
}
}
if (!$event->hasPermission(Horde_Perms::EDIT)) {
$GLOBALS['notification']->push(_("You do not have permission to edit this event."), 'horde.warning');
return $result;
}
if ($this->vars->recur_edit && $this->vars->recur_edit != 'all') {
switch ($this->vars->recur_edit) {
case 'current':
$attributes = new stdClass();
$attributes->rstart = $this->vars->rstart;
$attributes->rend = $this->vars->rend;
$this->_addException($event, $attributes);
// Create a copy of the original event so we can read in the new
// form values for the exception. We also MUST reset the recurrence
// property even though we won't be using it, since clone() does not
// do a deep copy. Otherwise, the original event's recurrence will
// become corrupt.
$newEvent = clone $event;
$newEvent->recurrence = new Horde_Date_Recurrence($event->start);
$newEvent->readForm();
// Create an exception event from the new properties.
$exception = $this->_copyEvent($event, $newEvent, $attributes);
$exception->start = $newEvent->start;
$exception->end = $newEvent->end;
// Save the new exception.
$attributes->cstart = $this->vars->cstart;
$attributes->cend = $this->vars->cend;
$result = $this->_saveEvent($exception, $event, $attributes);
break;
case 'future':
$instance = new Horde_Date($this->vars->rstart, $event->timezone);
$exception = clone $instance;
$exception->mday--;
if ($event->end->compareDate($exception) > 0) {
// Same as 'all' since this is the first recurrence.
$this->vars->recur_edit = 'all';
return $this->saveEvent();
} else {
$event->recurrence->setRecurEnd($exception);
$newEvent = $kronolith_driver->getEvent();
$newEvent->readForm();
$newEvent->uid = null;
$result = $this->_saveEvent($newEvent, $event, $this->vars, true);
}
}
} else {
try {
$event->readForm();
$result = $this->_saveEvent($event);
} catch (Exception $e) {
$GLOBALS['notification']->push($e);
return $result;
}
}
if ($result !== true && $this->vars->sendupdates) {
$type = $event->status == Kronolith::STATUS_CANCELLED ? Kronolith::ITIP_CANCEL : Kronolith::ITIP_REQUEST;
Kronolith::sendITipNotifications($event, $GLOBALS['notification'], $type);
}
Kronolith::notifyOfResourceRejection($event);
return $result;
}