/**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * St. Tib's day. Occurs every leap year.
      */
     $this->_addHoliday('stTibsDay', $this->_year . '-02-29', 'St. Tib\'s Day');
     /**
      * Holidays assigned to apostles. Apostles' holidays are on
      * the fifth day of each season
      */
     $this->_addHoliday('mungday', $this->_year . '-01-05', 'Mungday');
     $this->_addHoliday('mojoday', $this->_year . '-03-19', 'Mojoday');
     $this->_addHoliday('syaday', $this->_year . '-05-31', 'Syaday');
     $this->_addHoliday('zaraday', $this->_year . '-08-12', 'Zaraday');
     $this->_addHoliday('maladay', $this->_year . '-10-24', 'Maladay');
     /**
      * Holidays assigned to seasons. Seasonal holidays are
      * assigned to the fiftieth day of the corresponding season
      */
     $this->_addHoliday('chaoflux', $this->_year . '-02-19', 'Chaoflux');
     $this->_addHoliday('discoflux', $this->_year . '-05-03', 'Discoflux');
     $this->_addHoliday('confuflux', $this->_year . '-07-15', 'Confuflux');
     $this->_addHoliday('bureflux', $this->_year . '-09-26', 'Bureflux');
     $this->_addHoliday('afflux', $this->_year . '-12-08', 'Afflux');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #2
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #3
0
function isHoliday($date = 0)
{
    // Query database for settings
    $holiday_manual = db_loadResult('SELECT holiday_manual FROM holiday_settings');
    $holiday_auto = db_loadResult('SELECT holiday_auto FROM holiday_settings');
    $holiday_driver = db_loadResult('SELECT holiday_driver FROM holiday_settings');
    if (!$date) {
        $date = new CDate();
    }
    if ($holiday_manual) {
        // Check whether the date is blacklisted
        $sql = "SELECT * FROM holiday ";
        $sql .= "WHERE ( date(holiday_start_date) <= '";
        $sql .= $date->format('%Y-%m-%d');
        $sql .= "' AND date(holiday_end_date) >= '";
        $sql .= $date->format('%Y-%m-%d');
        $sql .= "' AND holiday_white=0 ) ";
        $sql .= "OR ( ";
        $sql .= " DATE_FORMAT(holiday_start_date, '%m-%d') <= '";
        $sql .= $date->format('%m-%d');
        $sql .= "' AND DATE_FORMAT(holiday_end_date, '%m-%d') >= '";
        $sql .= $date->format('%m-%d');
        $sql .= "' AND holiday_annual=1";
        $sql .= " AND holiday_white=0 ) ";
        if (db_loadResult($sql)) {
            return 0;
        }
        // Check if we have a whitelist item for this date
        $sql = "SELECT * FROM holiday ";
        $sql .= "WHERE ( date(holiday_start_date) <= '";
        $sql .= $date->format('%Y-%m-%d');
        $sql .= "' AND date(holiday_end_date) >= '";
        $sql .= $date->format('%Y-%m-%d');
        $sql .= "' AND holiday_white=1 ) ";
        $sql .= "OR ( ";
        $sql .= " DATE_FORMAT(holiday_start_date, '%m-%d') <= '";
        $sql .= $date->format('%m-%d');
        $sql .= "' AND DATE_FORMAT(holiday_end_date, '%m-%d') >= '";
        $sql .= $date->format('%m-%d');
        $sql .= "' AND holiday_annual=1";
        $sql .= " AND holiday_white=1 ) ";
        if (db_loadResult($sql)) {
            return 1;
        }
    }
    if ($holiday_auto) {
        // Still here? Ok, lets poll the automatic system
        $drivers_alloc = Date_Holidays::getInstalledDrivers();
        $driver_object = Date_Holidays::factory($drivers_alloc[$holiday_driver]['title'], $date->getYear(), 'en_EN');
        if (!Date_Holidays::isError($driver_object)) {
            if ($driver_object->getHolidayForDate($date)) {
                return 1;
            }
        }
    }
    // No hits, must be a working day
    return 0;
}
 /**
  * Remove a filter from the compound.
  *
  * @param Date_Holidays_Filter $filter filter object
  *
  * @access   public
  * @return   boolean     true on success, otherwise a PEAR_Error object
  * @throws   PEAR_Error  DATE_HOLIDAYS_FILTER_NOT_FOUND
  */
 function removeFilter($filter)
 {
     if (!is_a($filter, 'Date_Holidays_Filter')) {
         return false;
     }
     $id = md5(serialize($filter));
     // unset filter object
     if (!isset($this->_filters[$id])) {
         return Date_Holidays::raiseError(DATE_HOLIDAYS_FILTER_NOT_FOUND, 'Filter not found');
     }
     unset($this->_drivers[$id]);
     return true;
 }
Example #5
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'ga_IE', 'Lá na Caille');
     /**
      * Epiphany
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     $this->_addTranslationForHoliday('epiphany', 'ga_IE', 'Nollag na mBan');
     /**
      * St Patrick's Day.
      */
     $this->_addHoliday('stPatricksDay', $this->_year . '-03-17', 'Saint Patrick\'s Day');
     $this->_addTranslationForHoliday('stPatricksDay', 'ga_IE', 'Lá Fhéile Pádraig');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Ireland::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     $this->_addTranslationForHoliday('easter', 'ga_IE', 'Domhnach Cásca');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     $this->_addTranslationForHoliday('goodFriday', 'ga_IE', 'Aoine Cásca');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     $this->_addTranslationForHoliday('easterMonday', 'ga_IE', 'Luan Cásca');
     /**
      * May Bank Holiday
      */
     $dn = $this->_calcFirstMonday('05');
     $this->_addHoliday('mayDayBankHoliday', $dn, 'May Bank Holiday');
     $this->_addTranslationForHoliday('mayDayBankHoliday', 'ga_IE', 'Lá Bealtaine');
     /**
      * Pentecost (determines Whit Monday, Ascension Day and
      * Feast of Corpus Christi)
      */
     $pentecostDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('pentecost', $pentecostDate, 'Pentecost');
     $this->_addTranslationForHoliday('pentecost', 'ga_IE', 'An Chincís');
     /**
      * Ascension Day
      */
     $ascensionDayDate = $this->_addDays($pentecostDate, -10);
     $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
     $this->_addTranslationForHoliday('ascensionDay', 'ga_IE', 'Deascabhála');
     /**
      * June Bank Holiday
      */
     $dn = $this->_calcFirstMonday('06');
     $this->_addHoliday('juneBankHoliday', $dn, 'June Bank Holiday');
     $this->_addTranslationForHoliday('juneBankHoliday', 'ga_IE', 'Lá Meitheamh');
     /**
      * Midsummer
      * Saturday past 20th, June
      */
     $juneDate = new Date($this->_year . '-06-20');
     $dayOfWeek = $juneDate->getDayOfWeek();
     $midSummerDate = $this->_addDays($juneDate, 6 - $dayOfWeek);
     $this->_addHoliday('midSummer', $midSummerDate, 'Midsummer Day');
     $this->_addTranslationForHoliday('midSummer', 'ga_IE', 'Lá Fhéile Eoin');
     /**
      * August Bank Holiday
      */
     $dn = $this->_calcFirstMonday('08');
     $this->_addHoliday('augustBankHoliday', $dn, 'August Bank Holiday');
     $this->_addTranslationForHoliday('augustBankHoliday', 'ga_IE', 'Lá Lúnasa');
     /**
      * October Bank Holiday
      */
     $dn = $this->_calcLastMonday('10');
     $this->_addHoliday('octoberBankHoliday', $dn, 'October Bank Holiday');
     $this->_addTranslationForHoliday('octoberBankHoliday', 'ga_IE', 'Lá Samhna');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Christmas Eve');
     $this->_addTranslationForHoliday('christmasEve', 'ga_IE', 'Oíche Nollag');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     $this->_addTranslationForHoliday('christmasDay', 'ga_IE', 'Lá Nollag');
     /**
      * St. Stephen's Day
      */
     $this->_addHoliday('stStephensDay', $this->_year . '-12-26', 'Saint Stephen\'s Day');
     $this->_addTranslationForHoliday('stStephensDay', 'ga_IE', 'Lá Fhéile Stiofáin');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'New Year\'s Eve');
     $this->_addTranslationForHoliday('newYearsEve', 'ga_IE', 'Oíche Chinn Bliana');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #6
0
 /**
  * Return list of all available holidays drivers.
  *
  * @return array  The available holidays.
  */
 protected function _getAllHolidays()
 {
     $this->_allHolidays = array();
     if (!empty($GLOBALS['conf']['holidays']['enable'])) {
         if (class_exists('Date_Holidays')) {
             $dh = new Date_Holidays();
             foreach ($dh->getInstalledDrivers() as $driver) {
                 if ($driver['id'] == 'Composite') {
                     continue;
                 }
                 $this->_allHolidays[$driver['id']] = new Kronolith_Calendar_Holiday(array('driver' => $driver));
                 ksort($this->_allHolidays);
             }
         }
     }
     return $this->_allHolidays;
 }
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'it_IT', 'Capodanno');
     /**
      * Epiphany
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     $this->_addTranslationForHoliday('epiphany', 'it_IT', 'Epifania');
     /**
      * St Agata's Day and
      * Anniversary of the Liberation from the Occupation of Cardinal Alberoni
      */
     $this->_addHoliday('stagataday', $this->_year . '-02-05', 'St Agata\'s Day');
     $this->_addTranslationForHoliday('stagataday', 'it_IT', 'Sant\'Agata');
     /**
      * Anniversary of the "Arengo"
      */
     $this->_addHoliday('arengo', $this->_year . '-03-25', 'Anniversary of the "Arengo"');
     $this->_addTranslationForHoliday('arengo', 'it_IT', 'Anniversario dell\'Arengo');
     /**
      * Investiture of the Captains Regent (Heads of  State)
      */
     $this->_addHoliday('reggentiaprile', $this->_year . '-04-01', 'Investiture of the Captains Regent (Heads of  State)');
     $this->_addTranslationForHoliday('reggentiaprile', 'it_IT', 'Ingresso Capitani Reggenti');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     $this->_addTranslationForHoliday('easter', 'it_IT', 'Pasqua');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     $this->_addTranslationForHoliday('easterMonday', 'it_IT', 'Lunedi` dell\'Angelo');
     /**
      * Day of Work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'Day of Work');
     $this->_addTranslationForHoliday('dayOfWork', 'it_IT', 'Festa del Lavoro');
     /**
      * Corpus Domini
      */
     $corpus = $this->_addDays($easterDate, 60);
     $this->_addHoliday('corpusdomini', $corpus, 'Corpus Domini');
     $this->_addTranslationForHoliday('corpusdomini', 'it_IT', 'Corpus Domini');
     /**
      * Fall of Fascism
      */
     $this->_addHoliday('falloffascism', $this->_year . '-07-28', 'Fall of Fascism');
     $this->_addTranslationForHoliday('falloffascism', 'it_IT', 'Caduta del Fascismo');
     /**
      * Ascension of Maria
      */
     $this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Ascension of Maria');
     $this->_addTranslationForHoliday('mariaAscension', 'it_IT', 'Assunzione di Maria Vergine');
     /**
      * San Marino National Holiday and Foundation of the Republic
      */
     $this->_addHoliday('nationalholiday', $this->_year . '-09-03', 'San Marino National Holiday and Foundation of the Republic');
     $this->_addTranslationForHoliday('nationalholiday', 'it_IT', 'San Marino, festa della fondazione');
     /**
      * Investiture of the Captains Regent (Heads of  State)
      */
     $this->_addHoliday('reggentiottobre', $this->_year . '-10-01', 'Investiture of the Captains Regent (Heads of  State)');
     $this->_addTranslationForHoliday('reggentiottobre', 'it_IT', 'Ingresso Capitani Reggenti');
     /**
      * All Saints' Day
      */
     $this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'All Saints\' Day');
     $this->_addTranslationForHoliday('allSaintsDay', 'it_IT', 'Ognissanti');
     /**
      * All Souls' Day
      */
     $this->_addHoliday('allSoulsDay', $this->_year . '-11-02', 'All Souls\' Day');
     $this->_addTranslationForHoliday('allSoulsDay', 'it_IT', 'Commemorazione dei Defunti');
     /**
      * Maria' conception
      */
     $this->_addHoliday('mariaConception', $this->_year . '-12-08', 'Conception of Maria');
     $this->_addTranslationForHoliday('mariaConception', 'it_IT', 'Immacolata Concezione');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     $this->_addTranslationForHoliday('christmasDay', 'it_IT', 'Santo Natale');
     /**
      * St. Stephen's Day
      */
     $this->_addHoliday('StStephensDay', $this->_year . '-12-26', 'Saint Stephen\'s Day');
     $this->_addTranslationForHoliday('StStephensDay', 'it_IT', 'Santo Stefano');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #8
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Sweden::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     /**
      * May Day
      */
     $this->_addHoliday('mayDay', $this->_year . '-05-01', 'May Day');
     /**
      * Pentecost (determines Whit Monday, Ascension Day and
      * Feast of Corpus Christi)
      */
     $pentecostDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('pentecost', $pentecostDate, 'Pentecost');
     /**
      * Ascension Day
      */
     $ascensionDayDate = $this->_addDays($pentecostDate, -10);
     $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
     /**
      * Swedish National Day and the Swedish Flag's Day
      */
     $this->_addHoliday('swedenNationalDay', $this->_year . '-06-06', 'Swedish National Day and the Swedish Flag\'s Day');
     /**
      * Midsummer
      * Saturday past 20th, June
      */
     $juneDate = new Date($this->_year . '-06-20');
     $dayOfWeek = $juneDate->getDayOfWeek();
     $midSummerDate = $this->_addDays($juneDate, 6 - $dayOfWeek);
     $this->_addHoliday('midSummer', $midSummerDate, 'Midsummer Day');
     /**
      * Midsummer Eve
      * Day before Midsummer.
      */
     $this->_addHoliday('midSummerEve', $midSummerDate->getPrevDay(), 'Midsummer Eve');
     /**
      * All Saints' Day
      */
     $saintspanDate = new Date($this->_year . '-10-31');
     $dayOfWeek = $saintspanDate->getDayOfWeek();
     $allSaintsDate = $this->_addDays($saintspanDate, 6 - $dayOfWeek);
     $this->_addHoliday('allSaintsDay', $allSaintsDate, 'All Saints\' Day');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Christmas Eve');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     /**
      * Boxing day
      */
     $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Boxing Day');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'New Year\'s Eve');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 /**
  * Returns the errors the error-stack contains
  *
  * @param boolean $purge true if the stall shall be purged
  *
  * @static
  * @access   public
  * @return   array   errors
  */
 function getErrors($purge = false)
 {
     $errorStack =& Date_Holidays::getErrorStack();
     return $errorStack->getErrors($purge);
 }
