|
|
@ -61,8 +61,8 @@ class OC_Contacts_Hooks{ |
|
|
|
static public function getCalenderSources($parameters) { |
|
|
|
static public function getCalenderSources($parameters) { |
|
|
|
$base_url = OCP\Util::linkTo('calendar', 'ajax/events.php').'?calendar_id='; |
|
|
|
$base_url = OCP\Util::linkTo('calendar', 'ajax/events.php').'?calendar_id='; |
|
|
|
foreach(OC_Contacts_Addressbook::all(OCP\USER::getUser()) as $addressbook) { |
|
|
|
foreach(OC_Contacts_Addressbook::all(OCP\USER::getUser()) as $addressbook) { |
|
|
|
$parameters['sources'][] = |
|
|
|
$parameters['sources'][] |
|
|
|
array( |
|
|
|
= array( |
|
|
|
'url' => $base_url.'birthday_'. $addressbook['id'], |
|
|
|
'url' => $base_url.'birthday_'. $addressbook['id'], |
|
|
|
'backgroundColor' => '#cccccc', |
|
|
|
'backgroundColor' => '#cccccc', |
|
|
|
'borderColor' => '#888', |
|
|
|
'borderColor' => '#888', |
|
|
@ -91,18 +91,24 @@ class OC_Contacts_Hooks{ |
|
|
|
$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)); |
|
|
|
$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')); |
|
|
|
$parameters['events'][] = array( |
|
|
|
$parameters['events'][] = array( |
|
|
|
'id' => 0,//$card['id'], |
|
|
|
'id' => 0,//$card['id'], |
|
|
|
'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" |
|
|
|
'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\n" |
|
|
|
|
|
|
|
. "PRODID:ownCloud Contacts " |
|
|
|
|
|
|
|
. OCP\App::getAppVersion('contacts') . "\n" |
|
|
|
|
|
|
|
. $vevent->serialize() . "END:VCALENDAR" |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|