/**
  * Returns a name of this time zone suitable for presentation to the user
  * in the specified locale.
  * If the display name is not available for the locale,
  * then this method returns a string in the format
  * <code>GMT[+-]hh:mm</code>.
  * 
  * @param      bool If true, return the daylight savings name.
  * @param      int  Either <code>self::LONG</code> or <code>self::SHORT</code>
  * @param      AgaviLocale The locale in which to supply the display name.
  *
  * @return     string the human-readable name of this time zone in the given 
  *                    locale or in the default locale if the given locale is 
  *                    not recognized.
  * 
  * @author     Dominik del Bondio <*****@*****.**>
  * @author     The ICU Project
  * @since      0.11.0
  */
 public function getDisplayName($daylight = null, $style = null, AgaviLocale $locale = null)
 {
     if ($daylight === null) {
         $daylight = false;
         $style = self::LONG;
         $locale = $this->translationManager->getCurrentLocale();
     } elseif ($daylight instanceof AgaviLocale) {
         $locale = $daylight;
         $daylight = false;
         $style = self::LONG;
     } elseif (is_bool($daylight) && $style !== null) {
         if ($locale === null) {
             $locale = $this->translationManager->getCurrentLocale();
         }
     } else {
         throw new InvalidArgumentException('Illegal arguments for AgaviTimeZone::getDisplayName');
     }
     $displayString = null;
     if ($daylight && $this->useDaylightTime()) {
         if ($style == self::LONG) {
             $displayString = $locale->getTimeZoneLongDaylightName($this->getId());
         } else {
             $displayString = $locale->getTimeZoneShortDaylightName($this->getId());
         }
     } else {
         if ($style == self::LONG) {
             $displayString = $locale->getTimeZoneLongStandardName($this->getId());
         } else {
             $displayString = $locale->getTimeZoneShortStandardName($this->getId());
         }
     }
     if (!$displayString) {
         $displayString = $this->formatOffset($daylight);
     }
     return $displayString;
 }
Ejemplo n.º 2
0
 /**
  * Constructor.
  * 
  * @param      AgaviTranslationManager
  * @param      int
  * @param      int
  * @param      int
  * @param      int
  * @param      int
  * @param      int
  * 
  * @author     Dominik del Bondio <*****@*****.**>
  * @author     The ICU Project
  * @since      0.11.0
  */
 protected function constructorOIIIIII(AgaviTranslationManager $tm, $year, $month, $date, $hour, $minute, $second)
 {
     parent::constructorOO($tm->getDefaultTimeZone(), $tm->getCurrentLocale());
     $this->set(AgaviDateDefinitions::ERA, self::AD);
     $this->set(AgaviDateDefinitions::YEAR, $year);
     $this->set(AgaviDateDefinitions::MONTH, $month);
     $this->set(AgaviDateDefinitions::DATE, $date);
     $this->set(AgaviDateDefinitions::HOUR_OF_DAY, $hour);
     $this->set(AgaviDateDefinitions::MINUTE, $minute);
     $this->set(AgaviDateDefinitions::SECOND, $second);
 }