Date_Holidays
[ class tree: Date_Holidays ] [ index: Date_Holidays ] [ all elements ]

Source for file Denmark.php

Documentation is available at Denmark.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. // +----------------------------------------------------------------------+
  4. // | PHP Version 4                                                        |
  5. // +----------------------------------------------------------------------+
  6. // | Copyright (c) 1997-2002 The PHP Group                                |
  7. // +----------------------------------------------------------------------+
  8. // | This source file is subject to version 2.0 of the PHP license,       |
  9. // | that is bundled with this package in the file LICENSE, and is        |
  10. // | available at through the world-wide-web at                           |
  11. // | http://www.php.net/license/2_02.txt.                                 |
  12. // | If you did not receive a copy of the PHP license and are unable to   |
  13. // | obtain it through the world-wide-web, please send a note to          |
  14. // | license@php.net so we can mail you a copy immediately.               |
  15. // +----------------------------------------------------------------------+
  16. // | Authors:   Henrik Hansen <hh@fsck.dk>                                |
  17. // +----------------------------------------------------------------------+
  18. //
  19. // $Id: Denmark.php,v 1.1 2006/12/16 09:34:20 schst Exp $
  20.  
  21. require_once 'Date/Holidays/Driver/Christian.php';
  22.  
  23. /**
  24.  * Driver class that calculates Danish holidays
  25.  *
  26.  * @category    Date
  27.  * @package     Date_Holidays
  28.  * @subpackage  Driver
  29.  * @version     $Id: Denmark.php,v 1.1 2006/12/16 09:34:20 schst Exp $
  30.  * @author      Henrik Hansen <hh@fsck.dk>
  31.  */
  32. {
  33.    /**
  34.     * Constructor
  35.     *
  36.     * Use the Date_Holidays::factory() method to construct an object of a certain driver
  37.     *
  38.     * @access   protected
  39.     */
  40.     function Date_Holidays_Driver_Denmark({}
  41.  
  42.    /**
  43.     * Build the internal arrays that contain data about the calculated holidays
  44.     *
  45.     * @access   protected
  46.     * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  47.     * @throws   object PEAR_ErrorStack
  48.     */
  49.     function _buildHolidays()
  50.     {
  51.        /**
  52.         * New Year's Day
  53.         */
  54.         $this->_addHoliday('newYearsDay'$this->_year . '-01-01''New Year\'s Day');
  55.         $this->_addTranslationForHoliday('newYearsDay''da_DK');
  56.  
  57.        /**
  58.         * Epiphanias
  59.         */
  60.         $this->_addHoliday('epiphany'$this->_year . '-01-06''Epiphany');
  61.         $this->_addTranslationForHoliday('epiphany''da_DK''Hellig 3 Konger');
  62.  
  63.        /**
  64.         * Easter Sunday
  65.         */
  66.         $easterDate Date_Holidays_Driver_Christian::calcEaster($this->_year);
  67.         $this->_addHoliday('easter'$easterDate'Easter Sunday');
  68.         $this->_addTranslationForHoliday('easter''da_DK');
  69.  
  70.        /**
  71.         * Easter Monday
  72.         */
  73.         $this->_addHoliday('easterMonday'$easterDate->getNextDay()'Easter Monday');
  74.         $this->_addTranslationForHoliday('easterMonday''da_DK');
  75.  
  76.        /**
  77.         * Palm Sunday
  78.         */
  79.         $palmSundayDate = new Date($easterDate);
  80.         $palmSundayDate->subtractSpan(new Date_Span('7, 0, 0, 0'));
  81.         $this->_addHoliday('palmSunday'$palmSundayDate'Palm Sunday');
  82.         $this->_addTranslationForHoliday('palmSunday''da_DK');
  83.  
  84.        /**
  85.         * Good Friday / Black Friday
  86.         */
  87.         $goodFridayDate = new Date($easterDate);
  88.         $goodFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
  89.         $this->_addHoliday('goodFriday'$goodFridayDate'Good Friday');
  90.         $this->_addTranslationForHoliday('goodFriday''da_DK''Langfredag');
  91.  
  92.        /**
  93.         * Green Thursday
  94.         */
  95.         $this->_addHoliday('greenThursday'$goodFridayDate->getPrevDay()'Green Thursday');
  96.         $this->_addTranslationForHoliday('greenThursday''da_DK');
  97.  
  98.        /**
  99.         * Whitsun (determines Whit Monday, Ascension Day and Feast of Corpus Christi)
  100.         */
  101.         $whitsunDate = new Date($easterDate);
  102.         $whitsunDate->addSpan(new Date_Span('49, 0, 0, 0'));
  103.         $this->_addHoliday('whitsun'$whitsunDate'Whitsun');
  104.         $this->_addTranslationForHoliday('whitsun''da_DK''Pinsedag');
  105.  
  106.        /**
  107.         * Whit Monday
  108.         */
  109.         $this->_addHoliday('whitMonday'$whitsunDate->getNextDay()'Whit Monday');
  110.         $this->_addTranslationForHoliday('whitMonday''da_DK''2. Pinsedag');
  111.  
  112.        /**
  113.         * Ascension Day
  114.         */
  115.         $ascensionDayDate = new Date($whitsunDate);
  116.         $ascensionDayDate->subtractSpan(new Date_Span('10, 0, 0, 0'));
  117.         $this->_addHoliday('ascensionDay'$ascensionDayDate'Ascension Day');
  118.         $this->_addTranslationForHoliday('ascensionDay''da_DK''Kr. Himmelfart');
  119.  
  120.        /**
  121.         * Heart of Jesus (General Prayer Day)
  122.         *
  123.         * Friday of the 3rd week past Whitsun
  124.         */
  125.         $heartJesusDate = new Date($goodFridayDate);
  126.         $heartJesusDate->addSpan(new Date_Span('28, 0, 0, 0'));
  127.         $this->_addHoliday('heartJesus'$heartJesusDate'Heart of Jesus celebration');
  128.         $this->_addTranslationForHoliday('heartJesus''da_DK''Store Bededag');
  129.  
  130.        /**
  131.         * Christmas Eve
  132.         */
  133.         $this->_addHoliday('xmasEve'$this->_year . '-12-24''Christmas Eve');
  134.         $this->_addTranslationForHoliday('xmasEve''da_DK''Juleaften');
  135.  
  136.        /**
  137.         * Christmas day
  138.         */
  139.         $this->_addHoliday('xmasDay'$this->_year . '-12-25''Christmas Day');
  140.         $this->_addTranslationForHoliday('xmasDay''da_DK''1. Juledag');
  141.  
  142.        /**
  143.         * Second Christmas Day
  144.         */
  145.         $this->_addHoliday('secondXmasDay'$this->_year . '-12-26''Boxing Day');
  146.         $this->_addTranslationForHoliday('xmasDay''da_DK''2. Juledag');
  147.  
  148.        /**
  149.         * New Year's Eve
  150.         */
  151.         $this->_addHoliday('newYearsEve'$this->_year . '-12-31''New Year\'s Eve');
  152.         $this->_addTranslationForHoliday('newYearsEve''da_DK');
  153.  
  154.         if (Date_Holidays::errorsOccurred()) {
  155.             return Date_Holidays::getErrorStack();
  156.         }
  157.  
  158.         return true;
  159.     }
  160.  
  161.    /**
  162.     * Method that returns an array containing the ISO3166 codes that may possibly
  163.     * identify a driver.
  164.     * 
  165.     * @static
  166.     * @access public
  167.     * @return array possible ISO3166 codes
  168.     */
  169.     function getISO3166Codes({
  170.         return array('dk''dnk');
  171.     }
  172. }
  173. ?>

Documentation generated on Mon, 11 Mar 2019 15:03:06 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.