当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Record_RecordSet::setRecurId方法代码示例

本文整理汇总了PHP中Tinebase_Record_RecordSet::setRecurId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_RecordSet::setRecurId方法的具体用法?PHP Tinebase_Record_RecordSet::setRecurId怎么用?PHP Tinebase_Record_RecordSet::setRecurId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Record_RecordSet的用法示例。


在下文中一共展示了Tinebase_Record_RecordSet::setRecurId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: createRecurException

 /**
  * creates an exception instance of a recurring event
  *
  * NOTE: deleting persistent exceptions is done via a normal delete action
  *       and handled in the deleteInspection
  * 
  * @param  Calendar_Model_Event  $_event
  * @param  bool                  $_deleteInstance
  * @param  bool                  $_allFollowing
  * @param  bool                  $_checkBusyConflicts
  * @return Calendar_Model_Event  exception Event | updated baseEvent
  * 
  * @todo replace $_allFollowing param with $range
  * @deprecated replace with create/update/delete
  */
 public function createRecurException($_event, $_deleteInstance = FALSE, $_allFollowing = FALSE, $_checkBusyConflicts = FALSE)
 {
     $baseEvent = $this->getRecurBaseEvent($_event);
     if ($baseEvent->last_modified_time != $_event->last_modified_time) {
         if (Tinebase_Core::isLogLevel(Zend_Log::WARN)) {
             Tinebase_Core::getLogger()->warn(__METHOD__ . '::' . __LINE__ . " It is not allowed to create recur instance if it is clone of base event");
         }
         throw new Tinebase_Timemachine_Exception_ConcurrencyConflict('concurrency conflict!');
     }
     //        // Maybe Later
     //        // exdates needs to stay in baseEvents container
     //        if ($_event->container_id != $baseEvent->container_id) {
     //            throw new Calendar_Exception_ExdateContainer();
     //        }
     // check if this is an exception to the first occurence
     if ($baseEvent->getId() == $_event->getId()) {
         if ($_allFollowing) {
             throw new Exception('please edit or delete complete series!');
         }
         // NOTE: if the baseEvent gets a time change, we can't compute the recurdid w.o. knowing the original dtstart
         $recurid = $baseEvent->setRecurId($baseEvent->getId());
         unset($baseEvent->recurid);
         $_event->recurid = $recurid;
     }
     // just do attender status update if user has no edit grant
     if ($this->_doContainerACLChecks && !$baseEvent->{Tinebase_Model_Grants::GRANT_EDIT}) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " user has no editGrant for event: '{$baseEvent->getId()}'. Only creating exception for attendee status");
         }
         if ($_event->attendee instanceof Tinebase_Record_RecordSet) {
             foreach ($_event->attendee as $attender) {
                 if ($attender->status_authkey) {
                     $exceptionAttender = $this->attenderStatusCreateRecurException($_event, $attender, $attender->status_authkey, $_allFollowing);
                 }
             }
         }
         if (!isset($exceptionAttender)) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG) && $_event->attendee instanceof Tinebase_Record_RecordSet) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Failed to update attendee: " . print_r($_event->attendee->toArray(), true));
             }
             throw new Tinebase_Exception_AccessDenied('Failed to update attendee, status authkey might be missing');
         }
         return $this->get($exceptionAttender->cal_event_id);
     }
     // NOTE: recurid is computed by rrule recur computations and therefore is already part of the event.
     if (empty($_event->recurid)) {
         throw new Exception('recurid must be present to create exceptions!');
     }
     // we do notifications ourself
     $sendNotifications = $this->sendNotifications(FALSE);
     // EDIT for baseEvent is checked above, CREATE, DELETE for recur exceptions is implied with it
     $doContainerACLChecks = $this->doContainerACLChecks(FALSE);
     $db = $this->_backend->getAdapter();
     $transactionId = Tinebase_TransactionManager::getInstance()->startTransaction($db);
     $exdate = new Tinebase_DateTime(substr($_event->recurid, -19));
     $exdates = is_array($baseEvent->exdate) ? $baseEvent->exdate : array();
     $originalDtstart = $_event->getOriginalDtStart();
     $originalEvent = Calendar_Model_Rrule::computeNextOccurrence($baseEvent, new Tinebase_Record_RecordSet('Calendar_Model_Event'), $originalDtstart);
     if ($_allFollowing != TRUE) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Adding exdate for: '{$_event->recurid}'");
         }
         array_push($exdates, $exdate);
         $baseEvent->exdate = $exdates;
         $updatedBaseEvent = $this->update($baseEvent, FALSE);
         if ($_deleteInstance == FALSE) {
             if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                 Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Creating persistent exception for: '{$_event->recurid}'");
             }
             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                 Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . " Recur exception: " . print_r($_event->toArray(), TRUE));
             }
             $_event->base_event_id = $baseEvent->getId();
             $_event->setId(NULL);
             unset($_event->rrule);
             unset($_event->exdate);
             foreach (array('attendee', 'notes', 'alarms') as $prop) {
                 if ($_event->{$prop} instanceof Tinebase_Record_RecordSet) {
                     $_event->{$prop}->setId(NULL);
                 }
             }
             $originalDtstart = $_event->getOriginalDtStart();
             $dtStartHasDiff = $originalDtstart->compare($_event->dtstart) != 0;
             // php52 compat
             if (!$dtStartHasDiff) {
//.........这里部分代码省略.........
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:101,代码来源:Event.php


注:本文中的Tinebase_Record_RecordSet::setRecurId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。