/**
  * Return full data of a specific revision of an event
  *
  * @param mixed  $task UID string or hash array with task properties
  * @param mixed  $rev Revision number
  *
  * @return array Task object as hash array
  * @see tasklist_driver::get_task_revision()
  */
 public function get_task_revison($prop, $rev)
 {
     if (empty($this->bonnie_api)) {
         return false;
     }
     $this->_parse_id($prop);
     $uid = $prop['uid'];
     $list_id = $prop['list'];
     list($uid, $mailbox, $msguid) = $this->_resolve_task_identity($prop);
     // call Bonnie API
     $result = $this->bonnie_api->get('task', $uid, $rev, $mailbox, $msguid);
     if (is_array($result) && $result['uid'] == $uid && !empty($result['xml'])) {
         $format = kolab_format::factory('task');
         $format->load($result['xml']);
         $rec = $format->to_array();
         $format->get_attachments($rec, true);
         if ($format->is_valid()) {
             $rec = self::_to_rcube_task($rec, $list_id, false);
             $rec['rev'] = $result['rev'];
             return $rec;
         }
     }
     return false;
 }
예제 #2
0
 /**
  * Return full data of a specific revision of an event
  *
  * @param array  Hash array with event properties
  * @param mixed  $rev Revision number
  *
  * @return array Event object as hash array
  * @see calendar_driver::get_event_revison()
  */
 public function get_event_revison($event, $rev, $internal = false)
 {
     if (empty($this->bonnie_api)) {
         return false;
     }
     $eventid = $event['id'];
     $calid = $event['calendar'];
     list($uid, $mailbox, $msguid) = $this->_resolve_event_identity($event);
     // call Bonnie API
     $result = $this->bonnie_api->get('event', $uid, $rev, $mailbox, $msguid);
     if (is_array($result) && $result['uid'] == $uid && !empty($result['xml'])) {
         $format = kolab_format::factory('event');
         $format->load($result['xml']);
         $event = $format->to_array();
         $format->get_attachments($event, true);
         // get the right instance from a recurring event
         if ($eventid != $event['uid']) {
             $instance_id = substr($eventid, strlen($event['uid']) + 1);
             // check for recurrence exception first
             if ($instance = $format->get_instance($instance_id)) {
                 $event = $instance;
             } else {
                 // not a exception, compute recurrence...
                 $event['_formatobj'] = $format;
                 $recurrence_date = rcube_utils::anytodatetime($instance_id, $event['start']->getTimezone());
                 foreach ($this->get_recurring_events($event, $event['start'], $recurrence_date) as $instance) {
                     if ($instance['id'] == $eventid) {
                         $event = $instance;
                         break;
                     }
                 }
             }
         }
         if ($format->is_valid()) {
             $event['calendar'] = $calid;
             $event['rev'] = $result['rev'];
             return $internal ? $event : self::to_rcube_event($event);
         }
     }
     return false;
 }
예제 #3
0
 /**
  * Return full data of a specific revision of an event
  *
  * @param array  Hash array with event properties
  * @param mixed  $rev Revision number
  *
  * @return array Event object as hash array
  * @see calendar_driver::get_event_revison()
  */
 public function get_event_revison($event, $rev)
 {
     if (empty($this->bonnie_api)) {
         return false;
     }
     $calid = $event['calendar'];
     list($uid, $mailbox) = $this->_resolve_event_identity($event);
     // call Bonnie API
     $result = $this->bonnie_api->get('event', $uid, $rev, $mailbox);
     if (is_array($result) && $result['uid'] == $uid && !empty($result['xml'])) {
         $format = kolab_format::factory('event');
         $format->load($result['xml']);
         $event = $format->to_array();
         if ($format->is_valid()) {
             $event['calendar'] = $calid;
             $event['rev'] = $result['rev'];
             return self::to_rcube_event($event);
         }
     }
     return false;
 }