Ejemplo n.º 1
0
 public function GetReminders($iStart, $iEnd)
 {
     $aReminders = $this->oApiCalendarManager->getReminders($iStart, $iEnd);
     $aEvents = array();
     if ($aReminders && is_array($aReminders) && count($aReminders) > 0) {
         $aCacheEvents = array();
         foreach ($aReminders as $aReminder) {
             $oAccount = $this->getAccount($aReminder['user']);
             $sCalendarUri = $aReminder['calendaruri'];
             $sEventId = $aReminder['eventid'];
             $iStartTime = $aReminder['starttime'];
             if (!isset($aCacheEvents[$sEventId]) && isset($oAccount)) {
                 $aCacheEvents[$sEventId]['data'] = $this->oApiCalendarManager->getEvent($oAccount, $sCalendarUri, $sEventId);
                 $dt = new \DateTime();
                 $dt->setTimestamp($iStartTime);
                 $sDefaultTimeZone = new \DateTimeZone($oAccount->getDefaultStrTimeZone());
                 $dt->setTimezone($sDefaultTimeZone);
                 $aCacheEvents[$sEventId]['time'] = $dt->format($this->getDateTimeFormat($oAccount));
             }
             if (isset($aCacheEvents[$sEventId])) {
                 $aEvents[$aReminder['user']][$sCalendarUri][$sEventId] = $aCacheEvents[$sEventId];
             }
         }
     }
     return $aEvents;
 }
Ejemplo n.º 2
0
 /**
  * @return array
  */
 public function AjaxCalendarAppointmentSetAction()
 {
     $oAccount = $this->getAccountFromParam();
     $oDefaultAccount = $this->getDefaultAccountFromParam();
     $mResult = false;
     $sCalendarId = (string) $this->getParamValue('CalendarId', '');
     $sEventId = (string) $this->getParamValue('EventId', '');
     $sTempFile = (string) $this->getParamValue('File', '');
     $sAction = (string) $this->getParamValue('AppointmentAction', '');
     $sAttendee = (string) $this->getParamValue('Attendee', '');
     if (empty($sAction) || empty($sCalendarId)) {
         throw new \ProjectCore\Exceptions\ClientException(\ProjectCore\Notifications::InvalidInputParameter);
     }
     if ($this->oApiCapability->isCalendarAppointmentsSupported($oDefaultAccount)) {
         $sData = '';
         if (!empty($sEventId)) {
             $aEventData = $this->oApiCalendar->getEvent($oDefaultAccount, $sCalendarId, $sEventId);
             if (isset($aEventData) && isset($aEventData['vcal']) && $aEventData['vcal'] instanceof \Sabre\VObject\Component\VCalendar) {
                 $oVCal = $aEventData['vcal'];
                 $oVCal->METHOD = 'REQUEST';
                 $sData = $oVCal->serialize();
             }
         } else {
             if (!empty($sTempFile)) {
                 $oApiFileCache = \CApi::Manager('filecache');
                 $sData = $oApiFileCache->get($oAccount, $sTempFile);
             }
         }
         if (!empty($sData)) {
             $oCalendarApi = \CApi::Manager('calendar');
             if ($oCalendarApi) {
                 $mProcessResult = $oCalendarApi->appointmentAction($oDefaultAccount, $sAttendee, $sAction, $sCalendarId, $sData);
                 if ($mProcessResult) {
                     $mResult = array('Uid' => $mProcessResult);
                 }
             }
         }
     }
     return $this->DefaultResponse($oDefaultAccount, __FUNCTION__, $mResult);
 }