- ASCII table
- HTML
- Email (text + HTML parts)
+- iCalendar
=====
Make sure your config file contains ``$mail_from`` and ``$mail_to`` settings.
+iCalendar
+=========
+Exporting birthday events into an ics file is easy::
+
+ $ bdrem --renderer=ical > birthdays.ics
+
+It is possible to access the calendar via HTTP, too::
+
+ http://example.org/bdrem/?renderer=ical
+
+
HTML page
=========
Simply point your web browser to the ``.phar`` file, or ``index.php``.
/**
* Render the events in an iCalendar file
*
+ * X-WR-CALNAME is supported by claws mail's vcalendar plugin; it
+ * uses it as title.
+ *
* @param array $arEvents Event objects to render
*
* @return string iCal file
{
$s = "BEGIN:VCALENDAR\n"
. "VERSION:2.0\n"
- . "PRODID:-//bdrem\n";
+ . "PRODID:-//bdrem\n"
+ . "X-WR-CALNAME:birthdays\n";
foreach ($arEvents as $event) {
$props = array('BEGIN' => 'VEVENT');
$props['UID'] = str_replace(
- array('-', '????'), array('', '0000'), $event->date
+ array('-', '????'), array('', '0000'), $event->localDate
)
. '.' . $event->age
. '.' . md5($event->title . '/' . $event->type)
. '@bdrem';
- $props['DTSTART'] = str_replace('-', '', $event->date);
+ // we want the zero time because it expresses midnight in every
+ // time zone
+ $props['DTSTART'] = str_replace('-', '', $event->localDate) . 'T000000';
$props['DURATION'] = 'P1D';
$props['SUMMARY'] = sprintf(
'%s - %s. %s', $event->title, $event->age, $event->type