From 21c12bfb323d5b078eb70c20be8ea18be081a936 Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 25 Nov 2008 15:52:44 +0000 Subject: Added post-to-google-calendar through Zend (when installed) --- forum/utils/calendar.php | 6 ++++- forum/utils/googlecalendar.php | 60 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 forum/utils/googlecalendar.php (limited to 'forum') diff --git a/forum/utils/calendar.php b/forum/utils/calendar.php index 84ebe18..1cf8d4a 100644 --- a/forum/utils/calendar.php +++ b/forum/utils/calendar.php @@ -1,6 +1,7 @@ uid); $events->add($event); - $events->write(); + $events->write(); + + if($ZEND_DIR != "") googleCalendarEvent($event); + notify("calendar", "New calendar entry:\n" . $title . "\n" . date("r", $time) . "\n" . $description . "\n" . $FORUM_URL . "/?mode=calendar&date=" . $time); diff --git a/forum/utils/googlecalendar.php b/forum/utils/googlecalendar.php new file mode 100644 index 0000000..e6305f8 --- /dev/null +++ b/forum/utils/googlecalendar.php @@ -0,0 +1,60 @@ +title . "\n" . $event->description)); + $start = date(DATE_ATOM, $event->starttime); + $end = date(DATE_ATOM, $event->starttime + $event->duration); + + // construct event object + // save to server + + try { + $gevent = $gcal->newEventEntry(); + $gevent->title = $gcal->newTitle($title); + $when = $gcal->newWhen(); + $when->startTime = $start; + $when->endTime = $end; + $gevent->when = array($when); + $gcal->insertEvent($gevent); + } catch (Zend_Gdata_App_Exception $e) { + echo "Error: " . $e->getResponse(); + } + + // echo 'Event successfully added!'; +} +?> -- cgit v1.2.3