當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Kronolith::getInternalCalendar方法代碼示例

本文整理匯總了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);
//.........這裏部分代碼省略.........
開發者ID:kossamums,項目名稱:horde,代碼行數:101,代碼來源:Handler.php

示例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);
     }
 }
開發者ID:horde,項目名稱:horde,代碼行數:23,代碼來源:Api.php


注:本文中的Kronolith::getInternalCalendar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。