private function GetICalContent(array $event, $siteId)
 {
     $arICalEvent = array("TYPE" => "VEVENT", "CREATED" => date("Ymd\\THis\\Z", MakeTimeStamp($event["DATE_CREATE"])), "LAST-MODIFIED" => date("Ymd\\THis\\Z", MakeTimeStamp($event["TIMESTAMP_X"])), "DTSTAMP" => date("Ymd\\THis\\Z", MakeTimeStamp($event["TIMESTAMP_X"])), "UID" => $event["XML_ID"], "SUMMARY" => $event["NAME"], "DTSTART" => array("VALUE" => date("Ymd\\THis", MakeTimeStamp($event["ACTIVE_FROM"])), "PARAMETERS" => array("TZID" => CDav::GetTimezoneId($siteId))), "DTEND" => array("VALUE" => date("Ymd\\THis", MakeTimeStamp($event["ACTIVE_TO"])), "PARAMETERS" => array("TZID" => CDav::GetTimezoneId($siteId))));
     if (isset($event["PROPERTY_ACCESSIBILITY"]) && ($event["PROPERTY_ACCESSIBILITY"] == 'free' || $event["PROPERTY_ACCESSIBILITY"] == 'quest')) {
         $arICalEvent["TRANSP"] = 'TRANSPARENT';
     } else {
         $arICalEvent["TRANSP"] = 'OPAQUE';
     }
     if (isset($event["PROPERTY_LOCATION"]) && strlen($event["PROPERTY_LOCATION"]) > 0) {
         $arICalEvent["LOCATION"] = $event["PROPERTY_LOCATION"];
     }
     if (isset($event["PROPERTY_IMPORTANCE"])) {
         if ($event["PROPERTY_IMPORTANCE"] == "low") {
             $arICalEvent["PRIORITY"] = 9;
         } elseif ($event["PROPERTY_IMPORTANCE"] == "high") {
             $arICalEvent["PRIORITY"] = 1;
         } else {
             $arICalEvent["PRIORITY"] = 5;
         }
     }
     if (isset($event["DETAIL_TEXT"]) && strlen($event["DETAIL_TEXT"]) > 0) {
         $arICalEvent["DESCRIPTION"] = strip_tags($event["DETAIL_TEXT"]);
     }
     if (isset($event["PROPERTY_REMIND_SETTINGS"]) && strlen($event["PROPERTY_REMIND_SETTINGS"]) > 0) {
         $arPeriodMapTmp = array("min" => "M", "hour" => "H", "day" => "D");
         $ar = explode("_", $event["PROPERTY_REMIND_SETTINGS"]);
         $arICalEvent["@VALARM"] = array("TYPE" => "VALARM", "ACTION" => "DISPLAY", "TRIGGER" => array("PARAMETERS" => array("VALUE" => "DURATION"), "VALUE" => "-PT" . $ar[0] . $arPeriodMapTmp[$ar[1]]));
     }
     if (isset($event["PROPERTY_PERIOD_TYPE"]) && strlen($event["PROPERTY_PERIOD_TYPE"]) > 0 && $event["PROPERTY_PERIOD_TYPE"] != "NONE") {
         $val = "FREQ=" . $event["PROPERTY_PERIOD_TYPE"];
         if (isset($event["PROPERTY_PERIOD_COUNT"]) && strlen($event["PROPERTY_PERIOD_COUNT"]) > 0) {
             $val .= ";INTERVAL=" . $event["PROPERTY_PERIOD_COUNT"];
         }
         if ($event["PROPERTY_PERIOD_TYPE"] == "WEEKLY" && strlen($event["PROPERTY_PERIOD_ADDITIONAL"]) > 0) {
             static $arWeekDayMap = array(6 => "SU", 0 => "MO", 1 => "TU", 2 => "WE", 3 => "TH", 4 => "FR", 5 => "SA");
             $ar = explode(",", $event["PROPERTY_PERIOD_ADDITIONAL"]);
             $ar1 = array();
             foreach ($ar as $v) {
                 $ar1[] = $arWeekDayMap[$v];
             }
             $val .= ";BYDAY=" . implode(",", $ar1);
         }
         $val .= ";UNTIL=" . date("Ymd\\THis\\Z", MakeTimeStamp($event["ACTIVE_TO"]));
         if (date("H:i:s", MakeTimeStamp($event["ACTIVE_FROM"])) == "00:00:00" && date("H:i:s", MakeTimeStamp($event["ACTIVE_FROM"]) + $event["PROPERTY_EVENT_LENGTH"]) == "00:00:00") {
             $arICalEvent["DTSTART"] = date("Ymd", MakeTimeStamp($event["ACTIVE_FROM"]));
             $arICalEvent["DTEND"] = array("VALUE" => date("Ymd", MakeTimeStamp($event["ACTIVE_FROM"]) + $event["PROPERTY_EVENT_LENGTH"]), "PARAMETERS" => array("TZID" => CDav::GetTimezoneId($siteId)));
         } else {
             $arICalEvent["DTEND"] = array("VALUE" => date("Ymd\\THis", MakeTimeStamp($event["ACTIVE_FROM"]) + $event["PROPERTY_EVENT_LENGTH"]), "PARAMETERS" => array("TZID" => CDav::GetTimezoneId($siteId)));
         }
         $arICalEvent["RRULE"] = $val;
     } else {
         if (date("H:i:s", MakeTimeStamp($event["ACTIVE_FROM"])) == "00:00:00" && date("H:i:s", MakeTimeStamp($event["ACTIVE_TO"])) == "00:00:00") {
             $arICalEvent["DTSTART"] = date("Ymd", MakeTimeStamp($event["ACTIVE_FROM"]));
             $arICalEvent["DTEND"] = date("Ymd", MakeTimeStamp($event["ACTIVE_TO"]) + 24 * 60 * 60);
         }
     }
     $cal = new CDavICalendar($arICalEvent, $siteId);
     return $cal->Render();
 }