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

Source for file UNO.php

Documentation is available at UNO.php

  1. <?php
  2. /* vim: set expandtab tabstop=4 shiftwidth=4: */
  3. /**
  4.  * UNO
  5.  *
  6.  * PHP Version 4
  7.  *
  8.  * Authors:
  9.  * Copyright (c) 1997-2008 The PHP Group
  10.  *
  11.  * This source file is subject to version 3.0 of the PHP license,
  12.  * that is bundled with this package in the file LICENSE, and is
  13.  * available at through the world-wide-web at
  14.  * http://www.php.net/license/3_01.txt.
  15.  * If you did not receive a copy of the PHP license and are unable to
  16.  * obtain it through the world-wide-web, please send a note to
  17.  * license@php.net so we can mail you a copy immediately.
  18.  *
  19.  * @category Date
  20.  * @package  Date_Holidays
  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: UNO.php,v 1.7 2008/01/26 00:08:35 kguest Exp $
  24.  * @link     http://pear.php.net/package/Date_Holidays
  25.  */
  26.  
  27. /**
  28.  * Driver-class that calculates UNO (United Nations Organization) holidays
  29.  *
  30.  * @category   Date
  31.  * @package    Date_Holidays
  32.  * @subpackage Driver
  33.  * @author     Carsten Lucke <luckec@tool-garage.de>
  34.  * @license    http://www.php.net/license/3_01.txt PHP License 3.0.1
  35.  * @version    CVS: $Id: UNO.php,v 1.7 2008/01/26 00:08:35 kguest Exp $
  36.  * @link       http://pear.php.net/package/Date_Holidays
  37.  */
  38. {
  39.     /**
  40.      * Constructor
  41.      *
  42.      * Use the Date_Holidays::factory() method to construct an object of a
  43.      * certain driver
  44.      *
  45.      * @access   protected
  46.      */
  47.     function Date_Holidays_Driver_UNO()
  48.     {
  49.     }
  50.  
  51.     /**
  52.      * Build the internal arrays that contain data about the calculated holidays
  53.      *
  54.      * @access   protected
  55.      * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  56.      * @throws   object PEAR_ErrorStack
  57.      */
  58.     function _buildHolidays()
  59.     {
  60.         /**
  61.          * World's leprosy day
  62.          */
  63.         $this->_addHoliday('leprosyDay',
  64.                            $this->_year . '-01-28',
  65.                            'World\'s leprosy day');
  66.  
  67.         /**
  68.          * International day of the native tongue
  69.          */
  70.         $this->_addHoliday('nativeTongueDay',
  71.                            $this->_year . '-02-21',
  72.                            'International Day of the native tongue');
  73.  
  74.         /**
  75.          * International Women's Day
  76.          */
  77.         $this->_addHoliday('womensDay',
  78.                            $this->_year . '-03-08',
  79.                            'International Women\'s Day');
  80.  
  81.         /**
  82.          * International World Consumers' Day
  83.          */
  84.         $this->_addHoliday('worldConsumersDay',
  85.                            $this->_year . '-03-15',
  86.                            'International World Consumers\' Day');
  87.  
  88.         /**
  89.          * International day of the forest
  90.          */
  91.         $this->_addHoliday('intForestDay',
  92.                            $this->_year . '-03-21',
  93.                            'International day of the forest');
  94.  
  95.         /**
  96.          * International day of beating racism
  97.          */
  98.         $this->_addHoliday('intDayBeatingRacism',
  99.                            $this->_year . '-03-21',
  100.                            'International day of beating racism');
  101.  
  102.         /**
  103.          * Day of poesy
  104.          */
  105.         $this->_addHoliday('dayOfPoesy',
  106.                            $this->_year . '-03-21',
  107.                            'Day of poesy');
  108.  
  109.         /**
  110.          * Day of water
  111.          */
  112.         $this->_addHoliday('dayOfWater',
  113.                            $this->_year . '-03-22',
  114.                            'Day of water');
  115.  
  116.         /**
  117.          * World's meteorology day
  118.          */
  119.         $this->_addHoliday('meteorologyDay',
  120.                            $this->_year . '-03-23',
  121.                            'World\'s meteorology day');
  122.  
  123.         /**
  124.          * World's tuberculosis day
  125.          */
  126.         $this->_addHoliday('tuberculosisDay',
  127.                            $this->_year . '-03-24',
  128.                            'World\'s tuberculosis day');
  129.  
  130.         /**
  131.          * World's Health Day
  132.          */
  133.         $this->_addHoliday('worldsHealthDay',
  134.                            $this->_year . '-04-07',
  135.                            'World\'s Health Day');
  136.  
  137.         /**
  138.          * Book and Copyright's Day
  139.          */
  140.         $this->_addHoliday('bookAndCopyrightDay',
  141.                            $this->_year . '-04-23',
  142.                            'Book and Copyright\'s Day');
  143.  
  144.         /**
  145.          * Tree's Day
  146.          */
  147.         $this->_addHoliday('treesDay',
  148.                            $this->_year . '-04-25',
  149.                            'Tree\'s Day');
  150.  
  151.         /**
  152.          * World's day of intellectual property
  153.          */
  154.         $this->_addHoliday('intellectualPropertyDay',
  155.                            $this->_year . '-04-26',
  156.                            'World\'s day of intellectual property');
  157.  
  158.         /**
  159.          * International day of work
  160.          */
  161.         $this->_addHoliday('intDayOfWork',
  162.                            $this->_year . '-05-01',
  163.                            'International day of work');
  164.  
  165.         /**
  166.          * International day for freedom of the press
  167.          */
  168.         $this->_addHoliday('freedomOfPressDay',
  169.                            $this->_year . '-05-03',
  170.                            'International day for freedom of the press');
  171.  
  172.         /**
  173.          * Day of the sun
  174.          */
  175.         $this->_addHoliday('dayOfTheSun',
  176.                            $this->_year . '-05-03',
  177.                            'Day of the sun');
  178.  
  179.         /**
  180.          * International Family's Day
  181.          */
  182.         $this->_addHoliday('intFamilyDay',
  183.                            $this->_year . '-05-15',
  184.                            'International Family\'s Day');
  185.  
  186.         /**
  187.          * World's Telecommunications Day
  188.          */
  189.         $this->_addHoliday('telecommunicationsDay',
  190.                            $this->_year . '-05-17',
  191.                            'World\'s Telecommunications Day');
  192.  
  193.         /**
  194.          * International day of cultural development
  195.          */
  196.         $this->_addHoliday('culturalDevelopmentDay',
  197.                            $this->_year . '-05-21',
  198.                            'International day of cultural development');
  199.  
  200.         /**
  201.          * International day of biological diversity
  202.          */
  203.         if ($this->_year >= 2001{
  204.             $this->_addHoliday('biologicalDiversityDay',
  205.                                $this->_year . '-05-22',
  206.                                'International day of biological diversity');
  207.         else {
  208.             $this->_addHoliday('biologicalDiversityDay',
  209.                                $this->_year . '-12-29',
  210.                                'International day of biological diversity');
  211.         }
  212.  
  213.         /**
  214.          * African Liberation Day
  215.          */
  216.         $this->_addHoliday('africanLiberationDay',
  217.                            $this->_year . '-05-25',
  218.                            'African Liberation Day');
  219.  
  220.         /**
  221.          * International UN Peace Squads' Day
  222.          */
  223.         $this->_addHoliday('unPeaceSquadsDay',
  224.                            $this->_year . '-05-29',
  225.                            'International UN Peace Squads\' Day');
  226.  
  227.         /**
  228.          * World's Nonsmokers' Day
  229.          */
  230.         $this->_addHoliday('nonsmokersDay',
  231.                            $this->_year . '-05-31',
  232.                            'World\'s Nonsmokers\' Day');
  233.  
  234.         /**
  235.          * World's Agriculturalists' Day
  236.          */
  237.         $this->_addHoliday('farmersDay',
  238.                            $this->_year . '-06-01',
  239.                            'World\'s Agriculturalists\' Day');
  240.  
  241.         /**
  242.          * World's Environment Day
  243.          */
  244.         $this->_addHoliday('environmentDay',
  245.                            $this->_year . '-06-05',
  246.                            'World\'s Environment Day');
  247.  
  248.         /**
  249.          * African Children's Day
  250.          */
  251.         $this->_addHoliday('africanChildrenDay',
  252.                            $this->_year . '-06-16',
  253.                            'African Children\'s Day');
  254.  
  255.         /**
  256.          * World's Desert's Day
  257.          */
  258.         $this->_addHoliday('desertDay',
  259.                            $this->_year . '-06-17',
  260.                            'World\'s Desert\'s Day');
  261.  
  262.         /**
  263.          * African Fugitives' Day
  264.          */
  265.         $this->_addHoliday('africanFugitiveDay',
  266.                            $this->_year . '-06-20',
  267.                            'African Fugitives\' Day');
  268.  
  269.         /**
  270.          * International day against drugs
  271.          */
  272.         $this->_addHoliday('antiDrugsDay',
  273.                            $this->_year . '-06-26',
  274.                            'International day against drugs');
  275.  
  276.         /**
  277.          * International Cooperative Societies' Day
  278.          */
  279.         $coopDayDate = new Date($this->_year . '-07-01');
  280.         while ($coopDayDate->getDayOfWeek(!= 6{
  281.             $coopDayDate $coopDayDate->getNextDay();
  282.         }
  283.         $this->_addHoliday('intCoopDay',
  284.                            $coopDayDate,
  285.                            'International Cooperative Societies\' Day');
  286.  
  287.         /**
  288.          * World's Population Day
  289.          */
  290.         $this->_addHoliday('populationDay',
  291.                            $this->_year . '-07-11',
  292.                            'World\'s Population Day');
  293.  
  294.         /**
  295.          * International day of indigenous people
  296.          */
  297.         $this->_addHoliday('indigenousPeopleDay',
  298.                            $this->_year . '-08-09',
  299.                            'International day of indigenous people');
  300.  
  301.         /**
  302.          * International Youth' Day
  303.          */
  304.         $this->_addHoliday('intYouthDay',
  305.                            $this->_year . '-08-12',
  306.                            'International Youth\' Day');
  307.  
  308.         /**
  309.          * International day of slave trade's abolishment
  310.          */
  311.         $this->_addHoliday('slaveTradeDay',
  312.                            $this->_year . '-08-23',
  313.                            'International day of slave trade\'s abolishment');
  314.  
  315.         /**
  316.          * World's Alphabetization Day
  317.          */
  318.         $this->_addHoliday('alphabetizationDay',
  319.                            $this->_year . '-09-08',
  320.                            'World\'s Alphabetization Day');
  321.  
  322.         /**
  323.          * Ozone Layer's Protection Day
  324.          */
  325.         $this->_addHoliday('ozoneLayerProtectionDay',
  326.                            $this->_year . '-09-16',
  327.                            'Ozone Layer\'s Protection Day');
  328.  
  329.         /**
  330.          * International day of peace
  331.          */
  332.         $peaceDayDate = new Date($this->_year . '-09-01');
  333.         while ($peaceDayDate->getDayOfWeek(!= 2{
  334.             $peaceDayDate $peaceDayDate->getNextDay();
  335.         }
  336.         $peaceDayDate->addSpan(new Date_Span('14, 0, 0, 0'));
  337.         $this->_addHoliday('intPeaceDay',
  338.                            $peaceDayDate,
  339.                            'International day of peace');
  340.  
  341.         /**
  342.          * World's day of tourism
  343.          */
  344.         $this->_addHoliday('tourismDay',
  345.                            $this->_year . '-09-27',
  346.                            'World\'s day of tourism');
  347.  
  348.         /**
  349.          * International fugitives' day
  350.          */
  351.         $this->_addHoliday('intFugitiveDay',
  352.                            $this->_year . '-09-28',
  353.                            'International fugitives\' day');
  354.  
  355.         /**
  356.          * International aged people's day
  357.          */
  358.         $this->_addHoliday('agedPeopleDay',
  359.                            $this->_year . '-10-01',
  360.                            'International aged people\'s day');
  361.  
  362.         /**
  363.          * World's day for prevention of cruelty to animals
  364.          */
  365.         $this->_addHoliday('animalsDay',
  366.                            $this->_year . '-10-04',
  367.                            'World\'s day for prevention of cruelty to animals');
  368.  
  369.         /**
  370.          * Beginning of the International Outer Space Week
  371.          */
  372.         $this->_addHoliday('outerSpaceWeek',
  373.                            $this->_year . '-10-04',
  374.                            'Beginning of the International Outer Space Week');
  375.  
  376.         /**
  377.          * World's Habitat Day
  378.          */
  379.         $habitatDayDate = new Date($this->_year . '-10-01');
  380.         while ($habitatDayDate->getDayOfWeek(!= 1{
  381.             $habitatDayDate $habitatDayDate->getNextDay();
  382.         }
  383.         $this->_addHoliday('habitatDay'$coopDayDate'World\'s Habitat Day');
  384.  
  385.         /**
  386.          * International Teachers' Day
  387.          */
  388.         $this->_addHoliday('teachersDay',
  389.                            $this->_year . '-10-05',
  390.                            'International Teachers\' Day');
  391.  
  392.         /**
  393.          * World Post Association's Day
  394.          */
  395.         $this->_addHoliday('postAssociationDay',
  396.                            $this->_year . '-10-09',
  397.                            'World Post Association\'s Day');
  398.  
  399.         /**
  400.          * World's Sanity Day
  401.          */
  402.         $this->_addHoliday('sanityDay',
  403.                            $this->_year . '-10-10',
  404.                            'World\'s Sanity Day');
  405.  
  406.         /**
  407.          * World's Nourishment Day
  408.          */
  409.         $this->_addHoliday('nourishmentDay',
  410.                            $this->_year . '-10-16',
  411.                            'World\'s Nourishment Day');
  412.  
  413.         /**
  414.          * International day for removal of poverty
  415.          */
  416.         $this->_addHoliday('povertyRemovalDay',
  417.                            $this->_year . '-10-17',
  418.                            'International day for removal of poverty');
  419.  
  420.         /**
  421.          * United Nations' Day
  422.          */
  423.         $this->_addHoliday('unitedNationsDay',
  424.                            $this->_year . '-10-24',
  425.                            'United Nations\' Day');
  426.  
  427.         /**
  428.          * World's day of information about evolvement
  429.          */
  430.         $this->_addHoliday('evolvementInfoDay',
  431.                            $this->_year . '-10-24',
  432.                            'World\'s day of information about evolvement');
  433.  
  434.         /**
  435.          * Beginning of the Disarmament Week
  436.          */
  437.         $this->_addHoliday('evolvementInfoDay',
  438.                            $this->_year . '-10-24',
  439.                            'Beginning of the Disarmament Week');
  440.  
  441.         /**
  442.          * International day against environmental exploitation in wartime
  443.          */
  444.         $this->_addHoliday('environmentalExploitationDay',
  445.                            $this->_year . '-11-06',
  446.             'International day against environmental exploitation in wartime');
  447.  
  448.         /**
  449.          * International day of tolerance
  450.          */
  451.         $this->_addHoliday('toleranceDay',
  452.                            $this->_year . '-11-16',
  453.                            'International day of tolerance');
  454.  
  455.         /**
  456.          * African Industrialization Day
  457.          */
  458.         $this->_addHoliday('africanIndustrializationDay',
  459.                            $this->_year . '-11-20',
  460.                            'African Industrialization Day');
  461.  
  462.         /**
  463.          * World's Children's Day
  464.          */
  465.         $this->_addHoliday('worldChildrenDay',
  466.                            $this->_year . '-11-20',
  467.                            'World\'s Children\'s Day');
  468.  
  469.         /**
  470.          * World's Television Day
  471.          */
  472.         $this->_addHoliday('televisionDay',
  473.                            $this->_year . '-11-21',
  474.                            'World\'s Television Day');
  475.  
  476.         /**
  477.          * International day for removal of violence against women
  478.          */
  479.         $this->_addHoliday('noViolenceAgainstWomen',
  480.                           $this->_year . '-11-25',
  481.                           'International day for removal of violence against women');
  482.  
  483.         /**
  484.          * International day of solidarity with Palestinian people
  485.          */
  486.         $this->_addHoliday('palestinianSolidarity',
  487.                           $this->_year . '-11-29',
  488.                           'International day of solidarity with Palestinian people');
  489.  
  490.         /**
  491.          * World AIDS Day
  492.          */
  493.         $this->_addHoliday('worldAidsDay',
  494.                            $this->_year . '-12-01',
  495.                            'World AIDS Day');
  496.  
  497.         /**
  498.          * International day for abolishment of slavery
  499.          */
  500.         $this->_addHoliday('againstSlaveryDay',
  501.                            $this->_year . '-12-01',
  502.                            'International day for abolishment of slavery');
  503.  
  504.         /**
  505.          * International day for disabled people
  506.          */
  507.         $this->_addHoliday('disabledPeopleDay',
  508.                            $this->_year . '-12-03',
  509.                            'International day for disabled people');
  510.  
  511.         /**
  512.          * International evolvement helpers' day
  513.          */
  514.         $this->_addHoliday('evolvementHelperDay',
  515.                            $this->_year . '-12-05',
  516.                            'International evolvement helpers\' day');
  517.  
  518.         /**
  519.          * International day of civil aeronautics
  520.          */
  521.         $this->_addHoliday('civilAeronauticsDay',
  522.                            $this->_year . '-12-07',
  523.                            'International day of civil aeronautics');
  524.  
  525.         /**
  526.          * International day of human rights
  527.          */
  528.         $this->_addHoliday('humanRightsDay',
  529.                            $this->_year . '-12-10',
  530.                            'International day of human rights');
  531.  
  532.         /**
  533.          * UNICEF Day
  534.          */
  535.         $this->_addHoliday('unicefDay',
  536.                            $this->_year . '-12-11',
  537.                            'UNICEF Day');
  538.  
  539.         /**
  540.          * International migrants' day
  541.          */
  542.         $this->_addHoliday('migrantsDay',
  543.                            $this->_year . '-12-18',
  544.                            'International migrants\' day');
  545.  
  546.         if (Date_Holidays::errorsOccurred()) {
  547.             return Date_Holidays::getErrorStack();
  548.         }
  549.         return true;
  550.     }
  551. }
  552. ?>

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