Allow to return empty event objects from all drivers.
authorJan Schneider <jan@horde.org>
Thu, 28 May 2009 12:44:28 +0000 (14:44 +0200)
committerJan Schneider <jan@horde.org>
Thu, 28 May 2009 12:47:13 +0000 (14:47 +0200)
kronolith/lib/Driver/Holidays.php
kronolith/lib/Driver/Horde.php
kronolith/lib/Driver/Ical.php

index 3ad4df6..fc500a0 100644 (file)
@@ -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);
 
index c9e8c1b..b0d3a00 100644 (file)
@@ -108,6 +108,7 @@ class Kronolith_Driver_Horde extends Kronolith_Driver
 
     public function getEvent($eventId = null)
     {
+        return new Kronolith_Event_Horde($this);
     }
 
 }
index 2479a08..73707f8 100644 (file)
@@ -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;