And with this, imporing and exporting of recurring events should sort of work

again. I've also implimented more of rfc2445.

I will continue to beat these classes into shape as I add more ical stuff
and document what I have reverse engineered.

Once I am satisfied that this is stable and production worthy I will probably
backport this to the 1.0 branch. My casual testing has shown that this for
the most part works as expected. I also plan on developing test harnesses
for ical import/export.
This commit is contained in:
mgalgoci 2004-10-15 17:40:22 +00:00
parent d9553d5969
commit 04e778c065
5 changed files with 104 additions and 7 deletions

View File

@ -294,6 +294,9 @@
}
$this->rpt_type = Array(
MCAL_RECUR_NONE => 'None',
MCAL_RECUR_SECONDLY => 'Secondly',
MCAL_RECUR_MINUTELY => 'Minutely',
MCAL_RECUR_HOURLY => 'Hourly',
MCAL_RECUR_DAILY => 'Daily',
MCAL_RECUR_WEEKLY => 'Weekly',
MCAL_RECUR_MONTHLY_WDAY => 'Monthly (by day)',
@ -873,6 +876,15 @@
case MCAL_RECUR_NONE:
$this->so->set_recur_none();
break;
case MCAL_RECUR_SECONDLY:
$this->so->set_recur_secondly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
case MCAL_RECUR_MINUTELY:
$this->so->set_recur_minutely((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
case MCAL_RECUR_HOURLY:
$this->so->set_recur_hourly((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
case MCAL_RECUR_DAILY:
$this->so->set_recur_daily((int)$l_recur_enddate['year'],(int)$l_recur_enddate['month'],(int)$l_recur_enddate['mday'],(int)$l_cal['recur_interval']);
break;
@ -1913,7 +1925,7 @@
$freq = $rep_events['recur_interval'];
$type = $rep_events['recur_type'];
switch($type)
{
{ // FIXME: need to add secondly, minutely, and hourly
case MCAL_RECUR_DAILY:
if($this->debug)
{

View File

@ -2572,7 +2572,7 @@
list($_f_['day_raw'], $_f_['time_raw']) = split('T', substr($value, 1, strlen($value)-1));
/* Datecode */
if(isset($_f_['day_raw']) OR $_f_['day_raw'])
if(isset($_f_['day_raw']) || $_f_['day_raw'])
{
/* Days */
if(strstr($_f_['day_raw'],'D'))
@ -2588,7 +2588,7 @@
}
/* Timecode */
if(isset($_f_['time_raw']) OR $_f_['time_raw'])
if(isset($_f_['time_raw']) || $_f_['time_raw'])
{
/* Hours */
if(strstr($_f_['time_raw'],'H'))
@ -3249,23 +3249,42 @@
{
$interval = (int)$ical['event'][$i]['rrule']['interval'];
}
// recur_type
/* recur_type */
switch($ical['event'][$i]['rrule']['freq'])
{
case SECONDLY:
$so_event->set_recur_secondly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
break;
case MINUTELY:
$so_event->set_recur_minutely($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
break;
case HOURLY:
$so_event->set_recur_hourly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
break;
case DAILY:
$recur_type = MCAL_RECUR_DAILY;
$so_event->set_recur_daily($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
break;
case WEEKLY:
$so_event->set_recur_weekly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval,$recur_data);
break;
case MONTHLY:
// Still need to determine if this is by day or by week for the month..
// $recur_type = MCAL_RECUR_M??????;
$so_event->set_recur_monthly_mday($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
break;
case YEARLY:
$so_event->set_recur_yearly($recur_enddate['year'],$recur_enddate['month'],$recur_enddate['mday'],$interval);
break;
}
if(isset($ical['event'][$i]['rrule']['until']))
{
$so_event->add_attribute('recur_enddate',$ical['event'][$i]['rrule']['until']['year'],'year');
$so_event->add_attribute('recur_enddate',$ical['event'][$i]['rrule']['until']['month'],'month');
$so_event->add_attribute('recur_enddate',$ical['event'][$i]['rrule']['until']['mday'],'mday');
$so_event->add_attribute('recur_enddate',$ical['event'][$i]['rrule']['until']['hour'],'hour');
$so_event->add_attribute('recur_enddate',$ical['event'][$i]['rrule']['until']['minute'],'min');
$so_event->add_attribute('recur_enddate',$ical['event'][$i]['rrule']['until']['second'],'sec');
}
}
else
{
@ -3449,6 +3468,15 @@
$str = '';
switch($event['recur_type'])
{
case MCAL_RECUR_SECONDLY:
$str .= 'FREQ=SECONDLY';
break;
case MCAL_RECUR_MINUTELY:
$str .= 'FREQ=MINUTELY';
break;
case MCAL_RECUR_HOURLY:
$str .= 'FREQ=HOURLY';
break;
case MCAL_RECUR_DAILY:
$str .= 'FREQ=DAILY';
break;

View File

@ -277,6 +277,27 @@
return mcal_event_set_recur_none($this->stream);
}
function set_recur_secondly($year,$month,$day,$interval)
{
calendar__::set_recur_secondly($year,$month,$day,$interval);
//return mcal_event_set_recur_secondly($this->stream,$year,$month,$day,$interval);
return 0; // stub - mcal_event_set_recur_secondly() does not exist
}
function set_recur_minutely($year,$month,$day,$interval)
{
calendar__::set_recur_minutely($year,$month,$day,$interval);
//return mcal_event_set_recur_minutely($this->stream,$year,$month,$day,$interval);
return 0; // stub - mcal_event_set_recur_minutely() does not exist
}
function set_recur_hourly($year,$month,$day,$interval)
{
calendar__::set_recur_hourly($year,$month,$day,$interval);
//return mcal_event_set_recur_hourly($this->stream,$year,$month,$day,$interval);
return 0; // stub - mcal_event_set_recur_hourly() does not exist
}
function set_recur_daily($year,$month,$day,$interval)
{
calendar__::set_recur_daily($year,$month,$day,$interval);

View File

@ -417,6 +417,21 @@
$this->cal->set_recur_none();
}
function set_recur_secondly($year,$month,$day,$interval)
{
$this->cal->set_recur_secondly($year,$month,$day,$interval);
}
function set_recur_minutely($year,$month,$day,$interval)
{
$this->cal->set_recur_minutely($year,$month,$day,$interval);
}
function set_recur_hourly($year,$month,$day,$interval)
{
$this->cal->set_recur_hourly($year,$month,$day,$interval);
}
function set_recur_daily($year,$month,$day,$interval)
{
$this->cal->set_recur_daily($year,$month,$day,$interval);

View File

@ -32,6 +32,9 @@
define('MCAL_RECUR_MONTHLY_MDAY',3);
define('MCAL_RECUR_MONTHLY_WDAY',4);
define('MCAL_RECUR_YEARLY',5);
define('MCAL_RECUR_SECONDLY',6);
define('MCAL_RECUR_MINUTELY',7);
define('MCAL_RECUR_HOURLY',8);
define('MCAL_M_SUNDAY',1);
define('MCAL_M_MONDAY',2);
@ -147,6 +150,24 @@
$this->add_attribute('recur_type',MCAL_RECUR_NONE);
}
function set_recur_secondly($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_SECONDLY);
}
function set_recur_minutely($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_MINUTELY);
}
function set_recur_hourly($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);
$this->add_attribute('recur_type',MCAL_RECUR_HOURLY);
}
function set_recur_daily($year,$month,$day,$interval)
{
$this->set_common_recur((int)$year,(int)$month,(int)$day,$interval);