Example #10
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access	 protected
  * @return	 boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws	 object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     parent::_buildHolidays();
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     /**
      * Epiphanias
      */
     $firstSunday = $this->_calcNthWeekDayInMonth(1, 0, 1);
     if ($firstSunday->getDay() == 1) {
         $firstSunday = $this->_addDays($firstSunday, 7);
     }
     $this->_addHoliday('epiphanySunday', $firstSunday, 'Epiphany');
     /**
      * Valentine's Day
      */
     $this->_addHoliday('valentinesDay', $this->_year . '-02-14', 'Valentine\'s Day');
     /**
      * Easter Sunday
      */
     $easterDate = $this->getHolidayDate('easter');
     /**
      * Shrove Monday
      */
     $shroveMondayDate = $this->_addDays($easterDate, -48);
     $this->_addHoliday('shroveMonday', $shroveMondayDate, 'Shrove Monday');
     /**
      * Shrove Tuesday
      */
     $shroveTuesdayDate = $this->_addDays($shroveMondayDate, 1);
     $this->_addHoliday('shroveTuesday', $shroveTuesdayDate, 'Shrove Tuesday');
     /**
      * International day of work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'International day of work');
     /**
      * 1945 victory
      */
     $this->_addHoliday('victory1945', $this->_year . '-05-08', 'Victory of 1945');
     /**
      * Mother's Day
      */
     $mothersDay = $this->_calcLastSunday(5);
     $whitsun = $this->getHolidayDate('whitsun');
     $mothersDay2 = new Date($mothersDay);
     if ($mothersDay2->equals(clone $whitsun)) {
         $mothersDay = $this->_addDays($mothersDay, 7);
     }
     $this->_addHoliday('mothersDay', $mothersDay, 'Mothers\' Day');
     /**
      * Abolition of Slavery Day (Mayotte)
      */
     $this->_addHoliday('abolitionOfSlaveryDayMayotte', $this->_year . '-04-27', 'Abolition of Slavery Day');
     /**
      * Saint-Pierre-Chanel Day (Wallis and Futuna)
      */
     $this->_addHoliday('saintPierreChanelDay', $this->_year . '-04-28', 'Saint-Pierre-Chanel Day');
     /**
      * Abolition of Slavery Day (Martinique)
      */
     $this->_addHoliday('abolitionOfSlaveryDayMartinique', $this->_year . '-05-22', 'Abolition of Slavery Day');
     /**
      * Abolition of Slavery Day (Guadeloupe)
      */
     $this->_addHoliday('abolitionOfSlaveryDayGuadeloupe', $this->_year . '-05-27', 'Abolition of Slavery Day');
     /**
      * Abolition of Slavery Day (Guyana)
      */
     $this->_addHoliday('abolitionOfSlaveryDayGuyana', $this->_year . '-06-10', 'Abolition of Slavery Day');
     /**
      * Autonomy Day (French Polynesia)
      */
     $this->_addHoliday('autonomyDay', $this->_year . '-06-29', 'Autonomy Day');
     /**
      * French National Day
      */
     $this->_addHoliday('frenchNationalDay', $this->_year . '-07-14', 'French National Day');
     /**
      * Victor Schoelcher Day
      */
     $this->_addHoliday('victorSchoelcherDay', $this->_year . '-07-21', 'Victor Schoelcher Day');
     /**
      * Territory Day (Wallis and Futuna)
      */
     $this->_addHoliday('territoryDay', $this->_year . '-07-29', 'Territory Day');
     /**
      * Celebration of citizenship Day (New Caledonia)
      */
     $this->_addHoliday('celebrationOfCitizenshipDay', $this->_year . '-09-24', 'Celebration of citizenship Day');
     /**
      * Veteran's	Day
      */
     $this->_addHoliday('veteransDay', $this->_year . '-11-11', 'Veteran\'s Day');
     /**
      * Abolition of Slavery Day (Reunion)
      */
     $this->_addHoliday('abolitionOfSlaveryDayReunion', $this->_year . '-12-20', 'Abolition of Slavery Day');
     /**
      * Saint Étienne Day(Alsace & Moselle)
      */
     $this->_addHoliday('saintEtienneDay', $this->_year . '-12-26', 'Saint Étienne Day');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access protected
  * @return boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $newYearsDayDate = $this->_calcNearestWorkDay('01', '01');
     $this->_addHoliday('newYearsDay', $newYearsDayDate, 'New Year\'s Day');
     /**
      * Human Rights Day
      */
     $humanRightsDayDate = $this->_calcNearestWorkDay('03', '21');
     $this->_addHoliday('humanRightsDay', $humanRightsDayDate, 'Human Rights Day');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     /**
      * Good Friday
      */
     $goodFridayDate = new Date($easterDate);
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     /**
      * Family Day
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Family Day');
     /**
      * Freedom Day
      */
     $freedomDayDate = $this->_calcNearestWorkDay('04', '27');
     $this->_addHoliday('freedomDay', $freedomDayDate, 'Freedom Day');
     /**
      * Worker's Day
      */
     $workersDayDate = $this->_calcNearestWorkDay('05', '01');
     $this->_addHoliday('workersDay', $workersDayDate, 'Worker\'s Day');
     /**
      * Youth Day
      */
     $youthDayDate = $this->_calcNearestWorkDay('06', '16');
     $this->_addHoliday('youthDay', $youthDayDate, 'Youth Day');
     /**
      * National Women's Day
      */
     $womensDayDate = $this->_calcNearestWorkDay('08', '09');
     $this->_addHoliday('womensDay', $womensDayDate, 'Women\'s Day');
     /**
      * Heritage Day
      */
     $heritageDayDate = $this->_calcNearestWorkDay('09', '24');
     $this->_addHoliday('heritageDay', $heritageDayDate, 'Heritage Day');
     /**
      * Day of Reconciliation
      */
     $dayOfReconciliation = $this->_calcNearestWorkDay('12', '16');
     $this->_addHoliday('dayOfReconciliation', $dayOfReconciliation, 'Day of Reconciliation');
     /**
      * Christmas Day
      */
     $christmasDay = $this->_calcNearestWorkDay('12', '25');
     $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
     /**
      * Day of Goodwill
      */
     $dayOfGoodwill = $this->_calcNearestWorkDay('12', '26');
     $this->_addHoliday('dayOfGoodwill', $dayOfGoodwill, 'Day of Goodwill');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #12
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'da_DK', 'Nytårsdag');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     $this->_addTranslationForHoliday('epiphany', 'da_DK', 'Hellig 3 Konger');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     $this->_addTranslationForHoliday('easter', 'da_DK', 'Påskedag');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     $this->_addTranslationForHoliday('easterMonday', 'da_DK', '2. Påskedag');
     /**
      * Palm Sunday
      */
     $palmSundayDate = $this->_addDays($easterDate, -7);
     $this->_addHoliday('palmSunday', $palmSundayDate, 'Palm Sunday');
     $this->_addTranslationForHoliday('palmSunday', 'da_DK', 'Palme Søndag');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     $this->_addTranslationForHoliday('goodFriday', 'da_DK', 'Langfredag');
     /**
      * Green Thursday
      */
     $this->_addHoliday('greenThursday', $goodFridayDate->getPrevDay(), 'Green Thursday');
     $this->_addTranslationForHoliday('greenThursday', 'da_DK', 'Skærtorsdag');
     /**
      * Whitsun (determines Whit Monday, Ascension Day and
      * Feast of Corpus Christi)
      */
     $whitsunDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('whitsun', $whitsunDate, 'Whitsun');
     $this->_addTranslationForHoliday('whitsun', 'da_DK', 'Pinsedag');
     /**
      * Whit Monday
      */
     $this->_addHoliday('whitMonday', $whitsunDate->getNextDay(), 'Whit Monday');
     $this->_addTranslationForHoliday('whitMonday', 'da_DK', '2. Pinsedag');
     /**
      * Ascension Day
      */
     $ascensionDayDate = $this->_addDays($whitsunDate, -10);
     $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
     $this->_addTranslationForHoliday('ascensionDay', 'da_DK', 'Kr. Himmelfart');
     /**
      * Heart of Jesus (General Prayer Day)
      *
      * Friday of the 3rd week past Whitsun
      */
     $heartJesusDate = $this->_addDays($goodFridayDate, 28);
     $this->_addHoliday('heartJesus', $heartJesusDate, 'Heart of Jesus celebration');
     $this->_addTranslationForHoliday('heartJesus', 'da_DK', 'Store Bededag');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Christmas Eve');
     $this->_addTranslationForHoliday('christmasEve', 'da_DK', 'Juleaften');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     $this->_addTranslationForHoliday('christmasDay', 'da_DK', '1. Juledag');
     /**
      * Second Christmas Day
      */
     $this->_addHoliday('secondChristmasDay', $this->_year . '-12-26', 'Boxing Day');
     $this->_addTranslationForHoliday('secondChristmasDay', 'da_DK', '2. Juledag');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'New Year\'s Eve');
     $this->_addTranslationForHoliday('newYearsEve', 'da_DK', 'Nytårsaften');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access protected
  * @return boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $newYearsDay = new Date($this->_year . '-01-01');
     if ($newYearsDay->getDayOfWeek() == 0) {
         $this->_addHoliday('newYearsDay', $this->_year . '-01-02', 'Substitute Bank Holiday in lieu of New Year\'s Day');
     } elseif ($newYearsDay->getDayOfWeek() == 6) {
         $this->_addHoliday('newYearsDay', $this->_year . '-01-03', 'Substitute Bank Holiday in lieu of New Year\'s Day');
     } else {
         $this->_addHoliday('newYearsDay', $newYearsDay, 'New Year\'s Day');
     }
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     /**
      * Good Friday
      */
     $goodFridayDate = new Date($easterDate);
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     /**
      * May Day Bank Holiday
      */
     $earlyMayDate = Date_Holidays_Driver_USA::_calcNthMondayInMonth(5, 1);
     $this->_addHoliday('mayDay', $earlyMayDate, 'May Day Bank Holiday');
     /**
      * Spring Bank Holiday
      */
     $springBankDate = Date_Holidays_Driver_USA::_calcLastMondayInMonth(5);
     $this->_addHoliday('springBank', $springBankDate, 'Spring Bank Holiday');
     /**
      * Summer Bank Holiday
      */
     $summerBankDate = Date_Holidays_Driver_USA::_calcLastMondayInMonth(8);
     $this->_addHoliday('summerBank', $summerBankDate, 'Summer Bank Holiday');
     /**
      * Christmas and Boxing Day
      */
     $christmasDay = new Date($this->_year . '-12-25');
     if ($christmasDay->getDayOfWeek() == 0) {
         $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Boxing Day');
         $this->_addHoliday('christmasDay', $this->_year . '-12-27', 'Substitute Bank Holiday in lieu of Christmas Day');
     } elseif ($christmasDay->getDayOfWeek() == 5) {
         $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
         $this->_addHoliday('boxingDay', $this->_year . '-12-28', 'Substitute Bank Holiday in lieu of Boxing Day');
     } elseif ($christmasDay->getDayOfWeek() == 6) {
         $this->_addHoliday('christmasDay', $this->_year . '-12-28', 'Substitute Bank Holiday in lieu of Christmas Day');
         $this->_addHoliday('boxingDay', $this->_year . '-12-27', 'Substitute Bank Holiday in lieu of Boxing Day');
     } else {
         $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
         $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Boxing Day');
     }
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #14
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'it_IT', 'Capodanno');
     /**
      * Epiphany
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     $this->_addTranslationForHoliday('epiphany', 'it_IT', 'Epifania');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Italy::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     $this->_addTranslationForHoliday('easter', 'it_IT', 'Pasqua');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     $this->_addTranslationForHoliday('goodFriday', 'it_IT', 'Venerdi` Santo');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     $this->_addTranslationForHoliday('easterMonday', 'it_IT', 'Lunedi` dell\'Angelo');
     /**
      * Day of Work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'Day of Work');
     $this->_addTranslationForHoliday('dayOfWork', 'it_IT', 'Festa del Lavoro');
     /**
      * Republic Day
      */
     $this->_addHoliday('republicDay', $this->_year . '-06-02', 'Republic Day');
     $this->_addTranslationForHoliday('republicDay', 'it_IT', 'Festa della Repubblica');
     /**
      * End of War Day
      */
     $this->_addHoliday('endofwarDay', $this->_year . '-04-25', 'End of War');
     $this->_addTranslationForHoliday('endofwarDay', 'it_IT', 'Festa della Liberazione');
     /**
      * Ascension of Maria
      */
     $this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Ascension of Maria');
     $this->_addTranslationForHoliday('mariaAscension', 'it_IT', 'Assunzione di Maria Vergine');
     /**
      * Maria' conception
      */
     $this->_addHoliday('mariaConception', $this->_year . '-12-08', 'Conception of Maria');
     $this->_addTranslationForHoliday('mariaConception', 'it_IT', 'Immacolata Concezione');
     /**
      * All Saints' Day
      */
     $this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'All Saints\' Day');
     $this->_addTranslationForHoliday('allSaintsDay', 'it_IT', 'Ognissanti');
     /**
      * All Souls' Day
      */
     $this->_addHoliday('allSoulsDay', $this->_year . '-11-02', 'All Souls\' Day');
     $this->_addTranslationForHoliday('allSoulsDay', 'it_IT', 'Commemorazione dei Defunti');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Christmas Eve');
     $this->_addTranslationForHoliday('christmasEve', 'it_IT', 'Vigilia di Natale');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     $this->_addTranslationForHoliday('christmasDay', 'it_IT', 'Santo Natale');
     /**
      * St. Stephen's Day
      */
     $this->_addHoliday('StStephensDay', $this->_year . '-12-26', 'Saint Stephen\'s Day');
     $this->_addTranslationForHoliday('StStephensDay', 'it_IT', 'Santo Stefano');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'New Year\'s Eve');
     $this->_addTranslationForHoliday('newYearsEve', 'it_IT', 'San Silvestro');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #15
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('novagodina', $this->_year . '-01-01', 'Nova godina');
     /**
      * Sveta tri kralja
      */
     $this->_addHoliday('trikralja', $this->_year . '-01-06', 'Sveta tri kralja');
     /**
      * Easter Sunday
      */
     $easter = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('uskrs', $easter, 'Uskrs');
     /**
      * Easter Monday
      */
     $easterMon = clone $easter;
     $easterMon->day++;
     $this->_addHoliday('uskrspon', $easterMon, 'Uskršnji ponedjeljak');
     /**
      * Praznik rada
      */
     $this->_addHoliday('rada', $this->_year . '-05-01', 'Praznik rada');
     /**
      * Tijelovo
      */
     $easterMon = clone $easter;
     $easterMon->day += 60;
     $this->_addHoliday('Tijelovo', $easterMon, 'Tijelovo');
     /**
      * Dan antifašističke borbe
      */
     $this->_addHoliday('antifasizma', $this->_year . '-06-22', 'Dan antifašističke borbe');
     /**
      * Dan državnosti
      */
     $this->_addHoliday('drzavnosti', $this->_year . '-06-25', 'Dan državnosti');
     /**
      * Dan domovinske zahvalnosti
      */
     $this->_addHoliday('zahvalnosti', $this->_year . '-08-05', 'Dan domovinske zahvalnosti');
     /**
      * Velika Gospa
      */
     $this->_addHoliday('gospa', $this->_year . '-08-15', 'Velika Gospa');
     /**
      * Dan neovisnosti
      */
     $this->_addHoliday('neovisnosti', $this->_year . '-10-08', 'Dan neovisnosti');
     /**
      * Dan svih svetih
      */
     $this->_addHoliday('svisveti', $this->_year . '-11-01', 'Dan svih svetih');
     /**
      * Božić
      */
     $this->_addHoliday('bozic', $this->_year . '-12-25', 'Božić');
     /**
      * Sveti Stjepan
      */
     $this->_addHoliday('svetistjepan', $this->_year . '-12-26', 'Sveti Stjepan');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access protected
  * @return boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'DU_NL', 'Nieuwjaarsdag');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     $this->_addTranslationForHoliday('epiphany', 'DU_NL', 'Drie Koningen');
     /**
      * Valentine's Day
      */
     $this->_addHoliday('valentineDay', $this->_year . '-02-14', 'Valentine\'s Day');
     $this->_addTranslationForHoliday('valentineDay', 'DU_NL', 'Valentijnsdag');
     /**
      * Queen's Day
      */
     $this->_addHoliday('queenDay', $this->_year . '-04-30', 'Queen\'s Day');
     $this->_addTranslationForHoliday('queenDay', 'DU_NL', 'Koninginnedag');
     /**
      * Commemoration Day Day
      */
     $this->_addHoliday('commemorationDay', $this->_year . '-05-04', 'Commemoration Day');
     $this->_addTranslationForHoliday('commemorationDay', 'DU_NL', 'Dodenherdenking');
     /**
      * Liberation Day
      */
     $this->_addHoliday('liberationDay', $this->_year . '-05-05', 'Liberation Day');
     $this->_addTranslationForHoliday('liberationDay', 'DU_NL', 'Bevrijdingsdag');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     $this->_addTranslationForHoliday('easter', 'DU_NL', '1e Paasdag');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     $this->_addTranslationForHoliday('easterMonday', 'DU_NL', '2e Paasdag');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = $this->_addDays($easterDate, 2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     $this->_addTranslationForHoliday('goodFriday', 'DU_NL', 'Goede Vrijdag');
     /**
      * Whitsun (determines Whit Monday, Ascension Day and Feast of
      * Corpus Christi)
      */
     $whitsunDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('whitsun', $whitsunDate, 'Whitsun');
     $this->_addTranslationForHoliday('whitsun', 'DU_NL', '1e Pinksterdag');
     /**
      * Whit Monday
      */
     $this->_addHoliday('whitMonday', $whitsunDate->getNextDay(), 'Whit Monday');
     $this->_addTranslationForHoliday('whitMonday', 'DU_NL', '2e Pinksterdag');
     /**
      * Ascension Day
      */
     $ascensionDayDate = $this->_addDays($whitsunDate, -10);
     $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
     $this->_addTranslationForHoliday('ascensionDay', 'DU_NL', 'Hemelvaartsdag');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     $this->_addTranslationForHoliday('christmasDay', 'DU_NL', '1e Kerstdag');
     /**
      * Second Christmas Day
      */
     $this->_addHoliday('secondChristmasDay', $this->_year . '-12-26', 'Boxing Day');
     $this->_addTranslationForHoliday('secondChristmasDay', 'DU_NL', '2e Kerstdag');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', "New Year's Eve");
     $this->_addTranslationForHoliday('newYearsEve', 'DU_NL', 'Oudjaarsdag');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #17
0
 /**
  * Returns dates of all holidays or those accepted by the applied filter.
  *
  * Structure of the returned array:
  * <pre>
  * array(
  *   'internalNameFoo' => object of type date,
  *   'internalNameBar' => object of type date
  * )
  * </pre>
  *
  * @param Date_Holidays_Filter $filter filter-object (or an array !DEPRECATED!)
  *
  * @access   public
  * @return   array with holidays' dates on success, otherwise a PEAR_Error object
  * @throws   object PEAR_Error   DATE_HOLIDAYS_INVALID_INTERNAL_NAME
  * @uses     getHolidayDate()
  */
 function getHolidayDates($filter = null)
 {
     if (is_null($filter)) {
         $filter = new Date_Holidays_Filter_Blacklist(array());
     } elseif (is_array($filter)) {
         $filter = new Date_Holidays_Filter_Whitelist($filter);
     }
     $dates = array();
     foreach ($this->_internalNames as $internalName) {
         if ($filter->accept($internalName)) {
             $date = $this->getHolidayDate($internalName);
             if (Date_Holidays::isError($date)) {
                 return $date;
             }
             $dates[$internalName] = $this->getHolidayDate($internalName);
         }
     }
     return $dates;
 }
Example #18
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     parent::_buildHolidays();
     $ashWednesdayDate = $this->getHolidayDate('ashWednesday');
     $this->_addTranslationForHoliday('easter', 'pt_BR', 'Páscoa');
     $this->_addTranslationForHoliday('ashWednesday', 'pt_BR', 'Quarta-Feira de Cinzas');
     $this->_addTranslationForHoliday('goodFriday', 'pt_BR', 'Sexta-Feira Santa');
     $this->_addTranslationForHoliday('corpusChristi', 'pt_BR', 'Corpus Christi');
     $this->_addTranslationForHoliday('thanksGiving', 'pt_BR', 'Dia de Ação de Graças');
     $this->_addTranslationForHoliday('allSoulsDay', 'pt_BR', 'Dia de Finados');
     $this->_addTranslationForHoliday('christmasDay', 'pt_BR', 'Natal');
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'pt_BR', 'Ano Novo');
     /**
      * Carnival
      */
     $carnival = new Date($ashWednesdayDate);
     $carnival = $carnival->getPrevDay();
     $this->_addHoliday('carnival', $carnival, 'Carnival');
     $this->_addTranslationForHoliday('carnival', 'pt_BR', 'Carnaval');
     /**
      * International Women's Day
      */
     $this->_addHoliday('womensDay', $this->_year . '-03-08', 'International Women\'s Day');
     $this->_addTranslationForHoliday('womensDay', 'pt_BR', 'Dia Internacional das Mulheres');
     /**
      * Tiradentes
      */
     $this->_addHoliday('tiradentesDay', $this->_year . '-04-21', 'Tiradentes\' Day');
     $this->_addTranslationForHoliday('tiradentesDay', 'pt_BR', 'Dia de Tiradentes');
     /**
      * Labor Day
      */
     $this->_addHoliday('laborDay', $this->_year . '-05-01', 'Labor Day');
     $this->_addTranslationForHoliday('laborDay', 'pt_BR', 'Dia do Trabalho');
     /**
      * Mothers' Day
      */
     $mothersDay = $this->_calcNthWeekDayInMonth(2, 0, 5);
     $this->_addHoliday('mothersDay', $mothersDay, 'Mothers\' Day');
     $this->_addTranslationForHoliday('mothersDay', 'pt_BR', 'Dia das Mães');
     /**
      * Valentine's Day
      */
     $this->_addHoliday('valentinesDay', $this->_year . '-06-12', 'Valentine\'s Day');
     $this->_addTranslationForHoliday('valentinesDay', 'pt_BR', 'Dia dos Namorados');
     /**
      * Fathers' Day
      */
     $fathersDay = $this->_calcNthWeekDayInMonth(2, 0, 8);
     $this->_addHoliday('fathersDay', $fathersDay, 'Fathers\' Day');
     $this->_addTranslationForHoliday('fathersDay', 'pt_BR', 'Dia dos Pais');
     /**
      * Independence Day
      */
     $this->_addHoliday('independenceDay', $this->_year . '-09-07', 'Independece Day');
     $this->_addTranslationForHoliday('independenceDay', 'pt_BR', 'Dia da Independência');
     /**
      * Aparecida
      */
     $this->_addHoliday('aparecidaDay', $this->_year . '-10-12', 'Our Lady of Aparecida Day');
     $this->_addTranslationForHoliday('aparecidaDay', 'pt_BR', 'Dia de Nossa Senhora de Aparecida');
     /**
      * Children' Day
      */
     $this->_addHoliday('childrenDay', $this->_year . '-10-12', 'Children\'s Day');
     $this->_addTranslationForHoliday('childrenDay', 'pt_BR', 'Dia das Crianças');
     /**
      * Proclamation of the Republic
      */
     $this->_addHoliday('republicDay', $this->_year . '-11-15', 'Proclamation of the Republic');
     $this->_addTranslationForHoliday('republicDay', 'pt_BR', 'Proclamação da República');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 public static function getHolidayTitle($date = 0, $userid = 0)
 {
     global $AppUI;
     self::loadHolidaysSettings();
     if (!$date) {
         $date = new w2p_Utilities_Date();
     }
     if (self::$holiday_manual) {
         $q = new w2p_Database_Query();
         // Check if we have a whitelist item for this date
         $q->addTable("holiday");
         $q->addQuery("holiday_description");
         $where = "( date(holiday_start_date) <= '";
         $where .= $date->format('%Y-%m-%d');
         $where .= "' AND date(holiday_end_date) >= '";
         $where .= $date->format('%Y-%m-%d');
         if ($userid > 0) {
             $where .= "' AND (";
             $where .= "(holiday_user=0 AND holiday_type=" . HOLIDAY_TYPE_COMPANY_HOLIDAY . ")";
             $where .= " OR ";
             $where .= "(holiday_user="******" AND holiday_type=" . HOLIDAY_TYPE_USER_HOLIDAY . ")";
             $where .= ")";
         } else {
             $where .= "' AND holiday_type=" . HOLIDAY_TYPE_COMPANY_HOLIDAY;
         }
         $where .= " ) OR ( ";
         $where .= " DATE_FORMAT(holiday_start_date, '%m-%d') <= '";
         $where .= $date->format('%m-%d');
         $where .= "' AND DATE_FORMAT(holiday_end_date, '%m-%d') >= '";
         $where .= $date->format('%m-%d');
         $where .= "' AND holiday_annual=1";
         $where .= " AND holiday_type=" . HOLIDAY_TYPE_COMPANY_HOLIDAY . " )";
         $q->addWhere($where);
         $holiday_description = $q->loadResult();
         if ($holiday_description !== false) {
             return $holiday_description;
         }
     }
     if (self::$holiday_auto && self::$holiday_driver >= 0) {
         // Still here? Ok, lets poll the automatic system
         if (self::$holiday_driver_instance->getYear() != $date->getYear()) {
             self::$holiday_driver_instance->setYear($date->getYear());
             self::$holiday_driver_instance->setLocale($AppUI->user_locale);
         }
         if (!Date_Holidays::isError(self::$holiday_driver_instance)) {
             $holidays = self::$holiday_driver_instance->getHolidayForDate($date, null, true);
             if (!is_null($holidays)) {
                 $titles = array();
                 foreach ($holidays as $holiday) {
                     if (is_null(self::$holiday_filter_instance) || self::$holiday_filter_instance->accept($holiday->getInternalName())) {
                         $title = $holiday->getTitle();
                         if (!in_array($title, $titles)) {
                             $titles[] = gettype($title) == 'object' ? $title->getMessage() : $title;
                         }
                     }
                 }
                 return implode("/", $titles);
             }
         }
     }
     return "";
 }
