예제 #1
0
 /**
  * prepares iMIP component for client
  *  
  * @param  Calendar_Model_iMIP $_iMIP
  * @return Calendar_Model_iMIP
  */
 public function prepareComponent($_iMIP)
 {
     $this->_checkPreconditions($_iMIP);
     Calendar_Convert_Event_Json::resolveRelatedData($_iMIP->event);
     Tinebase_Model_Container::resolveContainerOfRecord($_iMIP->event);
     Tinebase_Model_Container::resolveContainerOfRecord($_iMIP->getExistingEvent());
     return $_iMIP;
 }
 /**
  * converts Tinebase_Record_RecordSet to external format
  * 
  * @param Tinebase_Record_RecordSet         $_records
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param Tinebase_Model_Pagination         $_pagination
  *
  * @return mixed
  */
 public function fromTine20RecordSet(Tinebase_Record_RecordSet $_records = NULL, $_filter = NULL, $_pagination = NULL)
 {
     if (count($_records) == 0) {
         return array();
     }
     Tinebase_Notes::getInstance()->getMultipleNotesOfRecords($_records);
     Tinebase_Tags::getInstance()->getMultipleTagsOfRecords($_records);
     if (Tinebase_Core::isFilesystemAvailable()) {
         Tinebase_FileSystem_RecordAttachments::getInstance()->getMultipleAttachmentsOfRecords($_records);
     }
     Calendar_Model_Attender::resolveAttendee($_records->attendee, TRUE, $_records);
     Calendar_Convert_Event_Json::resolveRrule($_records);
     Calendar_Controller_Event::getInstance()->getAlarms($_records);
     Calendar_Convert_Event_Json::resolveGrantsOfExternalOrganizers($_records);
     Calendar_Model_Rrule::mergeAndRemoveNonMatchingRecurrences($_records, $_filter);
     $_records->sortByPagination($_pagination);
     Tinebase_Frontend_Json_Abstract::resolveContainersAndTags($_records, array('container_id'));
     $_records->setTimezone(Tinebase_Core::getUserTimezone());
     $_records->convertDates = true;
     $eventsData = $_records->toArray();
     foreach ($eventsData as $idx => $eventData) {
         if (!(isset($eventData[Tinebase_Model_Grants::GRANT_READ]) || array_key_exists(Tinebase_Model_Grants::GRANT_READ, $eventData)) || !$eventData[Tinebase_Model_Grants::GRANT_READ]) {
             $eventsData[$idx] = array_intersect_key($eventsData[$idx], array_flip(array('id', 'dtstart', 'dtend', 'transp', 'is_all_day_event')));
         }
     }
     return $eventsData;
 }
예제 #3
0
 /**
  * returns multiple records prepared for json transport
  *
  * @param Tinebase_Record_RecordSet $_records Tinebase_Record_Abstract
  * @param Tinebase_Model_Filter_FilterGroup $_filter
  * @param Tinebase_Model_Pagination $_pagination needed for sorting
  * @return array data
  * 
  * @todo perhaps we need to resolveContainerTagsUsers() before  mergeAndRemoveNonMatchingRecurrences(), but i'm not sure about that
  * @todo use Calendar_Convert_Event_Json
  */
 protected function _multipleRecordsToJson(Tinebase_Record_RecordSet $_records, $_filter = NULL, $_pagination = NULL)
 {
     if ($_records->getRecordClassName() == 'Calendar_Model_Event') {
         if (is_null($_filter)) {
             throw new Tinebase_Exception_InvalidArgument('Required argument $_filter is missing');
         }
         Tinebase_Notes::getInstance()->getMultipleNotesOfRecords($_records);
         Calendar_Model_Attender::resolveAttendee($_records->attendee, TRUE, $_records);
         Calendar_Convert_Event_Json::resolveOrganizer($_records);
         Calendar_Convert_Event_Json::resolveRrule($_records);
         Calendar_Controller_Event::getInstance()->getAlarms($_records);
         Calendar_Model_Rrule::mergeAndRemoveNonMatchingRecurrences($_records, $_filter);
         $_records->sortByPagination($_pagination);
         $eventsData = parent::_multipleRecordsToJson($_records);
         foreach ($eventsData as $eventData) {
             if (!array_key_exists(Tinebase_Model_Grants::GRANT_READ, $eventData) || !$eventData[Tinebase_Model_Grants::GRANT_READ]) {
                 $eventData['notes'] = array();
                 $eventData['tags'] = array();
             }
         }
         return $eventsData;
     }
     return parent::_multipleRecordsToJson($_records);
 }