Don't wrap holiday driver.
authorJan Schneider <jan@horde.org>
Thu, 26 Feb 2009 17:25:15 +0000 (18:25 +0100)
committerJan Schneider <jan@horde.org>
Thu, 26 Feb 2009 17:25:15 +0000 (18:25 +0100)
kronolith/lib/Driver/Holidays.php
kronolith/lib/Kronolith.php

index 4f7c81b..32a0fae 100644 (file)
@@ -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();
index 9a47008..9dd21e5 100644 (file)
@@ -808,29 +808,6 @@ class Kronolith
     }
 
     /**
-     * Returns a list of events containing holidays occuring between
-     * <code>$startDate</code> and <code>$endDate</code>. 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) {