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

Source for file Austria.php

Documentation is available at Austria.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /**
  4.  * Driver for holidays in Austria
  5.  *
  6.  * PHP Version 5
  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   Stephan Schmidt <schst@php-tools.net>
  21.  * @author   Carsten Lucke <luckec@tool-garage.de>
  22.  * @license  http://www.php.net/license/3_01.txt PHP License 3.0.1
  23.  * @version  CVS: $Id$
  24.  * @link     http://pear.php.net/package/Date_Holidays
  25.  */
  26.  
  27. /**
  28.  * Requires Christian driver
  29.  */
  30. require_once 'Date/Holidays/Driver/Christian.php';
  31.  
  32. /**
  33.  * class that calculates Austrian holidays
  34.  *
  35.  * @category   Date
  36.  * @package    Date_Holidays
  37.  * @subpackage Driver
  38.  * @author     Klemens Ullmann <klemens@ull.at>
  39.  * @license    http://www.php.net/license/3_01.txt PHP License 3.0.1
  40.  * @version    CVS: $Id$
  41.  * @link       http://pear.php.net/package/Date_Holidays
  42.  */
  43. class Date_Holidays_Driver_Austria extends Date_Holidays_Driver
  44. {
  45.     /**
  46.      * this driver's name
  47.      *
  48.      * @access   protected
  49.      * @var      string 
  50.      */
  51.     var $_driverName = 'Austria';
  52.  
  53.     /**
  54.      * Constructor
  55.      *
  56.      * Use the Date_Holidays::factory() method to construct an object of a certain
  57.      * driver
  58.      *
  59.      * @access   protected
  60.      */
  61.     function Date_Holidays_Driver_Austria()
  62.     {
  63.     }
  64.  
  65.     /**
  66.      * Build the internal arrays that contain data about the calculated holidays
  67.      *
  68.      * @access   protected
  69.      * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  70.      * @throws   object PEAR_ErrorStack
  71.      */
  72.     function _buildHolidays()
  73.     {
  74.         /**
  75.          * New Year's Day
  76.          */
  77.         $this->_addHoliday('newYearsDay'$this->_year '-01-01''Neujahr');
  78.         $this->_addTranslationForHoliday('newYearsDay''en_EN''New Year\'s Day');
  79.  
  80.         /**
  81.          * Epiphanias
  82.          */
  83.         $this->_addHoliday(
  84.             'epiphany',
  85.             $this->_year '-01-06',
  86.             'Heilige Drei Könige'
  87.         );
  88.         $this->_addTranslationForHoliday('epiphany''en_EN''Epiphany');
  89.  
  90.         /**
  91.          * Valentine´s Day
  92.          */
  93.         $this->_addHoliday(
  94.             'valentinesDay',
  95.             $this->_year '-02-14',
  96.             'Valentinstag'
  97.         );
  98.         $this->_addTranslationForHoliday('valentinesDay''en_EN''Valentines Day');
  99.  
  100.         /**
  101.          * Easter Sunday
  102.          */
  103.         $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
  104.         $this->_addHoliday('easter'$easterDate'Ostersonntag');
  105.         $this->_addTranslationForHoliday('easter''en_EN''Easter');
  106.  
  107.         /**
  108.          * Ash Wednesday
  109.          */
  110.         $ashWednesday $this->_addDays($easterDate-46);
  111.         $this->_addHoliday('ashWednesday'$ashWednesday'Aschermittwoch');
  112.         $this->_addTranslationForHoliday('ashWednesday''en_EN''Ash Wednesday');
  113.  
  114.         /**
  115.          * Palm Sunday
  116.          */
  117.         $palmSunday $this->_addDays($easterDate-7);
  118.         $this->_addHoliday('palmSunday'$palmSunday'Palmsonntag');
  119.         $this->_addTranslationForHoliday('palmSunday''en_EN''Palm Sunday');
  120.  
  121.         /**
  122.          * Maundy Thursday
  123.          */
  124.         $maundyThursday $this->_addDays($easterDate-3);
  125.         $this->_addHoliday('maundyThursday'$maundyThursday'Gründonnerstag');
  126.         $this->_addTranslationForHoliday(
  127.             'maundyThursday',
  128.             'en_EN',
  129.             'Maundy Thursday'
  130.         );
  131.  
  132.         /**
  133.          * Good Friday
  134.          */
  135.         $goodFriday $this->_addDays($easterDate-2);
  136.         $this->_addHoliday('goodFriday'$goodFriday'Karfreitag');
  137.         $this->_addTranslationForHoliday('goodFriday''en_EN''Good Friday');
  138.  
  139.         /**
  140.          * Easter Monday
  141.          */
  142.         $this->_addHoliday('easterMonday'$easterDate->getNextDay()'Ostermontag');
  143.         $this->_addTranslationForHoliday('easterMonday''en_EN''Easter Monday');
  144.  
  145.         /**
  146.          * Day of Work
  147.          */
  148.         $this->_addHoliday(
  149.             'dayOfWork'$this->_year '-05-01',
  150.             'Staatsfeiertag Österreich'
  151.         );
  152.         $this->_addTranslationForHoliday('dayOfWork''en_EN''Day of Work');
  153.  
  154.         /**
  155.          * Saint Florian
  156.          */
  157.         $this->_addHoliday('saintFlorian'$this->_year '-05-04''St. Florian');
  158.         $this->_addTranslationForHoliday('saintFlorian''en_EN''St. Florian');
  159.  
  160.         /**
  161.          * Mothers Day
  162.          */
  163.         $mothersDay $this->_calcFirstMonday("05");
  164.         $mothersDay $mothersDay->getPrevDay();
  165.         $mothersDay $this->_addDays($mothersDay7);
  166.         $this->_addHoliday('mothersDay'$mothersDay'Muttertag');
  167.         $this->_addTranslationForHoliday('mothersDay''en_EN''Mothers Day');
  168.  
  169.         /**
  170.          * Ascension Day
  171.          */
  172.         $ascensionDate $this->_addDays($easterDate39);
  173.         $this->_addHoliday('ascensionDate'$ascensionDate'Christi Himmelfahrt');
  174.         $this->_addTranslationForHoliday('ascensionDate''en_EN''Ascension Day');
  175.  
  176.         /**
  177.          * Whitsun (determines Whit Monday, Ascension Day and
  178.          * Feast of Corpus Christi)
  179.          */
  180.         $whitsunDate $this->_addDays($easterDate49);
  181.         $this->_addHoliday('whitsun'$whitsunDate'Pfingstsonntag');
  182.         $this->_addTranslationForHoliday('whitsun''en_EN''Whitsun');
  183.  
  184.         /**
  185.          * Whit Monday
  186.          */
  187.         $this->_addHoliday(
  188.             'whitMonday',
  189.             $whitsunDate->getNextDay(),
  190.             'Pfingstmontag'
  191.         );
  192.         $this->_addTranslationForHoliday('whitMonday''en_EN''Whit Monday');
  193.  
  194.         /**
  195.          * Corpus Christi
  196.          */
  197.         $corpusChristi $this->_addDays($easterDate60);
  198.         $this->_addHoliday('corpusChristi'$corpusChristi'Fronleichnam');
  199.         $this->_addTranslationForHoliday('corpusChristi''en_EN''Corpus Christi');
  200.  
  201.         /**
  202.          * Fathers Day
  203.          */
  204.         $fathersDay $this->_calcFirstMonday("06");
  205.         $fathersDay $fathersDay->getPrevDay();
  206.         $fathersDay $this->_addDays($fathersDay7);
  207.         $this->_addHoliday(
  208.             'fathersDay',
  209.             $fathersDay,
  210.             'Vatertag'
  211.         );
  212.         $this->_addTranslationForHoliday('fathersDay''en_EN''Fathers Day');
  213.  
  214.         /**
  215.          * Ascension of Maria
  216.          */
  217.         $this->_addHoliday(
  218.             'mariaAscension',
  219.             $this->_year '-08-15',
  220.             'Maria Himmelfahrt'
  221.         );
  222.         $this->_addTranslationForHoliday(
  223.             'mariaAscension',
  224.             'en_EN',
  225.             'Ascension of Maria'
  226.         );
  227.  
  228.         /**
  229.          * Österreichischer Nationalfeiertag
  230.          */
  231.         $this->_addHoliday(
  232.             'nationalDayAustria',
  233.             $this->_year '-10-26',
  234.             'Österreichischer Nationalfeiertag'
  235.         );
  236.         $this->_addTranslationForHoliday(
  237.             'nationalDayAustria',
  238.             'en_EN',
  239.             'Österreichischer Nationalfeiertag'
  240.         );
  241.  
  242.         /**
  243.          * All Saints' Day
  244.          */
  245.         $this->_addHoliday(
  246.             'allSaintsDay',
  247.             $this->_year '-11-01',
  248.             'Allerheiligen'
  249.         );
  250.         $this->_addTranslationForHoliday('allSaintsDay''en_EN''All Saints Day');
  251.  
  252.         /**
  253.          *All Souls´ Day
  254.          */
  255.         $this->_addHoliday(
  256.             'allSoulsDay',
  257.             $this->_year '-11-02',
  258.             'Allerseelen'
  259.         );
  260.         $this->_addTranslationForHoliday('allSoulsDay''en_EN''All Souls Day');
  261.  
  262.         /**
  263.          * Santa Claus
  264.          */
  265.         $this->_addHoliday(
  266.             'santasDay',
  267.             $this->_year '-12-06',
  268.             'St. Nikolaus'
  269.         );
  270.         $this->_addTranslationForHoliday('santasDay''en_EN''St. Nikolaus');
  271.  
  272.         /**
  273.          * Immaculate Conception
  274.          */
  275.         $this->_addHoliday(
  276.             'immaculateConceptionDay',
  277.             $this->_year '-12-08',
  278.             'Maria Empfängnis'
  279.         );
  280.         $this->_addTranslationForHoliday(
  281.             'immaculateConceptionDay',
  282.             'en_EN',
  283.             'Immaculate Conception Day'
  284.         );
  285.  
  286.         /**
  287.          * Sunday in commemoration of the dead (sundayIcotd)
  288.          */
  289.         $sundayIcotd $this->_calcFirstMonday(12);
  290.         $sundayIcotd $this->_addDays($this->_calcFirstMonday(12)-8);
  291.         $this->_addHoliday(
  292.             'sundayIcotd',
  293.             $sundayIcotd,
  294.             'Totensonntag'
  295.         );
  296.         $this->_addTranslationForHoliday(
  297.             'sundayIcotd',
  298.             'en_EN',
  299.             'Sunday in commemoration of the dead'
  300.         );
  301.  
  302.         /**
  303.          * 1. Advent
  304.          */
  305.         $firstAdv = new Date($this->_year '-12-03');
  306.         $dayOfWeek $firstAdv->getDayOfWeek();
  307.         $firstAdv $this->_addDays($firstAdv$dayOfWeek);
  308.         $this->_addHoliday(
  309.             'firstAdvent',
  310.             $firstAdv,
  311.             '1. Advent'
  312.         );
  313.         $this->_addTranslationForHoliday('firstAdvent''en_EN''1. Advent');
  314.  
  315.         /**
  316.          * 2. Advent
  317.          */
  318.         $secondAdv $this->_addDays($firstAdv7);
  319.         $this->_addHoliday(
  320.             'secondAdvent',
  321.             $secondAdv,
  322.             '2. Advent'
  323.         );
  324.         $this->_addTranslationForHoliday('secondAdvent''en_EN''2. Advent');
  325.  
  326.         /**
  327.          * 3. Advent
  328.          */
  329.         $thirdAdv $this->_addDays($firstAdv14);
  330.         $this->_addHoliday(
  331.             'thirdAdvent',
  332.             $thirdAdv,
  333.             '3. Advent'
  334.         );
  335.         $this->_addTranslationForHoliday('thirdAdvent''en_EN''3. Advent');
  336.  
  337.         /**
  338.          * 4. Advent
  339.          */
  340.         $fourthAdv $this->_addDays($firstAdv21);
  341.         $this->_addHoliday(
  342.             'fourthAdvent',
  343.             $fourthAdv,
  344.             '4. Advent'
  345.         );
  346.         $this->_addTranslationForHoliday('fourthAdvent''en_EN''4. Advent');
  347.  
  348.         /**
  349.          * Christmas Eve
  350.          */
  351.         $this->_addHoliday(
  352.             'christmasEve',
  353.             $this->_year '-12-24',
  354.             'Heiliger Abend'
  355.         );
  356.         $this->_addTranslationForHoliday('christmasEve''en_EN''Christmas Eve');
  357.  
  358.         /**
  359.          * Christmas day
  360.          */
  361.         $this->_addHoliday(
  362.             'christmasDay',
  363.             $this->_year '-12-25',
  364.             'Christtag'
  365.         );
  366.         $this->_addTranslationForHoliday('christmasDay''en_EN''Christmas Day');
  367.  
  368.         /**
  369.          * Boxing day
  370.          */
  371.         $this->_addHoliday(
  372.             'boxingDay',
  373.             $this->_year '-12-26',
  374.             'Stefanitag'
  375.         );
  376.         $this->_addTranslationForHoliday('boxingDay''en_EN''Boxing Day');
  377.  
  378.         /**
  379.          * New Year´s Eve
  380.          */
  381.         $this->_addHoliday(
  382.             'newYearsEve',
  383.             $this->_year '-12-31',
  384.             'Silvester'
  385.         );
  386.         $this->_addTranslationForHoliday('newYearsEve''en_EN''New Years Eve');
  387.  
  388.         if (Date_Holidays::errorsOccurred()) {
  389.             return Date_Holidays::getErrorStack();
  390.         }
  391.         return true;
  392.     }
  393.  
  394.     /**
  395.      * Method that returns an array containing the ISO3166 codes that may possibly
  396.      * identify a driver.
  397.      *
  398.      * @static
  399.      * @access public
  400.      * @return array possible ISO3166 codes
  401.      */
  402.     function getISO3166Codes()
  403.     {
  404.         return array('at');
  405.     }
  406. }
  407. ?>

Documentation generated on Sat, 02 Feb 2013 01:00:03 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.