Example #20
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * Circumcision of Jesus
      */
     $this->_addHoliday('jesusCircumcision', $this->_year . '-01-01', 'Circumcision of Jesus');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Epiphany');
     /**
      * Cleaning of Mariä 
      */
     $this->_addHoliday('mariaCleaning', $this->_year . '-02-02', 'Cleaning of Maria');
     /**
      * Josef's Day
      */
     $this->_addHoliday('josefsDay', $this->_year . '-03-19', 'Josef\'s Day');
     /**
      * Maria Announcement
      */
     $this->_addHoliday('mariaAnnouncement', $this->_year . '-03-25', 'Maria Announcement');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     /**
      * Palm Sunday
      */
     $palmSundayDate = new Date($easterDate);
     $palmSundayDate->subtractSpan(new Date_Span('7, 0, 0, 0'));
     $this->_addHoliday('palmSunday', $palmSundayDate, 'Palm Sunday');
     /**
      * Passion Sunday
      */
     $passionSundayDate = new Date($palmSundayDate);
     $passionSundayDate->subtractSpan(new Date_Span('7, 0, 0, 0'));
     $this->_addHoliday('passionSunday', $passionSundayDate, 'Passion Sunday');
     /**
      * Painful Friday
      */
     $painfulFridayDate = new Date($palmSundayDate);
     $painfulFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
     $this->_addHoliday('painfulFriday', $painfulFridayDate, 'Painful Friday');
     /**
      * White Sunday
      */
     $whiteSundayDate = new Date($easterDate);
     $whiteSundayDate->addSpan(new Date_Span('7, 0, 0, 0'));
     $this->_addHoliday('whiteSunday', $whiteSundayDate, 'White Sunday');
     /**
      * Ash Wednesday
      */
     $ashWednesdayDate = new Date($easterDate);
     $ashWednesdayDate->subtractSpan(new Date_Span('46, 0, 0, 0'));
     $this->_addHoliday('ashWednesday', $ashWednesdayDate, 'Ash Wednesday');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = new Date($easterDate);
     $goodFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     /**
      * Green Thursday
      */
     $this->_addHoliday('greenThursday', $goodFridayDate->getPrevDay(), 'Green Thursday');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     /**
      * Whitsun (determines Whit Monday, Ascension Day and Feast of Corpus Christi)
      */
     $whitsunDate = new Date($easterDate);
     $whitsunDate->addSpan(new Date_Span('49, 0, 0, 0'));
     $this->_addHoliday('whitsun', $whitsunDate, 'Whitsun');
     /**
      * Request Sunday
      */
     $requestSunday = new Date($whitsunDate);
     $requestSunday->subtractSpan(new Date_Span('14, 0, 0, 0'));
     $this->_addHoliday('requestSunday', $requestSunday, 'Request Sunday');
     /**
      * Ascension Day
      */
     $ascensionDayDate = new Date($whitsunDate);
     $ascensionDayDate->subtractSpan(new Date_Span('10, 0, 0, 0'));
     $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
     /**
      * Whit Monday
      */
     $this->_addHoliday('whitMonday', $whitsunDate->getNextDay(), 'Whit Monday');
     /**
      * Haunting of Mariä 
      */
     $this->_addHoliday('mariaHaunting', $this->_year . '-05-31', 'Haunting of Maria');
     /**
      * Trinitatis
      */
     $trinitatisDate = new Date($whitsunDate);
     $trinitatisDate->addSpan(new Date_Span('7, 0, 0, 0'));
     $this->_addHoliday('trinitatis', $trinitatisDate, 'Trinitatis');
     /**
      * Feast of Corpus Christi
      */
     $corpusChristiDate = new Date($whitsunDate);
     $corpusChristiDate->addSpan(new Date_Span('11, 0, 0, 0'));
     $this->_addHoliday('corpusChristi', $corpusChristiDate, 'Feast of Corpus Christi');
     /**
      * Heart of Jesus 
      *
      * Friday of the 3rd week past Whitsun
      */
     $heartJesusDate = new Date($whitsunDate);
     $heartJesusDate->addSpan(new Date_Span('19, 0, 0, 0'));
     $this->_addHoliday('heartJesus', $heartJesusDate, 'Heart of Jesus celebration');
     /**
      * Johannis celebration
      */
     $this->_addHoliday('johannisCelebration', $this->_year . '-06-24', 'Johannis celebration');
     /**
      * Petrus and Paulus
      */
     $this->_addHoliday('petrusAndPaulus', $this->_year . '-06-29', 'Petrus and Paulus');
     /**
      * Ascension of Maria
      */
     $this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Ascension of Maria');
     /**
      * Celebration of raising the Cross
      */
     $this->_addHoliday('crossRaising', $this->_year . '-09-14', 'Celebration of raising the Cross');
     /**
      * Thanks Giving
      * 
      * Sunday past Michaelis (29. September)
      */
     $michaelisDate = new Date($this->_year . '-09-29');
     $dayOfWeek = $michaelisDate->getDayOfWeek();
     $michaelisDate->addSpan(new Date_Span(sprintf('%d, 0, 0, 0', 7 - $dayOfWeek)));
     $thanksGivingDate = $michaelisDate;
     $this->_addHoliday('thanksGiving', $thanksGivingDate, 'Thanks Giving');
     /**
      * Kermis
      *
      * 3rd Sunday in October
      */
     $kermisDate = new Date($this->_year . '-10-01');
     $dayOfWeek = $kermisDate->getDayOfWeek();
     if ($dayOfWeek != 0) {
         $kermisDate->addSpan(new Date_Span(sprintf('%d, 0, 0, 0', 7 - $dayOfWeek)));
     }
     $kermisDate->addSpan(new Date_Span('14, 0, 0, 0'));
     $this->_addHoliday('kermis', $kermisDate, 'Kermis');
     /**
      * Reformation Day
      */
     $this->_addHoliday('reformationDay', $this->_year . '-10-31', 'Reformation Day');
     /**
      * All Saints' Day
      */
     $this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'All Saints\' Day');
     /**
      * All Souls' Day
      */
     $this->_addHoliday('allSoulsDay', $this->_year . '-11-02', 'All Souls\' Day');
     /**
      * Martin's Day
      */
     $this->_addHoliday('martinsDay', $this->_year . '-11-11', 'Martin\'s Day');
     /**
      * 4th Advent
      */
     $Advent4Date = new Date($this->_year . '-12-24');
     $dayOfWeek = $Advent4Date->getDayOfWeek();
     if ($dayOfWeek == 0) {
         $dayOfWeek = 7;
     }
     $Advent4Date->subtractSpan(new Date_Span(sprintf('%d, 0, 0, 0', $dayOfWeek)));
     $this->_addHoliday('advent4', $Advent4Date, '4th Advent');
     /**
      * 1st Advent
      */
     $Advent1Date = new Date($Advent4Date);
     $Advent1Date->subtractSpan(new Date_Span('21, 0, 0, 0'));
     $this->_addHoliday('advent1', $Advent1Date, '1st Advent');
     /**
      * 2nd Advent
      */
     $Advent2Date = new Date($Advent4Date);
     $Advent2Date->subtractSpan(new Date_Span('14, 0, 0, 0'));
     $this->_addHoliday('advent2', $Advent2Date, '2nd Advent');
     /**
      * 3rd Advent
      */
     $Advent3Date = new Date($Advent4Date);
     $Advent3Date->subtractSpan(new Date_Span('7, 0, 0, 0'));
     $this->_addHoliday('advent3', $Advent3Date, '3rd Advent');
     /**
      * Death' Sunday
      */
     $deathSundayDate = new Date($Advent1Date);
     $deathSundayDate->subtractSpan(new Date_Span('7, 0, 0, 0'));
     $this->_addHoliday('deathSunday', $deathSundayDate, 'Death\' Sunday');
     /**
      * Day of Repentance
      */
     $dayOfRepentance = new Date($deathSundayDate);
     $dayOfRepentance->subtractSpan(new Date_Span('4, 0, 0, 0'));
     $this->_addHoliday('dayOfRepentance', $dayOfRepentance, 'Day of Repentance');
     /**
      * St. Nicholas' Day
      */
     $this->_addHoliday('stNicholasDay', $this->_year . '-12-06', 'St. Nicholas\' Day');
     /**
      * Maria' conception
      */
     $this->_addHoliday('mariaConception', $this->_year . '-12-08', 'Conception of Maria');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('xmasEve', $this->_year . '-12-24', 'Christmas Eve');
     /**
      * Christmas day
      */
     $this->_addHoliday('xmasDay', $this->_year . '-12-25', 'Christmas Day');
     /**
      * Boxing day
      */
     $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Boxing Day');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'New Year\'s Eve');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #21
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * World's leprosy day
      */
     $this->_addHoliday('leprosyDay', $this->_year . '-01-28', 'World\'s leprosy day');
     /**
      * International day of the native tongue
      */
     $this->_addHoliday('nativeTongueDay', $this->_year . '-02-21', 'International Day of the native tongue');
     /**
      * International Women's Day
      */
     $this->_addHoliday('womensDay', $this->_year . '-03-08', 'International Women\'s Day');
     /**
      * International World Consumers' Day
      */
     $this->_addHoliday('worldConsumersDay', $this->_year . '-03-15', 'International World Consumers\' Day');
     /**
      * International day of the forest
      */
     $this->_addHoliday('intForestDay', $this->_year . '-03-21', 'International day of the forest');
     /**
      * International day of beating racism
      */
     $this->_addHoliday('intDayBeatingRacism', $this->_year . '-03-21', 'International day of beating racism');
     /**
      * Day of poesy
      */
     $this->_addHoliday('dayOfPoesy', $this->_year . '-03-21', 'Day of poesy');
     /**
      * Day of water
      */
     $this->_addHoliday('dayOfWater', $this->_year . '-03-22', 'Day of water');
     /**
      * World's meteorology day
      */
     $this->_addHoliday('meteorologyDay', $this->_year . '-03-23', 'World\'s meteorology day');
     /**
      * World's tuberculosis day
      */
     $this->_addHoliday('tuberculosisDay', $this->_year . '-03-24', 'World\'s tuberculosis day');
     /**
      * World's Health Day
      */
     $this->_addHoliday('worldsHealthDay', $this->_year . '-04-07', 'World\'s Health Day');
     /**
      * Book and Copyright's Day
      */
     $this->_addHoliday('bookAndCopyrightDay', $this->_year . '-04-23', 'Book and Copyright\'s Day');
     /**
      * Tree's Day
      */
     $this->_addHoliday('treesDay', $this->_year . '-04-25', 'Tree\'s Day');
     /**
      * World's day of intellectual property
      */
     $this->_addHoliday('intellectualPropertyDay', $this->_year . '-04-26', 'World\'s day of intellectual property');
     /**
      * International day of work
      */
     $this->_addHoliday('intDayOfWork', $this->_year . '-05-01', 'International day of work');
     /**
      * International day for freedom of the press
      */
     $this->_addHoliday('freedomOfPressDay', $this->_year . '-05-03', 'International day for freedom of the press');
     /**
      * Day of the sun
      */
     $this->_addHoliday('dayOfTheSun', $this->_year . '-05-03', 'Day of the sun');
     /**
      * International Family's Day
      */
     $this->_addHoliday('intFamilyDay', $this->_year . '-05-15', 'International Family\'s Day');
     /**
      * World's Telecommunications Day
      */
     $this->_addHoliday('telecommunicationsDay', $this->_year . '-05-17', 'World\'s Telecommunications Day');
     /**
      * International day of cultural development
      */
     $this->_addHoliday('culturalDevelopmentDay', $this->_year . '-05-21', 'International day of cultural development');
     /**
      * International day of biological diversity
      */
     if ($this->_year >= 2001) {
         $this->_addHoliday('biologicalDiversityDay', $this->_year . '-05-22', 'International day of biological diversity');
     } else {
         $this->_addHoliday('biologicalDiversityDay', $this->_year . '-12-29', 'International day of biological diversity');
     }
     /**
      * African Liberation Day
      */
     $this->_addHoliday('africanLiberationDay', $this->_year . '-05-25', 'African Liberation Day');
     /**
      * International UN Peace Squads' Day
      */
     $this->_addHoliday('unPeaceSquadsDay', $this->_year . '-05-29', 'International UN Peace Squads\' Day');
     /**
      * World's Nonsmokers' Day
      */
     $this->_addHoliday('nonsmokersDay', $this->_year . '-05-31', 'World\'s Nonsmokers\' Day');
     /**
      * World's Agriculturalists' Day
      */
     $this->_addHoliday('farmersDay', $this->_year . '-06-01', 'World\'s Agriculturalists\' Day');
     /**
      * World's Environment Day
      */
     $this->_addHoliday('environmentDay', $this->_year . '-06-05', 'World\'s Environment Day');
     /**
      * African Children's Day
      */
     $this->_addHoliday('africanChildrenDay', $this->_year . '-06-16', 'African Children\'s Day');
     /**
      * World's Desert's Day
      */
     $this->_addHoliday('desertDay', $this->_year . '-06-17', 'World\'s Desert\'s Day');
     /**
      * African Fugitives' Day
      */
     $this->_addHoliday('africanFugitiveDay', $this->_year . '-06-20', 'African Fugitives\' Day');
     /**
      * International day against drugs
      */
     $this->_addHoliday('antiDrugsDay', $this->_year . '-06-26', 'International day against drugs');
     /**
      * International Cooperative Societies' Day
      */
     $coopDayDate = new Date($this->_year . '-07-01');
     while ($coopDayDate->getDayOfWeek() != 6) {
         $coopDayDate = $coopDayDate->getNextDay();
     }
     $this->_addHoliday('intCoopDay', $coopDayDate, 'International Cooperative Societies\' Day');
     /**
      * World's Population Day
      */
     $this->_addHoliday('populationDay', $this->_year . '-07-11', 'World\'s Population Day');
     /**
      * International day of indigenous people
      */
     $this->_addHoliday('indigenousPeopleDay', $this->_year . '-08-09', 'International day of indigenous people');
     /**
      * International Youth' Day
      */
     $this->_addHoliday('intYouthDay', $this->_year . '-08-12', 'International Youth\' Day');
     /**
      * International day of slave trade's abolishment
      */
     $this->_addHoliday('slaveTradeDay', $this->_year . '-08-23', 'International day of slave trade\'s abolishment');
     /**
      * World's Alphabetization Day
      */
     $this->_addHoliday('alphabetizationDay', $this->_year . '-09-08', 'World\'s Alphabetization Day');
     /**
      * Ozone Layer's Protection Day
      */
     $this->_addHoliday('ozoneLayerProtectionDay', $this->_year . '-09-16', 'Ozone Layer\'s Protection Day');
     /**
      * International day of peace
      */
     $peaceDayDate = new Date($this->_year . '-09-01');
     while ($peaceDayDate->getDayOfWeek() != 2) {
         $peaceDayDate = $peaceDayDate->getNextDay();
     }
     $peaceDayDate->addSpan(new Date_Span('14, 0, 0, 0'));
     $this->_addHoliday('intPeaceDay', $peaceDayDate, 'International day of peace');
     /**
      * World's day of tourism
      */
     $this->_addHoliday('tourismDay', $this->_year . '-09-27', 'World\'s day of tourism');
     /**
      * International fugitives' day
      */
     $this->_addHoliday('intFugitiveDay', $this->_year . '-09-28', 'International fugitives\' day');
     /**
      * International aged people's day
      */
     $this->_addHoliday('agedPeopleDay', $this->_year . '-10-01', 'International aged people\'s day');
     /**
      * World's day for prevention of cruelty to animals
      */
     $this->_addHoliday('animalsDay', $this->_year . '-10-04', 'World\'s day for prevention of cruelty to animals');
     /**
      * Beginning of the International Outer Space Week
      */
     $this->_addHoliday('outerSpaceWeek', $this->_year . '-10-04', 'Beginning of the International Outer Space Week');
     /**
      * World's Habitat Day
      */
     $habitatDayDate = new Date($this->_year . '-10-01');
     while ($habitatDayDate->getDayOfWeek() != 1) {
         $habitatDayDate = $habitatDayDate->getNextDay();
     }
     $this->_addHoliday('habitatDay', $coopDayDate, 'World\'s Habitat Day');
     /**
      * International Teachers' Day
      */
     $this->_addHoliday('teachersDay', $this->_year . '-10-05', 'International Teachers\' Day');
     /**
      * World Post Association's Day
      */
     $this->_addHoliday('postAssociationDay', $this->_year . '-10-09', 'World Post Association\'s Day');
     /**
      * World's Sanity Day
      */
     $this->_addHoliday('sanityDay', $this->_year . '-10-10', 'World\'s Sanity Day');
     /**
      * World's Nourishment Day
      */
     $this->_addHoliday('nourishmentDay', $this->_year . '-10-16', 'World\'s Nourishment Day');
     /**
      * International day for removal of poverty
      */
     $this->_addHoliday('povertyRemovalDay', $this->_year . '-10-17', 'International day for removal of poverty');
     /**
      * United Nations' Day
      */
     $this->_addHoliday('unitedNationsDay', $this->_year . '-10-24', 'United Nations\' Day');
     /**
      * World's day of information about evolvement
      */
     $this->_addHoliday('evolvementInfoDay', $this->_year . '-10-24', 'World\'s day of information about evolvement');
     /**
      * Beginning of the Disarmament Week
      */
     $this->_addHoliday('evolvementInfoDay', $this->_year . '-10-24', 'Beginning of the Disarmament Week');
     /**
      * International day against environmental exploitation in wartime
      */
     $this->_addHoliday('environmentalExploitationDay', $this->_year . '-11-06', 'International day against environmental exploitation in wartime');
     /**
      * International day of tolerance
      */
     $this->_addHoliday('toleranceDay', $this->_year . '-11-16', 'International day of tolerance');
     /**
      * African Industrialization Day
      */
     $this->_addHoliday('africanIndustrializationDay', $this->_year . '-11-20', 'African Industrialization Day');
     /**
      * World's Children's Day
      */
     $this->_addHoliday('worldChildrenDay', $this->_year . '-11-20', 'World\'s Children\'s Day');
     /**
      * World's Television Day
      */
     $this->_addHoliday('televisionDay', $this->_year . '-11-21', 'World\'s Television Day');
     /**
      * International day for removal of violence against women
      */
     $this->_addHoliday('noViolenceAgainstWomen', $this->_year . '-11-25', 'International day for removal of violence against women');
     /**
      * International day of solidarity with Palestinian people
      */
     $this->_addHoliday('palestinianSolidarity', $this->_year . '-11-29', 'International day of solidarity with Palestinian people');
     /**
      * World AIDS Day
      */
     $this->_addHoliday('worldAidsDay', $this->_year . '-12-01', 'World AIDS Day');
     /**
      * International day for abolishment of slavery
      */
     $this->_addHoliday('againstSlaveryDay', $this->_year . '-12-01', 'International day for abolishment of slavery');
     /**
      * International day for disabled people
      */
     $this->_addHoliday('disabledPeopleDay', $this->_year . '-12-03', 'International day for disabled people');
     /**
      * International evolvement helpers' day
      */
     $this->_addHoliday('evolvementHelperDay', $this->_year . '-12-05', 'International evolvement helpers\' day');
     /**
      * International day of civil aeronautics
      */
     $this->_addHoliday('civilAeronauticsDay', $this->_year . '-12-07', 'International day of civil aeronautics');
     /**
      * International day of human rights
      */
     $this->_addHoliday('humanRightsDay', $this->_year . '-12-10', 'International day of human rights');
     /**
      * UNICEF Day
      */
     $this->_addHoliday('unicefDay', $this->_year . '-12-11', 'UNICEF Day');
     /**
      * International migrants' day
      */
     $this->_addHoliday('migrantsDay', $this->_year . '-12-18', 'International migrants\' day');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #22
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Norway::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     /**
      * Good Friday / Black Friday
      */
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     /**
      * May Day
      */
     $this->_addHoliday('mayDay', $this->_year . '-05-01', 'May Day');
     /**
      * Pentecost (determines Whit Monday, Ascension Day and Feast of
      * Corpus Christi)
      */
     $pentecostDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('pentecost', $pentecostDate, 'Pentecost');
     /**
      * Ascension Day
      */
     $ascensionDayDate = $this->_addDays($pentecostDate, -10);
     $this->_addHoliday('ascensionDay', $ascensionDayDate, 'Ascension Day');
     /**
      * Norwegian National Day
      */
     $this->_addHoliday('norwayNationalDay', $this->_year . '-05-17', 'Norwegian National Day');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Christmas Eve');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christmas Day');
     /**
      * Boxing day
      */
     $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Boxing Day');
     /**
      * New Year's Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'New Year\'s Eve');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #23
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'Ano Novo');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Dia de Reis');
     /**
      * Valentine Day
      */
     $this->_addHoliday('valentinesDay', $this->_year . '-02-14', 'Dia dos Namorados');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Páscoa');
     /**
      * Carnival
      */
     $carnival = $this->_addDays($easterDate, -47);
     $this->_addHoliday('carnival', $carnival, 'Carnaval');
     /**
      * Ash Wednesday
      */
     $ashWednesday = $this->_addDays($easterDate, -46);
     $this->_addHoliday('ashWednesday', $ashWednesday, 'Quarta-feira de Cinzas');
     /**
      * Palm Sunday
      */
     $palmSunday = $this->_addDays($easterDate, -7);
     $this->_addHoliday('palmSunday', $palmSunday, 'Dia de Ramos');
     /**
      * Maundy Thursday
      */
     $maundyThursday = $this->_addDays($easterDate, -3);
     $this->_addHoliday('maundyThursday', $maundyThursday, 'Quinta-feira Santa');
     /**
      * Good Friday
      */
     $goodFriday = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFriday, 'Sexta-feira Santa');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Segunda de Páscoa');
     /**
      * Fathers Day
      */
     $this->_addHoliday('fathersDay', $this->_year . '-03-19', 'Dia do Pai');
     /**
      * Liberty Day (In 25 April 1974 - Revolution of the Carnations)
      */
     $this->_addHoliday('libertyDayPortugal', $this->_year . '-04-25', 'Dia da Liberdade');
     /**
      * Day of Work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'Dia do Trabalhador');
     /**
      * Portugal National Day
      * (In 1580 - Day of the death of Luís Vaz de Camões poet)
      */
     $this->_addHoliday('nationalDayPortugal', $this->_year . '-06-10', 'Dia de Portugal');
     /**
      * Mothers Day
      */
     $mothersDay = $this->_calcFirstMonday("05");
     $mothersDay = $mothersDay->getPrevDay();
     $mothersDay = $this->_addDays($mothersDay, 7);
     $this->_addHoliday('mothersDay', $mothersDay, 'Dia da Mãe');
     /**
      * Ascension Day
      */
     $ascensionDate = $this->_addDays($easterDate, 39);
     $this->_addHoliday('ascensionDate', $ascensionDate, 'Dia da Ascensão');
     /**
      * Whitsun (determines Whit Monday, Ascension Day and
      * Feast of Corpus Christi)
      */
     $whitsunDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('whitsun', $whitsunDate, 'Pentecostes');
     /**
      * Whit Monday
      */
     $this->_addHoliday('whitMonday', $whitsunDate->getNextDay(), 'Segunta-feira de Pentecostes');
     /**
      * Corpus Christi
      */
     $corpusChristi = $this->_addDays($easterDate, 60);
     $this->_addHoliday('corpusChristi', $corpusChristi, 'Corpo de Deus');
     /**
      * Ascension of Maria
      */
     $this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Assunção de Maria');
     /**
      * Republic Day (In 1910 - End of Monarchy)
      */
     $this->_addHoliday('republicDayPortugal', $this->_year . '-10-05', 'Implantação da República');
     /**
      * All Saints' Day
      */
     $this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'Todos os Santos');
     /**
      * All Souls Day TODO
      */
     $this->_addHoliday('allSoulsDay', $this->_year . '-11-02', 'Allerseelen');
     /**
      * Portugal independence day (In 1640)
      */
     $this->_addHoliday('independenceOfPortugal', $this->_year . '-12-01', 'Restauração da Independência');
     /**
      * Santa Claus
      */
     $this->_addHoliday('santasDay', $this->_year . '-12-06', 'Dia de S. Nicolau');
     /**
      * Immaculate Conception
      */
     $this->_addHoliday('immaculateConceptionDay', $this->_year . '-12-08', 'Imaculada Conceição');
     /**
      * Sunday in commemoration of the dead (sundayIcotd) TODO
      */
     $sundayIcotd = $this->_calcFirstMonday(12);
     $sundayIcotd = $this->_addDays($this->_calcFirstMonday(12), -8);
     $this->_addHoliday('sundayIcotd', $sundayIcotd, 'Totensonntag');
     /**
      * 1. Advent
      */
     $firstAdv = $this->_calcFirstMonday(12);
     $firstAdv = $firstAdv->getPrevDay();
     $this->_addHoliday('firstAdvent', $firstAdv, '1. Advento');
     /**
      * 2. Advent
      */
     $secondAdv = $this->_addDays($firstAdv, 7);
     $this->_addHoliday('secondAdvent', $secondAdv, '2. Advento');
     /**
      * 3. Advent
      */
     $thirdAdv = $this->_addDays($firstAdv, 14);
     $this->_addHoliday('thirdAdvent', $thirdAdv, '3. Advento');
     /**
      * 4. Advent
      */
     $fourthAdv = $this->_addDays($firstAdv, 21);
     $this->_addHoliday('fourthAdvent', $fourthAdv, '4. Advento');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Consoada');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Natal');
     /**
      * New Year´s Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'Véspera de Ano Novo');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 /**
  * Build the internal arrays that contain data about holidays.
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     parent::_buildHolidays();
     /**
      * Method that returns the date of the nearest Monday to the specified date
      * 
      * @return Monday date closest to specified date
      * 
      */
     /**
      * New Year's Day and Day after New Year's Day
      * always observed on a working day (1..5)
      * always show New Year's Day regardless of day of week
      */
     $newYearsDay = new Date($this->_year . '-01-01');
     $dayAfterNewYearsDay = new Date($this->_year . '-01-02');
     $this->_addHoliday('newYearsDay', $newYearsDay, 'New Year\'s Day');
     if ($newYearsDay->getDayOfWeek() == 0) {
         $this->_addHoliday('dayAfterNewYearsDay', $this->_year . '-01-02', 'Day after New Year\'s Day');
         $this->_addHoliday('newYearsDayHoliday', $this->_year . '-01-03', 'New Year\'s Holiday');
     } elseif ($newYearsDay->getDayOfWeek() == 5) {
         $this->_addHoliday('dayAfterNewYearsDay', $this->_year . '-01-04', 'New Year\'s Holiday');
     } elseif ($newYearsDay->getDayOfWeek() == 6) {
         $this->_addHoliday('newYearsDayHoliday', $this->_year . '-01-03', 'New Year\'s Holiday');
         $this->_addHoliday('dayAfterNewYearsDay', $this->_year . '-01-04', 'New Year\'s Holiday');
     } else {
         $this->_addHoliday('dayAfterNewYearsDay', $dayAfterNewYearsDay, 'Day after New Year\'s Day');
     }
     /**
      * Waitangi Day
      * always observed on 6 February
      */
     $waitangiDay = new Date($this->_year . '-02-06');
     $this->_addHoliday('waitangiDay', $waitangiDay, 'Waitangi Day');
     /**
      * Easter
      */
     $easter = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $goodFridayDate = new Date($easter);
     $goodFridayDate = $this->_addDays($easter, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     $this->_addHoliday('easterMonday', $easter->getNextDay(), 'Easter Monday');
     /**
      * Anzac Day
      * always observed on 25 April
      * differs from Australia in that there is no working day lost if Anzac Day falls on a weekend
      */
     $anzacDay = new Date($this->_year . '-04-25');
     $this->_addHoliday('anzacDay', $anzacDay, 'Anzac Day');
     /**
      * The Queen's Birthday.
      * always observed on 1st Monday in June
      */
     $queensBirthday = Date_Calc::NWeekdayOfMonth(1, 1, 6, $this->_year);
     $this->_addHoliday('queensBirthday', $queensBirthday, "Queen\\'s Birthday");
     /**
      * Labour Day.
      * observed as 4th Monday in October
      */
     $labourDay = Date_Calc::NWeekdayOfMonth(4, 1, 10, $this->_year);
     $this->_addHoliday('labourDay', $labourDay, "Labour Day");
     /**
      * Christmas and Boxing days
      * always observed on a working day (1..5)
      * always show Christmas and Boxing days
      */
     $christmasDay = new Date($this->_year . '-12-25');
     $boxingDay = new Date($this->_year . '-12-26');
     $this->_addHoliday('christmasDay', $christmasDay, 'Christmas Day');
     $this->_addHoliday('boxingDay', $boxingDay, 'Boxing Day');
     if ($christmasDay->getDayOfWeek() == 0) {
         $this->_addHoliday('christmasDayHoliday', $this->_year . '-12-27', 'Christmas Day Holiday');
     } elseif ($christmasDay->getDayOfWeek() == 5) {
         $this->_addHoliday('boxingDayHoliday', $this->_year . '-12-28', 'Boxing Day Holiday');
     } elseif ($christmasDay->getDayOfWeek() == 6) {
         $this->_addHoliday('christmasDayHoliday', $this->_year . '-12-27', 'Christmas Day Holiday');
         $this->_addHoliday('boxingDayHoliday', $this->_year . '-12-28', 'Boxing Day Holiday');
     }
     /**
      * Regional anniversary calculations
      * http://www.dol.govt.nz/er/holidaysandleave/publicholidays/publicholidaydates/current.asp
      * ordered by date of observation
      * Note - where rule may be modified by proximity of Easter, this is NOT taken into account
      * 
      * Each of 8 regions can use common rule of nearest Monday
      * Southland 17 Jan
      * Wellington 22 Jan
      * Auckland 29 Jan
      * Nelson 1 Feb
      * Otago 23 Mar (some local variation)
      * Marlborough 1 Nov
      * Chatam Islands 30 Nov
      * Westland 1 Dec (some local variation)
      */
     $anniversaryDaySd = new Date($this->_year . '-01-17');
     $this->_addHoliday('anniversaryDaySd', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDaySd), "Southland Anniversary Day");
     $anniversaryDayWn = new Date($this->_year . '-01-22');
     $this->_addHoliday('anniversaryDayWn', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayWn), "Wellington Anniversary Day");
     $anniversaryDayAk = new Date($this->_year . '-01-29');
     $this->_addHoliday('anniversaryDayAk', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayAk), "Auckland Anniversary Day");
     $anniversaryDayNn = new Date($this->_year . '-02-01');
     $this->_addHoliday('anniversaryDayNn', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayNn), "Nelson Anniversary Day");
     $anniversaryDayOo = new Date($this->_year . '-03-23');
     $this->_addHoliday('anniversaryDayOo', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayOo), "Otago Anniversary Day");
     $anniversaryDayMb = new Date($this->_year . '-11-01');
     $this->_addHoliday('anniversaryDayMb', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayMb), "Marlborough Anniversary Day");
     $anniversaryDayCi = new Date($this->_year . '-11-30');
     $this->_addHoliday('anniversaryDayCi', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayCi), "Chatam Islands Anniversary Day");
     $anniversaryDayWd = new Date($this->_year . '-12-01');
     $this->_addHoliday('anniversaryDayWd', Date_Holidays_Driver_NewZealand::nearestMonday($anniversaryDayWd), "Westland Anniversary Day");
     /**
      * Taranaki Anniversary.
      * 2nd Monday in March.
      */
     $anniversaryDayTk = Date_Calc::nWeekdayOfMonth(2, 1, 3, $this->_year);
     $this->_addHoliday('anniversaryDayTk', $anniversaryDayTk, "Taranaki Anniversary Day");
     /**
      * South Canterbury Anniversary.
      * 4th Monday in September.
      */
     $anniversaryDaySc = Date_Calc::nWeekdayOfMonth(4, 1, 9, $this->_year);
     $this->_addHoliday('anniversaryDaySc', $anniversaryDaySc, "South Canterbury Anniversary Day");
     /**
      * Hawkes' Bay Anniversary.
      * Friday before Labour Day (or 3rd Friday in October).
      *
      */
     $anniversaryDayHb = Date_Calc::nWeekdayOfMonth(3, 5, 10, $this->_year);
     $this->_addHoliday('anniversaryDayHb', $anniversaryDayHb, "Hawkes\\' Bay Anniversary");
     /**
      * Canterbury Anniversary or Show Day for North and Central Canterbury.
      * 2nd Friday after 1st Tuesday in month of November.
      * find 1st Tuesday then add 10 days
      */
     $anniversaryDayNc = $this->_calcNthWeekDayInMonth(1, 2, 11);
     $anniversaryDayNc = $this->_addDays($anniversaryDayNc, 10);
     $this->_addHoliday('anniversaryDayNc', $anniversaryDayNc, "Canterbury Anniversary Day");
     /**
      * Check for errors, and return.
      */
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #25
0
 private function _getEvents($dh, $startDate, $endDate)
 {
     $events = array();
     for ($date = new Horde_Date($startDate); $date->compareDate($endDate) <= 0; $date->mday++) {
         $holidays = $dh->getHolidayForDate($date->format('Y-m-d'), null, true);
         if (Date_Holidays::isError($holidays)) {
             Horde::log(sprintf('Unable to retrieve list of holidays from %s to %s', (string) $startDate, (string) $endDate), __FILE__, __LINE__);
             continue;
         }
         if (is_null($holidays)) {
             continue;
         }
         foreach ($holidays as $holiday) {
             $event = new Kronolith_Event_Holidays($this, $holiday);
             $events[] = $event;
         }
     }
     return $events;
 }
