1
0
mirror of https://github.com/owncloudarchive/contacts.git synced 2024-12-01 13:24:10 +01:00

fix birthday calendar

This commit is contained in:
Georg Ehrke 2012-06-29 15:40:46 +02:00
parent 84396ddce7
commit 02b935f4a9

View File

@ -90,9 +90,10 @@ class OC_Contacts_Hooks{
if ($birthday) { if ($birthday) {
$date = new DateTime($birthday); $date = new DateTime($birthday);
$vevent = new OC_VObject('VEVENT'); $vevent = new OC_VObject('VEVENT');
$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV)); //$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
$vevent->setDateTime('DTSTART', $date, Sabre_VObject_Element_DateTime::DATE); $vevent->setDateTime('DTSTART', $date, Sabre_VObject_Element_DateTime::DATE);
$vevent->setString('DURATION', 'P1D'); $vevent->setString('DURATION', 'P1D');
$vevent->setString('UID', substr(md5(rand().time()),0,10));
// DESCRIPTION? // DESCRIPTION?
$vevent->setString('RRULE', 'FREQ=YEARLY'); $vevent->setString('RRULE', 'FREQ=YEARLY');
$title = str_replace('{name}', $vcard->getAsString('FN'), OC_Contacts_App::$l10n->t('{name}\'s Birthday')); $title = str_replace('{name}', $vcard->getAsString('FN'), OC_Contacts_App::$l10n->t('{name}\'s Birthday'));
@ -101,6 +102,7 @@ class OC_Contacts_Hooks{
'vevent' => $vevent, 'vevent' => $vevent,
'repeating' => true, 'repeating' => true,
'summary' => $title, 'summary' => $title,
'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Contacts " . OCP\App::getAppVersion('contacts') . "\n" . $vevent->serialize() . "END:VCALENDAR"
); );
} }
} }