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

Documentation generated on Thu, 10 Apr 2008 20:00:13 -0400 by phpDocumentor 1.4.0. PEAR Logo Copyright © PHP Group 2004.