Example #26
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     parent::_buildHolidays();
     $easterDate = $this->getHolidayDate('easter');
     $ashWednesdayDate = $this->getHolidayDate('ashWednesday');
     $ascensionDayDate = $this->getHolidayDate('ascensionDay');
     $advent1Date = $this->getHolidayDate('advent1');
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     /**
      * Valentine's Day
      */
     $this->_addHoliday('valentinesDay', $this->_year . '-02-14', 'Valentine\'s Day');
     /**
      * "Weiberfastnacht"
      */
     $wFasnetDate = $this->_addDays($ashWednesdayDate, -6);
     $this->_addHoliday('womenFasnet', $wFasnetDate, 'Carnival');
     /**
      * Carnival / "Fastnacht"
      */
     $fasnetDate = $this->_addDays($easterDate, -47);
     $this->_addHoliday('fasnet', $fasnetDate, 'Carnival');
     /**
      * Rose Monday
      */
     $roseMondayDate = $this->_addDays($easterDate, -48);
     $this->_addHoliday('roseMonday', $roseMondayDate, 'Rose Monday');
     /**
      * International Women's Day
      */
     $this->_addHoliday('womensDay', $this->_year . '-03-08', 'International Women\'s Day');
     /**
      * April 1st
      */
     $this->_addHoliday('april1st', $this->_year . '-04-01', 'April 1st');
     /**
      * Girls' Day (fourth Thursday in April)
      */
     $girlsDayDate = new Date($this->_year . '-04-01');
     $dayOfWeek = $girlsDayDate->getDayOfWeek();
     switch ($dayOfWeek) {
         case 0:
         case 1:
         case 2:
         case 3:
             $girlsDayDate = $this->_addDays($girlsDayDate, 4 - $dayOfWeek + 21);
             break;
         case 4:
             $girlsDayDate = $this->_addDays($girlsDayDate, 21);
             break;
         case 5:
         case 6:
             $girlsDayDate = $this->_addDays($girlsDayDate, -1 * $dayOfWeek + 11 + 21);
             break;
     }
     $this->_addHoliday('girlsDay', $girlsDayDate, 'Girls\' Day');
     /**
      * International Earth' Day
      */
     $this->_addHoliday('earthDay', $this->_year . '-04-22', 'International Earth\' Day');
     /**
      * German Beer's Day
      */
     $this->_addHoliday('beersDay', $this->_year . '-04-23', 'German Beer\'s Day');
     /**
      * Walpurgis Night
      */
     $this->_addHoliday('walpurgisNight', $this->_year . '-04-30', 'Walpurgis Night');
     /**
      * Day of Work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'Day of Work');
     /**
      * World's Laughing Day
      */
     $laughingDayDate = new Date($this->_year . '-05-01');
     while ($laughingDayDate->getDayOfWeek() != 0) {
         $laughingDayDate = $laughingDayDate->getNextDay();
     }
     $this->_addHoliday('laughingDay', $laughingDayDate, 'World\'s Laughing Day');
     /**
      * Europe Day
      */
     $this->_addHoliday('europeDay', $this->_year . '-05-05', 'Europe Day');
     /**
      * Mothers' Day
      */
     $mothersDay = $this->_addDays($laughingDayDate, 7);
     $this->_addHoliday('mothersDay', $mothersDay, 'Mothers\' Day');
     /**
      * End of World War 2 in Germany
      */
     $this->_addHoliday('endOfWWar2', $this->_year . '-05-08', 'End of World War 2 in Germany');
     /**
      * Fathers' Day
      */
     $this->_addHoliday('fathersDay', $ascensionDayDate, 'Fathers\' Day');
     /**
      * Amnesty International Day
      */
     $this->_addHoliday('aiDay', $this->_year . '-05-28', 'Amnesty International Day');
     /**
      * International Children' Day
      */
     $this->_addHoliday('intChildrenDay', $this->_year . '-06-01', 'International Children\'s Day');
     /**
      * Day of organ donation
      */
     $organDonationDate = new Date($this->_year . '-06-01');
     while ($organDonationDate->getDayOfWeek() != 6) {
         $organDonationDate = $organDonationDate->getNextDay();
     }
     $this->_addHoliday('organDonationDay', $organDonationDate, 'Day of organ donation');
     /**
      * Dormouse' Day
      */
     $this->_addHoliday('dormouseDay', $this->_year . '-06-27', 'Dormouse\' Day');
     /**
      * Christopher Street Day
      */
     $this->_addHoliday('christopherStreetDay', $this->_year . '-06-27', 'Christopher Street Day');
     /**
      * Hiroshima Commemoration Day
      */
     $this->_addHoliday('hiroshimaCommemorationDay', $this->_year . '-08-06', 'Hiroshima Commemoration Day');
     /**
      * Augsburg peace celebration
      */
     $this->_addHoliday('augsburgPeaceCelebration', $this->_year . '-08-08', 'Augsburg peace celebration');
     /**
      * International left-handeds' Day
      */
     $this->_addHoliday('leftHandedDay', $this->_year . '-08-13', 'International left-handeds\' Day');
     /**
      * Anti-War Day
      */
     $this->_addHoliday('antiWarDay', $this->_year . '-09-01', 'Anti-War Day');
     /**
      * Day of German Language
      */
     $germanLangDayDate = new Date($this->_year . '-09-01');
     while ($germanLangDayDate->getDayOfWeek() != 6) {
         $germanLangDayDate = $germanLangDayDate->getNextDay();
     }
     $germanLangDayDate = $this->_addDays($germanLangDayDate, 7);
     $this->_addHoliday('germanLanguageDay', $germanLangDayDate, 'Day of German Language');
     /**
      * International diabetes day
      */
     $this->_addHoliday('diabetesDay', $this->_year . '-11-14', 'International diabetes day');
     /**
      * German Unification Day
      */
     $this->_addHoliday('germanUnificationDay', $this->_year . '-10-03', 'German Unification Day');
     /**
      * Libraries' Day
      */
     $this->_addHoliday('librariesDay', $this->_year . '-10-24', 'Libraries\' Day');
     /**
      * World's Savings Day
      */
     $this->_addHoliday('savingsDay', $this->_year . '-10-30', 'World\'s Savings Day');
     /**
      * Halloween
      */
     $this->_addHoliday('halloween', $this->_year . '-10-31', 'Halloween');
     /**
      * Stamp's Day
      *
      * year <= 1948: 7th of January
      * year > 1948: last Sunday in October
      */
     $stampsDayDate = null;
     if ($this->_year <= 1948) {
         $stampsDayDate = new Date($this->_year . '-01-07');
         while ($stampsDayDate->getDayOfWeek() != 0) {
             $stampsDayDate = $stampsDayDate->getNextDay();
         }
     } else {
         $stampsDayDate = new Date($this->_year . '-10-31');
         while ($stampsDayDate->getDayOfWeek() != 0) {
             $stampsDayDate = $stampsDayDate->getPrevDay();
         }
     }
     $this->_addHoliday('stampsDay', $stampsDayDate, 'Stamp\'s Day');
     /**
      * International Men's Day
      */
     $this->_addHoliday('mensDay', $this->_year . '-11-03', 'International Men\'s Day');
     /**
      * Fall of the Wall of Berlin
      */
     $this->_addHoliday('wallOfBerlin', $this->_year . '-11-09', 'Fall of the Wall of Berlin 1989');
     /**
      * Beginning of the Carnival
      */
     $this->_addHoliday('carnivalBeginning', $this->_year . '-11-11', 'Beginning of the Carnival');
     /**
      * People's Day of Mourning
      */
     $dayOfMourning = $this->_addDays($advent1Date, -14);
     $this->_addHoliday('dayOfMourning', $dayOfMourning, 'People\'s Day of Mourning');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #27
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('novoleto1', $this->_year . '-01-01', 'Novo leto');
     $this->_addHoliday('novoleto2', $this->_year . '-01-02', 'Novo leto');
     /**
      * Prešernov dan
      */
     $this->_addHoliday('preseren', $this->_year . '-02-08', 'Prešernov dan, slovenski kulturni praznik');
     /**
      * Dan upora proti okupatorju
      */
     $this->_addHoliday('okupator', $this->_year . '-04-27', 'Dan upora proti okupatorju');
     /**
      * Praznik dela
      */
     $this->_addHoliday('delo1', $this->_year . '-05-01', 'Praznik dela');
     $this->_addHoliday('delo2', $this->_year . '-05-02', 'Praznik dela');
     /**
      * Dan državnosti
      */
     $this->_addHoliday('drzavnost', $this->_year . '-06-25', 'Dan državnosti');
     /**
      * Easter Sunday
      */
     $easter = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('vnoc', $easter, 'Velika noč');
     /**
      * Easter Monday
      */
     $easterMon = clone $easter;
     $easterMon->day++;
     $this->_addHoliday('vnocpon', $easterMon, 'Velikonočni ponedeljek');
     /**
      * Binkosti
      */
     $easterMon = clone $easter;
     $easterMon->day += 50;
     $this->_addHoliday('binkosti', $easter, 'Binkoštna nedelja - binkošti');
     /**
      * Marijino vnebovzetje
      */
     $this->_addHoliday('marija', $this->_year . '-08-15', 'Marijino vnebovzetje');
     /**
      * Združitev prekmurskih Slovencev
      */
     $this->_addHoliday('prekmurski', $this->_year . '-08-17', 'Združitev prekmurskih Slovencev z matičnim narodom');
     /**
      * Združitev prekmurskih Slovencev
      */
     $this->_addHoliday('primorska', $this->_year . '-09-15', 'Vrnitev Primorske k matični domovini');
     /**
      * Dan reformacije
      */
     $this->_addHoliday('reformacija', $this->_year . '-10-31', 'Dan reformacije');
     /**
      * Dan spomina na mrtve
      */
     $this->_addHoliday('danmrtvih', $this->_year . '-11-01', 'Dan spomina na mrtve');
     /**
      * Dan spomina na mrtve
      */
     $this->_addHoliday('maister', $this->_year . '-11-23', 'Dan Rudolfa Maistra');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Božič');
     /**
      * Dan samostojnosti in enotnosti
      */
     $this->_addHoliday('samostijnosti', $this->_year . '-12-26', 'Dan samostojnosti in enotnosti');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     $year = $this->_year;
     /**
      * Circumcision of Jesus
      */
     $this->_addHoliday('jesusCircumcision', $year . '-01-01', 'Circumcision of Jesus');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $year . '-01-06', 'Epiphany');
     /**
      * Cleaning of Mariä
      */
     $this->_addHoliday('mariaCleaning', $year . '-02-02', 'Cleaning of Maria');
     /**
      * Josef's Day
      */
     $this->_addHoliday('josefsDay', $year . '-03-19', 'Josef\'s Day');
     /**
      * Maria Announcement
      */
     $this->_addHoliday('mariaAnnouncement', $year . '-03-25', 'Maria Announcement');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_EasternChristian::calcEaster($year);
     $this->_addHoliday('easter', $easterDate, 'Easter Sunday');
     /**
      * Palm Sunday
      */
     $palmSundayDate = $this->_addDays($easterDate, -7);
     $this->_addHoliday('palmSunday', $palmSundayDate, 'Palm Sunday');
     /**
      * Passion Sunday
      */
     $passionSundayDate = new Date($palmSundayDate);
     #$passionSundayDate->subtractSpan(new Date_Span('7, 0, 0, 0'));
     $passionSundayDate = $this->_addDays($palmSundayDate, -7);
     $this->_addHoliday('passionSunday', $passionSundayDate, 'Passion Sunday');
     /**
      * Painful Friday
      */
     #$painfulFridayDate = new Date($palmSundayDate);
     #$painfulFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
     $painfulFridayDate = $this->_addDays($palmSundayDate, -2);
     $this->_addHoliday('painfulFriday', $painfulFridayDate, 'Painful Friday');
     /**
      * White Sunday
      */
     #$whiteSundayDate = new Date($easterDate);
     #$whiteSundayDate->addSpan(new Date_Span('7, 0, 0, 0'));
     $whiteSundayDate = $this->_addDays($easterDate, 7);
     $this->_addHoliday('whiteSunday', $whiteSundayDate, 'White Sunday');
     /**
      * Ash Wednesday
      */
     #$ashWednesdayDate = new Date($easterDate);
     #$ashWednesdayDate->subtractSpan(new Date_Span('46, 0, 0, 0'));
     $ashWednesdayDate = $this->_addDays($easterDate, -46);
     $this->_addHoliday('ashWednesday', $ashWednesdayDate, 'Ash Wednesday');
     /**
      * Good Friday / Black Friday
      */
     #$goodFridayDate = new Date($easterDate);
     #$goodFridayDate->subtractSpan(new Date_Span('2, 0, 0, 0'));
     $goodFridayDate = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFridayDate, 'Good Friday');
     /**
      * Green Thursday
      */
     $this->_addHoliday('greenThursday', $goodFridayDate->getPrevDay(), 'Green Thursday');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Easter Monday');
     /**
      * Triytsia
      */
     #$triyDate = new Date($easterDate);
     #$triyDate->addSpan(new Date_Span('49, 0, 0, 0'));
     $triyDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('Triytsia', $triyDate, 'Triytsia');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #29
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'Año nuevo');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Día de Reyes');
     /**
      * Valentine Day
      */
     $this->_addHoliday('valentinesDay', $this->_year . '-02-14', 'San Valentín');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Semana Santa');
     /**
      * Carnival
      */
     $carnival = $this->_addDays($easterDate, -47);
     $this->_addHoliday('carnival', $carnival, 'Carnaval');
     /**
      * Ash Wednesday
      */
     $ashWednesday = $this->_addDays($easterDate, -46);
     $this->_addHoliday('ashWednesday', $ashWednesday, 'Miercoles de Ceniza');
     /**
      * Palm Sunday
      */
     $palmSunday = $this->_addDays($easterDate, -7);
     $this->_addHoliday('palmSunday', $palmSunday, 'Domingo de ramos');
     /**
      * Maundy Thursday
      */
     $maundyThursday = $this->_addDays($easterDate, -3);
     $this->_addHoliday('maundyThursday', $maundyThursday, 'Jueves Santo');
     /**
      * Good Friday
      */
     $goodFriday = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFriday, 'Viernes Santo');
     /**
      * Saint Saturday
      */
     $goodFriday = $this->_addDays($easterDate, -1);
     $this->_addHoliday('saintSaturday', $goodFriday, 'Sabado Santo');
     /**
      * Easter
      */
     $this->_addHoliday('easter', $easterDate, 'Domingo de resurrección');
     /**
      * Fathers Day
      */
     $this->_addHoliday('fathersDay', $this->_year . '-03-19', 'Día del padre');
     /**
      * Day of Work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'Día del trabajador');
     /**
      * Mothers Day
      */
     $mothersDay = $this->_calcFirstMonday("05");
     $mothersDay = $mothersDay->getPrevDay();
     if ($mothersDay->getDay() == 30) {
         $mothersDay = $this->_addDays($mothersDay, 7);
     }
     $this->_addHoliday('mothersDay', $mothersDay, 'Día de la madre');
     /**
      * Corpus Christi
      */
     $corpusChristi = $this->_addDays($easterDate, 60);
     $this->_addHoliday('corpusChristi', $corpusChristi, 'Corpo de Deus');
     /**
      * Apostle Santiago
      */
     $this->_addHoliday('apostleSantiago', $this->_year . '-07-25', 'Santiago apóstol');
     /**
      * Ascension of Maria
      */
     $this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Asunción de la Virgen María');
     /**
      * Hispanity Day
      */
     $this->_addHoliday('hispanityDay', $this->_year . '-10-12', 'Día de la hispanidad');
     /**
      * All Saints' Day
      */
     $this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'Todos los santos');
     /**
      * Constitution's Day
      */
     $this->_addHoliday('constitutionDay', $this->_year . '-12-06', 'Día de la Constitución');
     /**
      * Immaculate Conception
      */
     $this->_addHoliday('immaculateConceptionDay', $this->_year . '-12-08', 'Inmaculada concepción');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Noche buena');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Navidad');
     /**
      * New Year´s Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'Noche vieja');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }
Example #30
0
 /**
  * Build the internal arrays that contain data about the calculated holidays
  *
  * @access   protected
  * @return   boolean true on success, otherwise a PEAR_ErrorStack object
  * @throws   object PEAR_ErrorStack
  */
 function _buildHolidays()
 {
     /**
      * New Year's Day
      */
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'Neujahr');
     /**
      * Epiphanias
      */
     $this->_addHoliday('epiphany', $this->_year . '-01-06', 'Heilige Drei Könige');
     /**
      * Valentine´s Day
      */
     $this->_addHoliday('valentinesDay', $this->_year . '-02-14', 'Valentinstag');
     /**
      * Easter Sunday
      */
     $easterDate = Date_Holidays_Driver_Christian::calcEaster($this->_year);
     $this->_addHoliday('easter', $easterDate, 'Ostersonntag');
     /**
      * Ash Wednesday
      */
     $ashWednesday = $this->_addDays($easterDate, -46);
     $this->_addHoliday('ashWednesday', $ashWednesday, 'Aschermittwoch');
     /**
      * Palm Sunday
      */
     $palmSunday = $this->_addDays($easterDate, -7);
     $this->_addHoliday('palmSunday', $palmSunday, 'Palmsonntag');
     /**
      * Maundy Thursday
      */
     $maundyThursday = $this->_addDays($easterDate, -3);
     $this->_addHoliday('maundyThursday', $maundyThursday, 'Gründonnerstag');
     /**
      * Good Friday
      */
     $goodFriday = $this->_addDays($easterDate, -2);
     $this->_addHoliday('goodFriday', $goodFriday, 'Karfreitag');
     /**
      * Easter Monday
      */
     $this->_addHoliday('easterMonday', $easterDate->getNextDay(), 'Ostermontag');
     /**
      * Day of Work
      */
     $this->_addHoliday('dayOfWork', $this->_year . '-05-01', 'Staatsfeiertag Österreich');
     /**
      * Saint Florian
      */
     $this->_addHoliday('saintFlorian', $this->_year . '-05-04', 'St. Florian');
     /**
      * Mothers Day
      */
     $mothersDay = $this->_calcFirstMonday("05");
     $mothersDay = $mothersDay->getPrevDay();
     $mothersDay = $this->_addDays($mothersDay, 7);
     $this->_addHoliday('mothersDay', $mothersDay, 'Muttertag');
     /**
      * Ascension Day
      */
     $ascensionDate = $this->_addDays($easterDate, 39);
     $this->_addHoliday('ascensionDate', $ascensionDate, 'Christi Himmelfahrt');
     /**
      * Ascension Day
      */
     //$ascensionDayDate = new Date($whitsunDate);
     //$ascensionDayDate->subtractSpan(new Date_Span('10, 0, 0, 0'));
     //$this->_addHoliday('ascensionDay',
     //                   $ascensionDayDate,
     //                   'Christi Himmelfahrt');
     /**
      * Whitsun (determines Whit Monday, Ascension Day and
      * Feast of Corpus Christi)
      */
     $whitsunDate = $this->_addDays($easterDate, 49);
     $this->_addHoliday('whitsun', $whitsunDate, 'Pfingstsonntag');
     /**
      * Whit Monday
      */
     $this->_addHoliday('whitMonday', $whitsunDate->getNextDay(), 'Pfingstmontag');
     /**
      * Corpus Christi
      */
     $corpusChristi = $this->_addDays($easterDate, 60);
     $this->_addHoliday('corpusChristi', $corpusChristi, 'Fronleichnam');
     /**
      * Fathers Day
      */
     $fathersDay = $this->_calcFirstMonday("06");
     $fathersDay = $fathersDay->getPrevDay();
     $fathersDay = $this->_addDays($fathersDay, 7);
     $this->_addHoliday('fathersDay', $fathersDay, 'Vatertag');
     /**
      * Ascension of Maria
      */
     $this->_addHoliday('mariaAscension', $this->_year . '-08-15', 'Maria Himmelfahrt');
     /**
      * Österreichischer Nationalfeiertag
      */
     $this->_addHoliday('nationalDayAustria', $this->_year . '-10-26', 'Österreichischer Nationalfeiertag');
     /**
      * All Saints' Day
      */
     $this->_addHoliday('allSaintsDay', $this->_year . '-11-01', 'Allerheiligen');
     /**
      *All Souls´ Day
      */
     $this->_addHoliday('allSoulsDay', $this->_year . '-11-02', 'Allerseelen');
     /**
      * Santa Claus
      */
     $this->_addHoliday('santasDay', $this->_year . '-12-06', 'St. Nikolaus');
     /**
      * Immaculate Conception
      */
     $this->_addHoliday('immaculateConceptionDay', $this->_year . '-12-08', 'Maria Empfängnis');
     /**
      * Sunday in commemoration of the dead (sundayIcotd)
      */
     $sundayIcotd = $this->_calcFirstMonday(12);
     $sundayIcotd = $this->_addDays($this->_calcFirstMonday(12), -8);
     $this->_addHoliday('sundayIcotd', $sundayIcotd, 'Totensonntag');
     /**
      * 1. Advent
      */
     $firstAdv = $this->_calcFirstMonday(12);
     $firstAdv = $firstAdv->getPrevDay();
     $this->_addHoliday('firstAdvent', $firstAdv, '1. Advent');
     /**
      * 2. Advent
      */
     $secondAdv = $this->_addDays($firstAdv, 7);
     $this->_addHoliday('secondAdvent', $secondAdv, '2. Advent');
     /**
      * 3. Advent
      */
     $thirdAdv = $this->_addDays($firstAdv, 14);
     $this->_addHoliday('thirdAdvent', $thirdAdv, '3. Advent');
     /**
      * 4. Advent
      */
     $fourthAdv = $this->_addDays($firstAdv, 21);
     $this->_addHoliday('fourthAdvent', $fourthAdv, '4. Advent');
     /**
      * Christmas Eve
      */
     $this->_addHoliday('christmasEve', $this->_year . '-12-24', 'Heiliger Abend');
     /**
      * Christmas day
      */
     $this->_addHoliday('christmasDay', $this->_year . '-12-25', 'Christtag');
     /**
      * Boxing day
      */
     $this->_addHoliday('boxingDay', $this->_year . '-12-26', 'Stefanitag');
     /**
      * New Year´s Eve
      */
     $this->_addHoliday('newYearsEve', $this->_year . '-12-31', 'Silvester');
     if (Date_Holidays::errorsOccurred()) {
         return Date_Holidays::getErrorStack();
     }
     return true;
 }