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. // | 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:   Carsten Lucke <luckec@tool-garage.de>                     |
  17. // +----------------------------------------------------------------------+
  18. //
  19. //    $Id: UNO.php,v 1.2 2005/12/22 21:10:14 luckec Exp $
  20.  
  21. /**
  22.  * Driver-class that calculates UNO (United Nations Organization) holidays
  23.  *
  24.  * @category    Date
  25.  * @package     Date_Holidays
  26.  * @subpackage  Driver
  27.  * @version     $Id: UNO.php,v 1.2 2005/12/22 21:10:14 luckec Exp $
  28.  * @author      Carsten Lucke <luckec@tool-garage.de>
  29.  */
  30. {
  31.    /**
  32.     * Constructor
  33.     *
  34.     * Use the Date_Holidays::factory() method to construct an object of a certain driver
  35.     *
  36.     * @access   protected
  37.     */
  38.     function Date_Holidays_Driver_UNO()
  39.     {
  40.     }
  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.         * World's leprosy day
  53.         */
  54.         $this->_addHoliday('leprosyDay'$this->_year . '-01-28''World\'s leprosy day');
  55.         
  56.        /**
  57.         * International day of the native tongue
  58.         */
  59.         $this->_addHoliday('nativeTongueDay'$this->_year . '-02-21''International Day of the native tongue');
  60.         
  61.        /**
  62.         * International Women's Day
  63.         */
  64.         $this->_addHoliday('womensDay'$this->_year . '-03-08''International Women\'s Day');
  65.         
  66.        /**
  67.         * International World Consumers' Day
  68.         */
  69.         $this->_addHoliday('worldConsumersDay'$this->_year . '-03-15''International World Consumers\' Day');
  70.         
  71.        /**
  72.         * International day of the forest
  73.         */
  74.         $this->_addHoliday('intForestDay'$this->_year . '-03-21''International day of the forest');
  75.         
  76.        /**
  77.         * International day of beating racism
  78.         */
  79.         $this->_addHoliday('intDayBeatingRacism'$this->_year . '-03-21''International day of beating racism');
  80.         
  81.        /**
  82.         * Day of poesy
  83.         */
  84.         $this->_addHoliday('dayOfPoesy'$this->_year . '-03-21''Day of poesy');
  85.         
  86.        /**
  87.         * Day of water
  88.         */
  89.         $this->_addHoliday('dayOfWater'$this->_year . '-03-22''Day of water');
  90.         
  91.        /**
  92.         * World's meteorology day
  93.         */
  94.         $this->_addHoliday('meteorologyDay'$this->_year . '-03-23''World\'s meteorology day');
  95.         
  96.        /**
  97.         * World's tuberculosis day
  98.         */
  99.         $this->_addHoliday('tuberculosisDay'$this->_year . '-03-24''World\'s tuberculosis day');
  100.         
  101.        /**
  102.         * World's Health Day
  103.         */
  104.         $this->_addHoliday('worldsHealthDay'$this->_year . '-04-07''World\'s Health Day');
  105.         
  106.        /**
  107.         * Book and Copyright's Day
  108.         */
  109.         $this->_addHoliday('bookAndCopyrightDay'$this->_year . '-04-23''Book and Copyright\'s Day');
  110.         
  111.        /**
  112.         * Tree's Day
  113.         */
  114.         $this->_addHoliday('treesDay'$this->_year . '-04-25''Tree\'s Day');
  115.         
  116.        /**
  117.         * World's day of intellectual property
  118.         */
  119.         $this->_addHoliday('intellectualPropertyDay'$this->_year . '-04-26''World\'s day of intellectual property');
  120.         
  121.        /**
  122.         * International day of work
  123.         */
  124.         $this->_addHoliday('intDayOfWork'$this->_year . '-05-01''International day of work');
  125.         
  126.        /**
  127.         * International day for freedom of the press
  128.         */
  129.         $this->_addHoliday('freedomOfPressDay'$this->_year . '-05-03''International day for freedom of the press');
  130.         
  131.        /**
  132.         * Day of the sun
  133.         */
  134.         $this->_addHoliday('dayOfTheSun'$this->_year . '-05-03''Day of the sun');
  135.         
  136.        /**
  137.         * International Family's Day
  138.         */
  139.         $this->_addHoliday('intFamilyDay'$this->_year . '-05-15''International Family\'s Day');
  140.         
  141.        /**
  142.         * World's Telecommunications Day
  143.         */
  144.         $this->_addHoliday('telecommunicationsDay'$this->_year . '-05-17''World\'s Telecommunications Day');
  145.         
  146.        /**
  147.         * International day of cultural development
  148.         */
  149.         $this->_addHoliday('culturalDevelopmentDay'$this->_year . '-05-21''International day of cultural development');
  150.         
  151.        /**
  152.         * International day of biological diversity
  153.         */
  154.         if ($this->_year >= 2001{
  155.             $this->_addHoliday('biologicalDiversityDay'$this->_year . '-05-22''International day of biological diversity');
  156.         else {
  157.             $this->_addHoliday('biologicalDiversityDay'$this->_year . '-12-29''International day of biological diversity');
  158.         }
  159.         
  160.        /**
  161.         * African Liberation Day
  162.         */
  163.         $this->_addHoliday('africanLiberationDay'$this->_year . '-05-25''African Liberation Day');
  164.         
  165.        /**
  166.         * International UN Peace Squads' Day
  167.         */
  168.         $this->_addHoliday('unPeaceSquadsDay'$this->_year . '-05-29''International UN Peace Squads\' Day');
  169.         
  170.        /**
  171.         * World's Nonsmokers' Day
  172.         */
  173.         $this->_addHoliday('nonsmokersDay'$this->_year . '-05-31''World\'s Nonsmokers\' Day');
  174.         
  175.        /**
  176.         * World's Agriculturalists' Day
  177.         */
  178.         $this->_addHoliday('farmersDay'$this->_year . '-06-01''World\'s Agriculturalists\' Day');
  179.         
  180.        /**
  181.         * World's Environment Day
  182.         */
  183.         $this->_addHoliday('environmentDay'$this->_year . '-06-05''World\'s Environment Day');
  184.         
  185.        /**
  186.         * African Children's Day
  187.         */
  188.         $this->_addHoliday('africanChildrenDay'$this->_year . '-06-16''African Children\'s Day');
  189.         
  190.        /**
  191.         * World's Desert's Day
  192.         */
  193.         $this->_addHoliday('desertDay'$this->_year . '-06-17''World\'s Desert\'s Day');
  194.         
  195.        /**
  196.         * African Fugitives' Day
  197.         */
  198.         $this->_addHoliday('africanFugitiveDay'$this->_year . '-06-20''African Fugitives\' Day');
  199.         
  200.        /**
  201.         * International day against drugs
  202.         */
  203.         $this->_addHoliday('antiDrugsDay'$this->_year . '-06-26''International day against drugs');
  204.         
  205.        /**
  206.         * International Cooperative Societies' Day
  207.         */
  208.         $coopDayDate        = new Date($this->_year . '-07-01');
  209.         while ($coopDayDate->getDayOfWeek(!= 6{
  210.             $coopDayDate    $coopDayDate->getNextDay();
  211.         }
  212.         $this->_addHoliday('intCoopDay'$coopDayDate'International Cooperative Societies\' Day');
  213.         
  214.        /**
  215.         * World's Population Day
  216.         */
  217.         $this->_addHoliday('populationDay'$this->_year . '-07-11''World\'s Population Day');
  218.         
  219.        /**
  220.         * International day of indigenous people
  221.         */
  222.         $this->_addHoliday('indigenousPeopleDay'$this->_year . '-08-09''International day of indigenous people');
  223.         
  224.        /**
  225.         * International Youth' Day
  226.         */
  227.         $this->_addHoliday('intYouthDay'$this->_year . '-08-12''International Youth\' Day');
  228.         
  229.        /**
  230.         * International day of slave trade's abolishment
  231.         */
  232.         $this->_addHoliday('slaveTradeDay'$this->_year . '-08-23''International day of slave trade\'s abolishment');
  233.         
  234.        /**
  235.         * World's Alphabetization Day
  236.         */
  237.         $this->_addHoliday('alphabetizationDay'$this->_year . '-09-08''World\'s Alphabetization Day');
  238.         
  239.        /**
  240.         * Ozone Layer's Protection Day
  241.         */
  242.         $this->_addHoliday('ozoneLayerProtectionDay'$this->_year . '-09-16''Ozone Layer\'s Protection Day');
  243.         
  244.        /**
  245.         * International day of peace
  246.         */
  247.         $peaceDayDate       = new Date($this->_year . '-09-01');
  248.         while ($peaceDayDate->getDayOfWeek(!= 2{
  249.             $peaceDayDate   $peaceDayDate->getNextDay();
  250.         }
  251.         $peaceDayDate->addSpan(new Date_Span('14, 0, 0, 0'));
  252.         $this->_addHoliday('intPeaceDay'$peaceDayDate'International day of peace');
  253.         
  254.        /**
  255.         * World's day of tourism
  256.         */
  257.         $this->_addHoliday('tourismDay'$this->_year . '-09-27''World\'s day of tourism');
  258.         
  259.        /**
  260.         * International fugitives' day
  261.         */
  262.         $this->_addHoliday('intFugitiveDay'$this->_year . '-09-28''International fugitives\' day');
  263.         
  264.        /**
  265.         * International aged people's day
  266.         */
  267.         $this->_addHoliday('agedPeopleDay'$this->_year . '-10-01''International aged people\'s day');
  268.         
  269.        /**
  270.         * World's day for prevention of cruelty to animals
  271.         */
  272.         $this->_addHoliday('animalsDay'$this->_year . '-10-04''World\'s day for prevention of cruelty to animals');
  273.         
  274.        /**
  275.         * Beginning of the International Outer Space Week
  276.         */
  277.         $this->_addHoliday('outerSpaceWeek'$this->_year . '-10-04''Beginning of the International Outer Space Week');
  278.         
  279.        /**
  280.         * World's Habitat Day
  281.         */
  282.         $habitatDayDate     = new Date($this->_year . '-10-01');
  283.         while ($habitatDayDate->getDayOfWeek(!= 1{
  284.             $habitatDayDate $habitatDayDate->getNextDay();
  285.         }
  286.         $this->_addHoliday('habitatDay'$coopDayDate'World\'s Habitat Day');
  287.         
  288.        /**
  289.         * International Teachers' Day
  290.         */
  291.         $this->_addHoliday('teachersDay'$this->_year . '-10-05''International Teachers\' Day');
  292.         
  293.        /**
  294.         * World Post Association's Day
  295.         */
  296.         $this->_addHoliday('postAssociationDay'$this->_year . '-10-09''World Post Association\'s Day');
  297.         
  298.        /**
  299.         * World's Sanity Day
  300.         */
  301.         $this->_addHoliday('sanityDay'$this->_year . '-10-10''World\'s Sanity Day');
  302.         
  303.        /**
  304.         * World's Nourishment Day
  305.         */
  306.         $this->_addHoliday('nourishmentDay'$this->_year . '-10-16''World\'s Nourishment Day');
  307.         
  308.        /**
  309.         * International day for removal of poverty
  310.         */
  311.         $this->_addHoliday('povertyRemovalDay'$this->_year . '-10-17''International day for removal of poverty');
  312.         
  313.        /**
  314.         * United Nations' Day
  315.         */
  316.         $this->_addHoliday('unitedNationsDay'$this->_year . '-10-24''United Nations\' Day');
  317.         
  318.        /**
  319.         * World's day of information about evolvement
  320.         */
  321.         $this->_addHoliday('evolvementInfoDay'$this->_year . '-10-24''World\'s day of information about evolvement');
  322.         
  323.        /**
  324.         * Beginning of the Disarmament Week
  325.         */
  326.         $this->_addHoliday('evolvementInfoDay'$this->_year . '-10-24''Beginning of the Disarmament Week');
  327.         
  328.        /**
  329.         * International day against environmental exploitation in wartime
  330.         */
  331.         $this->_addHoliday('environmentalExploitationDay'$this->_year . '-11-06''International day against environmental exploitation in wartime');
  332.         
  333.        /**
  334.         * International day of tolerance
  335.         */
  336.         $this->_addHoliday('toleranceDay'$this->_year . '-11-16''International day of tolerance');
  337.         
  338.        /**
  339.         * African Industrialization Day
  340.         */
  341.         $this->_addHoliday('africanIndustrializationDay'$this->_year . '-11-20''African Industrialization Day');
  342.         
  343.        /**
  344.         * World's Children's Day
  345.         */
  346.         $this->_addHoliday('worldChildrenDay'$this->_year . '-11-20''World\'s Children\'s Day');
  347.         
  348.        /**
  349.         * World's Television Day
  350.         */
  351.         $this->_addHoliday('televisionDay'$this->_year . '-11-21''World\'s Television Day');
  352.         
  353.        /**
  354.         * International day for removal of violence against women
  355.         */
  356.         $this->_addHoliday('noViolenceAgainstWomen'$this->_year . '-11-25''International day for removal of violence against women');
  357.         
  358.        /**
  359.         * International day of solidarity with Palestinian people
  360.         */
  361.         $this->_addHoliday('palestinianSolidarity'$this->_year . '-11-29''International day of solidarity with Palestinian people');
  362.         
  363.        /**
  364.         * World AIDS Day
  365.         */
  366.         $this->_addHoliday('worldAidsDay'$this->_year . '-12-01''World AIDS Day');
  367.         
  368.        /**
  369.         * International day for abolishment of slavery
  370.         */
  371.         $this->_addHoliday('againstSlaveryDay'$this->_year . '-12-01''International day for abolishment of slavery');
  372.         
  373.        /**
  374.         * International day for disabled people
  375.         */
  376.         $this->_addHoliday('disabledPeopleDay'$this->_year . '-12-03''International day for disabled people');
  377.         
  378.        /**
  379.         * International evolvement helpers' day
  380.         */
  381.         $this->_addHoliday('evolvementHelperDay'$this->_year . '-12-05''International evolvement helpers\' day');
  382.         
  383.        /**
  384.         * International day of civil aeronautics
  385.         */
  386.         $this->_addHoliday('civilAeronauticsDay'$this->_year . '-12-07''International day of civil aeronautics');
  387.         
  388.        /**
  389.         * International day of human rights
  390.         */
  391.         $this->_addHoliday('humanRightsDay'$this->_year . '-12-10''International day of human rights');
  392.         
  393.        /**
  394.         * UNICEF Day
  395.         */
  396.         $this->_addHoliday('unicefDay'$this->_year . '-12-11''UNICEF Day');
  397.         
  398.        /**
  399.         * International migrants' day
  400.         */
  401.         $this->_addHoliday('migrantsDay'$this->_year . '-12-18''International migrants\' day');
  402.         
  403.         if (Date_Holidays::errorsOccurred()) {
  404.             return Date_Holidays::getErrorStack();
  405.         }
  406.         return true;
  407.     }
  408. }
  409. ?>

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