Support for Synthesis VTIMEZONE RRULES

This commit is contained in:
Jörg Lehrke 2009-11-11 09:16:46 +00:00
parent 8e6f54f9de
commit bb7ad55ea4

View File

@ -35,6 +35,7 @@ class Horde_iCalendar_vtimezone extends Horde_iCalendar {
{
// Make sure 'time' key is first for sort().
$result['time'] = 0;
$rrule_interval = 0; // 0 undefined, 1 yearly, 12 monthly
$t = $child->getAttribute('TZOFFSETFROM');
if (is_a($t, 'PEAR_Error')) {
@ -76,15 +77,32 @@ class Horde_iCalendar_vtimezone extends Horde_iCalendar {
$t = explode('=', $rrule);
switch ($t[0]) {
case 'FREQ':
if ($t[1] != 'YEARLY') {
return false;
}
switch($t[1]) {
case 'YEARLY':
if ($rrule_interval == 12) {
return false;
}
$rrule_interval = 1;
break;
case 'MONTHLY':
if ($rrule_interval == 1) {
return false;
}
$rrule_interval = 12;
break;
default:
return false;
}
break;
case 'INTERVAL':
if ($t[1] != '1') {
if ($rrule_interval && $t[1] != $rrule_interval) {
return false;
}
$rrule_interval = intval($t[1]);
if ($rrule_interval != 1 && $rrule_interval != 12) {
return false;
}
break;
case 'COUNT':
@ -124,6 +142,10 @@ class Horde_iCalendar_vtimezone extends Horde_iCalendar {
}
}
if ($rrule_interval == 12) {
$month = date("n", $switch_time);
}
if (empty($month) || !isset($weekday)) {
return false;
}