fixing the fix: DTSTART is in UTC time, Horde_iCalendar parses it in server timezone, which we need to set again for printing

This commit is contained in:
Ralf Becker 2011-10-09 17:48:12 +00:00
parent c2f74d0c72
commit 6385b94108

View File

@ -344,13 +344,13 @@ class calendar_timezones
// --> we have to parse it and let Horde_iCalendar add it again // --> we have to parse it and let Horde_iCalendar add it again
$horde_vtimezone = Horde_iCalendar::newComponent('VTIMEZONE',$container=false); $horde_vtimezone = Horde_iCalendar::newComponent('VTIMEZONE',$container=false);
$horde_vtimezone->parsevCalendar($vtimezone,'VTIMEZONE'); $horde_vtimezone->parsevCalendar($vtimezone,'VTIMEZONE');
// DTSTART must be in UTC time // DTSTART is in UTC time, Horde_iCalendar parses it in server timezone, which we need to set again for printing
$standard = $horde_vtimezone->findComponent('STANDARD'); $standard = $horde_vtimezone->findComponent('STANDARD');
if (is_a($standard, 'Horde_iCalendar')) if (is_a($standard, 'Horde_iCalendar'))
{ {
$dtstart = $standard->getAttribute('DTSTART'); $dtstart = $standard->getAttribute('DTSTART');
$dtstart = new egw_time($dtstart, egw_time::$server_timezone); $dtstart = new egw_time($dtstart, egw_time::$server_timezone);
$dtstart->setTimezone('UTC'); $dtstart->setTimezone(egw_time::$server_timezone);
$standard->setAttribute('DTSTART', $dtstart->format('Ymd\THis'), array(), false); $standard->setAttribute('DTSTART', $dtstart->format('Ymd\THis'), array(), false);
} }
$daylight = $horde_vtimezone->findComponent('DAYLIGHT'); $daylight = $horde_vtimezone->findComponent('DAYLIGHT');
@ -358,9 +358,10 @@ class calendar_timezones
{ {
$dtstart = $daylight->getAttribute('DTSTART'); $dtstart = $daylight->getAttribute('DTSTART');
$dtstart = new egw_time($dtstart, egw_time::$server_timezone); $dtstart = new egw_time($dtstart, egw_time::$server_timezone);
$dtstart->setTimezone('UTC'); $dtstart->setTimezone(egw_time::$server_timezone);
$daylight->setAttribute('DTSTART', $dtstart->format('Ymd\THis'), array(), false); $daylight->setAttribute('DTSTART', $dtstart->format('Ymd\THis'), array(), false);
} }
//error_log($vtimezone); error_log($horde_vtimezone->_exportvData('VTIMEZONE'));
$vcal->addComponent($horde_vtimezone); $vcal->addComponent($horde_vtimezone);
return true; return true;