From 559f05c5b0c17e209c0d1b4b6c682b151dbf5b1d Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Sat, 7 Nov 2009 19:41:50 +0100 Subject: [PATCH] Implement getEvent(). --- kronolith/lib/Driver/Horde.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kronolith/lib/Driver/Horde.php b/kronolith/lib/Driver/Horde.php index 9770b0207..198f0209e 100644 --- a/kronolith/lib/Driver/Horde.php +++ b/kronolith/lib/Driver/Horde.php @@ -59,8 +59,6 @@ class Kronolith_Driver_Horde extends Kronolith_Driver return array(); } - $eventsList = $this->_params['registry']->call($this->api . '/listTimeObjects', array(array($category), $startDate, $endDate)); - if (is_null($startDate)) { $startDate = new Horde_Date(array('mday' => 1, 'month' => 1, @@ -72,6 +70,8 @@ class Kronolith_Driver_Horde extends Kronolith_Driver 'year' => 9999)); } + $eventsList = $this->_params['registry']->call($this->api . '/listTimeObjects', array(array($category), $startDate, $endDate)); + $startDate = clone $startDate; $startDate->hour = $startDate->min = $startDate->sec = 0; $endDate = clone $endDate; @@ -104,9 +104,18 @@ class Kronolith_Driver_Horde extends Kronolith_Driver return $results; } + /** + * @todo: implement getTimeObject in timeobjects API. + */ public function getEvent($eventId = null) { - return new Kronolith_Event_Horde($this); + $events = $this->listEvents(); + foreach ($events as $day) { + if (isset($day[$eventId])) { + return $day[$eventId]; + } + } + return PEAR::raiseError(_("Event not found")); } } -- 2.11.0