本文整理汇总了PHP中Kronolith::getInternalCalendar方法的典型用法代码示例。如果您正苦于以下问题:PHP Kronolith::getInternalCalendar方法的具体用法?PHP Kronolith::getInternalCalendar怎么用?PHP Kronolith::getInternalCalendar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kronolith
的用法示例。
在下文中一共展示了Kronolith::getInternalCalendar方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveEvent
/**
* Save a new or update an existing event from the AJAX event detail view.
*
* Request parameters used:
* - event: The event id.
* - cal: The calendar id.
* - targetcalendar: If moving events, the targetcalendar to move to.
* - as_new: Save an existing event as a new event.
* - recur_edit: If editing an instance of a recurring event series,
* how to apply the edit [current|future|all].
* - rstart: If editing an instance of a recurring event series,
* the original start datetime of this instance.
* - rend: If editing an instance of a recurring event series,
* the original ending datetime of this instance.
* - sendupdates: Should updates be sent to attendees?
* - cstart: Start time of the client cache.
* - cend: End time of the client cache.
*/
public function saveEvent()
{
global $injector, $notification, $registry;
$result = $this->_signedResponse($this->vars->targetcalendar);
if (!($kronolith_driver = $this->_getDriver($this->vars->targetcalendar))) {
return $result;
}
if ($this->vars->as_new) {
unset($this->vars->event);
}
if (!$this->vars->event) {
$perms = $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')));
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 = $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($registry->getAuth(), Horde_Perms::DELETE) && ($user == $registry->getAuth() && $share->hasPermission($registry->getAuth(), Horde_Perms::EDIT) || $user != $registry->getAuth() && $share->hasPermission($registry->getAuth(), Kronolith::PERMS_DELEGATE))) {
$kronolith_driver->move($this->vars->event, $target);
$kronolith_driver = $this->_getDriver($this->vars->targetcalendar);
}
} catch (Exception $e) {
$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 {
// Note that when this is a new event, $this->vars->event will
// be empty, so this will create a new event.
$event = $kronolith_driver->getEvent($this->vars->event);
} catch (Horde_Exception_NotFound $e) {
$notification->push(_("The requested event was not found."), 'horde.error');
return $result;
} catch (Exception $e) {
$notification->push($e);
return $result;
}
}
if (!$event->hasPermission(Horde_Perms::EDIT)) {
$notification->push(_("You do not have permission to edit this event."), 'horde.warning');
return $result;
}
$removed_attendees = $old_attendees = array();
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($event);
// 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);
//.........这里部分代码省略.........
示例2: move
/**
* Move an event.
*
* @param string $uid The event UID.
* @param string $source The source calendar's id.
* @param string $target The target calendar's id.
*
* @since 4.3.0
*/
public function move($uid, $source, $target)
{
global $registry;
$kronolith_driver = Kronolith::getDriver(null, $source);
$event = $kronolith_driver->getByUID($uid);
if (!$event->hasPermission(Horde_Perms::EDIT) || $event->private && $event->creator != $registry->getAuth()) {
throw new Horde_Exception_PermissionDenied();
}
$sourceShare = Kronolith::getInternalCalendar($kronolith_driver->calendar);
$share = Kronolith::getInternalCalendar($target);
if ($sourceShare->hasPermission($registry->getAuth(), Horde_Perms::DELETE) && ($user == $registry->getAuth() && $share->hasPermission($registry->getAuth(), Horde_Perms::EDIT) || $user != $registry->getAuth() && $share->hasPermission($registry->getAuth(), Kronolith::PERMS_DELEGATE))) {
$kronolith_driver->move($event->id, $target);
}
}