From a1245b4f9f0e3c4037cc17c03b9da0561c9f79fe Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 28 May 2009 14:44:28 +0200 Subject: [PATCH] Allow to return empty event objects from all drivers. --- kronolith/lib/Driver/Holidays.php | 5 +++++ kronolith/lib/Driver/Horde.php | 1 + kronolith/lib/Driver/Ical.php | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/kronolith/lib/Driver/Holidays.php b/kronolith/lib/Driver/Holidays.php index 3ad4df66e..fc500a08b 100644 --- a/kronolith/lib/Driver/Holidays.php +++ b/kronolith/lib/Driver/Holidays.php @@ -89,6 +89,11 @@ class Kronolith_Driver_Holidays extends Kronolith_Driver public function getEvent($eventId = null) { + if (!$eventId) { + $date = new Date(); + return new Kronolith_Event_Holidays($this, new Date_Holidays_Holiday(null, null, $date, null)); + } + list($id, $date) = explode('-', $eventId, 2); $year = substr($date, 0, 4); diff --git a/kronolith/lib/Driver/Horde.php b/kronolith/lib/Driver/Horde.php index c9e8c1b95..b0d3a00b4 100644 --- a/kronolith/lib/Driver/Horde.php +++ b/kronolith/lib/Driver/Horde.php @@ -108,6 +108,7 @@ class Kronolith_Driver_Horde extends Kronolith_Driver public function getEvent($eventId = null) { + return new Kronolith_Event_Horde($this); } } diff --git a/kronolith/lib/Driver/Ical.php b/kronolith/lib/Driver/Ical.php index 2479a08d3..73707f881 100644 --- a/kronolith/lib/Driver/Ical.php +++ b/kronolith/lib/Driver/Ical.php @@ -136,6 +136,10 @@ class Kronolith_Driver_Ical extends Kronolith_Driver public function getEvent($eventId = null) { + if (!$eventId) { + return new Kronolith_Event_Ical($this); + } + $iCal = $this->_getRemoteCalendar(); if (is_a($iCal, 'PEAR_Error')) { return $iCal; -- 2.11.0