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


PHP calendar::merge_attendee_data方法代碼示例

本文整理匯總了PHP中calendar::merge_attendee_data方法的典型用法代碼示例。如果您正苦於以下問題:PHP calendar::merge_attendee_data方法的具體用法?PHP calendar::merge_attendee_data怎麽用?PHP calendar::merge_attendee_data使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在calendar的用法示例。


在下文中一共展示了calendar::merge_attendee_data方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: update_recurrence_exceptions

 /**
  * Apply the given changes to already existing exceptions
  */
 protected function update_recurrence_exceptions(&$master, $event, $old, $savemode)
 {
     $saved = false;
     $existing = null;
     // determine added and removed attendees
     $added_attendees = $removed_attendees = array();
     if ($savemode == 'future') {
         $old_attendees = $current_attendees = array();
         foreach ((array) $old['attendees'] as $attendee) {
             $old_attendees[] = $attendee['email'];
         }
         foreach ((array) $event['attendees'] as $attendee) {
             $current_attendees[] = $attendee['email'];
             if (!in_array($attendee['email'], $old_attendees)) {
                 $added_attendees[] = $attendee;
             }
         }
         $removed_attendees = array_diff($old_attendees, $current_attendees);
     }
     foreach ($master['recurrence']['EXCEPTIONS'] as $i => $exception) {
         // update a specific instance
         if ($exception['_instance'] == $old['_instance']) {
             $existing = $i;
             // check savemode against existing exception mode.
             // if matches, we can update this existing exception
             if ((bool) $exception['thisandfuture'] === ($savemode == 'future')) {
                 $event['_instance'] = $old['_instance'];
                 $event['thisandfuture'] = $old['thisandfuture'];
                 $event['recurrence_date'] = $old['recurrence_date'];
                 $master['recurrence']['EXCEPTIONS'][$i] = $event;
                 $saved = true;
             }
         }
         // merge the new event properties onto future exceptions
         if ($savemode == 'future' && $exception['_instance'] >= $old['_instance']) {
             unset($event['thisandfuture']);
             self::merge_exception_data($master['recurrence']['EXCEPTIONS'][$i], $event, array('attendees'));
             if (!empty($added_attendees) || !empty($removed_attendees)) {
                 calendar::merge_attendee_data($master['recurrence']['EXCEPTIONS'][$i], $added_attendees, $removed_attendees);
             }
         }
     }
     /*
         // we could not update the existing exception due to savemode mismatch...
         if (!$saved && $existing !== null && $master['recurrence']['EXCEPTIONS'][$existing]['thisandfuture']) {
           // ... try to move the existing this-and-future exception to the next occurrence
           foreach ($this->get_recurring_events($master, $existing['start']) as $candidate) {
             // our old this-and-future exception is obsolete
             if ($candidate['thisandfuture']) {
               unset($master['recurrence']['EXCEPTIONS'][$existing]);
               $saved = true;
               break;
             }
             // this occurrence doesn't yet have an exception
             else if (!$candidate['isexception']) {
               $event['_instance'] = $candidate['_instance'];
               $event['recurrence_date'] = $candidate['recurrence_date'];
               $master['recurrence']['EXCEPTIONS'][$i] = $event;
               $saved = true;
               break;
             }
           }
         }
     */
     // set link to top-level exceptions
     $master['exceptions'] =& $master['recurrence']['EXCEPTIONS'];
     // returning false here will add a new exception
     return $saved;
 }
開發者ID:nciftci,項目名稱:plugins,代碼行數:72,代碼來源:kolab_driver.php

示例2: update_attendees

 /**
  * Update the participant status for the given attendees
  *
  * @see calendar_driver::update_attendees()
  */
 public function update_attendees(&$event, $attendees)
 {
     $success = $this->edit_event($event, true);
     // apply attendee updates to recurrence exceptions too
     if ($success && $event['_savemode'] == 'all' && !empty($event['recurrence']) && empty($event['recurrence_id']) && ($exceptions = $this->_load_exceptions($event))) {
         foreach ($exceptions as $exception) {
             calendar::merge_attendee_data($exception, $attendees);
             $this->_update_event($exception, false);
         }
     }
     return $success;
 }
開發者ID:claudineyqr,項目名稱:Kolab-Roundcube-Calendar,代碼行數:17,代碼來源:database_driver.php


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