From 21d5eea7515ce95eb6487c5affdad7628c301a4e Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Thu, 26 Feb 2009 18:25:15 +0100 Subject: [PATCH] Don't wrap holiday driver. --- kronolith/lib/Driver/Holidays.php | 9 ++++++++- kronolith/lib/Kronolith.php | 26 ++------------------------ 2 files changed, 10 insertions(+), 25 deletions(-) diff --git a/kronolith/lib/Driver/Holidays.php b/kronolith/lib/Driver/Holidays.php index 4f7c81bab..32a0faee7 100644 --- a/kronolith/lib/Driver/Holidays.php +++ b/kronolith/lib/Driver/Holidays.php @@ -34,8 +34,15 @@ class Kronolith_Driver_Holidays extends Kronolith_Driver * * @return array An array of all holidays within the given datespan. */ - public function listEvents($startDate = null, $endDate = null, $hasAlarm = false) + public function listEvents($startDate = null, $endDate = null, + $hasAlarm = false) { + if (!class_exists('Date_Holidays')) { + Horde::logMessage('Support for Date_Holidays has been enabled but the package seems to be missing.', + __FILE__, __LINE__, PEAR_LOG_ERR); + return array(); + } + global $language; $events = array(); diff --git a/kronolith/lib/Kronolith.php b/kronolith/lib/Kronolith.php index 9a47008e5..9dd21e502 100644 --- a/kronolith/lib/Kronolith.php +++ b/kronolith/lib/Kronolith.php @@ -808,29 +808,6 @@ class Kronolith } /** - * Returns a list of events containing holidays occuring between - * $startDate and $endDate. The outcome depends - * on the user's selection of holiday drivers - * - * @param int|Horde_Date $startDate The start of the datespan to be - * checked. - * @param int|Horde_Date $endDate The end of the datespan. - * - * @return array The matching holidays as an array. - */ - public static function listHolidayEvents($startDate = null, $endDate = null) - { - if (!@include_once('Date/Holidays.php')) { - Horde::logMessage('Support for Date_Holidays has been enabled but the package seems to be missing.', - __FILE__, __LINE__, PEAR_LOG_ERR); - return array(); - } else { - $dhDriver = Kronolith_Driver::factory('Holidays'); - return $dhDriver->listEvents($startDate, $endDate); - } - } - - /** * Returns all the events that happen each day within a time period * * @param int|Horde_Date $startDate The start of the time range. @@ -1014,7 +991,8 @@ class Kronolith /* Holidays */ if (!empty($GLOBALS['conf']['holidays']['enable'])) { - $events = Kronolith::listHolidayEvents($startDate, $endDate); + $dhDriver = Kronolith_Driver::factory('Holidays'); + $events = $dhDriver->listEvents($startDate, $endDate); if (!is_a($events, 'PEAR_Error')) { $kronolith_driver->open(Kronolith::getDefaultCalendar(PERMS_SHOW)); foreach ($events as $event) { -- 2.11.0