Example #1
0
 /**
  * @todo
  * @return array
  */
 public function RawCalendars()
 {
     $oAccount = $this->getDefaultAccountFromParam();
     if ($this->oApiCapability->isCalendarSupported($oAccount)) {
         $sRawKey = (string) $this->getParamValue('RawKey', '');
         $aValues = \CApi::DecodeKeyValues($sRawKey);
         if (isset($aValues['CalendarId'])) {
             $sCalendarId = $aValues['CalendarId'];
             $oApiCalendarManager = \CApi::Manager('calendar');
             $sOutput = $oApiCalendarManager->exportCalendarToIcs($oAccount, $sCalendarId);
             if (false !== $sOutput) {
                 header('Pragma: public');
                 header('Content-Type: text/calendar');
                 header('Content-Disposition: attachment; filename="' . $sCalendarId . '.ics";');
                 header('Content-Transfer-Encoding: binary');
                 echo $sOutput;
                 return true;
             }
         }
     }
     return false;
 }