Notification with calendar subscription

This feature could be done by adding an allarm on the icalendar file and then subscribe as explain in http://www.projectpier.org/node/1369.

I think that could be done by adding a code like this:
BEGIN:VEVENT (or VTODO)
...
...
...
BEGIN:VALARM
ACTION:DISPLAY
TRIGGER:-P1D
DESCRIPTION:bla bla bla
END:VALARM
END:VEVENT (or VTODO)

for every event(milestone) or to-do (task) generated in the ical file/link submitted by application/controllers/FeedController.class.php (I have select a 'one day before' allarm, but it can be different or may be choose in some other way Full spec: http://www.kanzaki.com/docs/ical/valarm.html)

In library/icalendar there are all the specification and the classes of ical generated file. What is missing is the render function and the validation of the component VALARM as a sub-component of VEVENT or VTODO.

I think that component could be a part of the generation of VEVENT or VTODO, but what I can't find is where 'BEGIN' and 'END' of this componet could place. Another problem for me is the validation, because it could be done with a new class definition of VALARM component or added as valid property in the existing class of VEVENT/VTODO.

The VALARM support email notifications too...

I put here a not ideal solution but is working.

In the file FeedController.class.php:

...
$event->setPropertyValue('URL', externalUrl($milestone->getViewUrl()));
// -------------
// ---- MOD ----
// -------------
$event->setPropertyValue('BEGIN', 'VALARM');
$event->setPropertyValue('ACTION', 'DISPLAY');
$event->setPropertyValue('TRIGGER', '-P1D');
$event->setPropertyValue('DESCRIPTION', 'Description');
$event->setPropertyValue('END', 'VALARM');
// -----------
// - END MOD -
// -----------
/* pre_var_dump($desc); */
$calendar->addComponent($event);
...

the same mod could done in the todo section, before the $calendar->addComponent($todo); statement.

Adding comment character it is also necessary:

//$event->setPropertyValue('DESCRIPTION', $desc = $milestone->getDescription());

to avoid duplicate definition of DERSCRIPTION (the same thing for todo component)

in the files /library/icalendar/components/iCalendar_Event.class.php and /library/icalendar/components/iCalendar_Todo.class.php I have add the list of Valid Properties for the component VALARM, so these lines:

'ACTION',
'ATTACH',
'ATTENDEE',
'DESCRIPTION',
'DURATION',
'REPEAT',
'SUMMARY',
'TRIGGER',
'BEGIN',
'END',

before the last value 'X-PROP', and the system goes ...

A better programming approach it could be done by defining a new alarm component, in the same way event and todo are defined, adding a file iCalendar_Alarm.class.php whit this list of valid values, but then a different rendering of calendar class have to be done (No, I not yet be able to do it ...)
Have fun!

From iCalcreator manual:

Create a new VALARM object.

valarm()

Example

$config = array( 'unique_id' => 'domain.org' );
$vcalendar = new vcalendar( $config );
...
$vevent = new vevent();
...
$valarm = new valarm();
...
$vevent->setComponent( $valarm );
// required, inserts subcomponent object within component object $vcalendar->setComponent( $vevent );
// required, inserts component object within calendar object
...

The example code structure is the same used in PP iCal engine.
The problem was in the iCalendar_Event.class.php and iCalendar_Todo.class.php where was missing a setValidComponents() line which define the 'VALARM' value as valid. Obviusly I had to define a new iCalendar_Alarm.class.php.
Finally I had to update the FeedController.class.php code to create the new sub-component valarm inside the vtodo or the vevent component and the weels of the PP iCal engine seems to turn smoothly.

Patch attached in http://www.projectpier.org/node/2242

A big thumbs up for you mato!