Exemplo n.º 1
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();
     // We need a few specific christian holidays
     // before clearing the list of holidays
     $ashWednesdayDate = $this->getHolidayDate('ashWednesday');
     $greenThursday = $this->getHolidayDate('greenThursday');
     $goodFridayDate = $this->getHolidayDate('goodFriday');
     $this->_clearHolidays();
     $this->_addHoliday('newYearsDay', $this->_year . '-01-01', 'New Year\'s Day');
     $this->_addTranslationForHoliday('newYearsDay', 'es_VE', 'Año Nuevo');
     // carnaval
     $carnival = new Date($ashWednesdayDate);
     $carnival = $carnival->getPrevDay();
     $this->_addHoliday('carnival2', $carnival, 'Carnival');
     $carnival = $carnival->getPrevDay();
     $this->_addHoliday('carnival1', $carnival, 'Carnival');
     $this->_addTranslationForHoliday('carnival1', 'es_VE', 'Carnaval');
     $this->_addTranslationForHoliday('carnival2', 'es_VE', 'Carnaval');
     // semana santa
     $this->_addHoliday('holyweek1', $greenThursday, 'Holy Week');
     $this->_addHoliday('holyweek2', $goodFridayDate, 'Holy Week');
     $this->_addTranslationForHoliday('holyweek1', 'es_VE', 'Semana Santa');
     $this->_addTranslationForHoliday('holyweek2', 'es_VE', 'Semana Santa');
     $this->_addHoliday('independenceMovementDay', $this->_year . '-04-19', 'Independence Declaration');
     $this->_addTranslationForHoliday('independenceMovementDay', 'es_VE', 'Declaración de Independencia');
     $this->_addHoliday('laborDay', $this->_year . '-05-01', 'Labor Day');
     $this->_addTranslationForHoliday('laborDay', 'es_VE', 'Día del Trabajador');
     $this->_addHoliday('battleOfCarabobo', $this->_year . '-06-24', 'Battle of Carabobo');
     $this->_addTranslationForHoliday('battleOfCarabobo', 'es_VE', 'Día de la Batalla de Carabobo');
     $this->_addHoliday('independenceDay', $this->_year . '-07-05', 'Independence Day');
     $this->_addTranslationForHoliday('independenceDay', 'es_VE', 'Día de Independencia');
     $this->_addHoliday('bolivarBirthday', $this->_year . '-07-24', 'Birthday of Simon Bolivar');
     $this->_addTranslationForHoliday('bolivarBirthday', 'es_VE', 'Natalicio de Simón Bolívar');
     $this->_addHoliday('columbosDay', $this->_year . '-10-12', 'Columbos Day');
     $this->_addTranslationForHoliday('columbosDay', 'es_VE', 'Día de la Raza');
     $this->_addHoliday('christmas', $this->_year . '-12-25', 'Christmas');
     $this->_addTranslationForHoliday('christmas', 'es_VE', 'Navidad');
     return true;
 }
Exemplo n.º 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()
 {
     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;
 }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
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;
 }