private function prepareOutput($result) { $out = array(); foreach ($result as $row) { $tmp = array(); $test = array(); foreach ($row->getRow() as $key => $val) { $key = strtoupper($key); if (in_array($key, $test)) { continue; } else { $test[] = $key; } if ($this->mode == self::MODE_ARRAY_KEYVAL) { $tmp[] = array('key' => $this->tm->_($key), 'val' => $this->rewriteColumn($key, $val)); } else { $tmp[$key] = utf8_decode($this->rewriteColumn($key, $val)); } } $out[] = $tmp; } return $out; }
/** * 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; }
public function loadCurrentLocale() { if ($this->__localeLoaded) { return parent::loadCurrentLocale(); } $user = $this->getContext()->getUser(); if (!$user || !$user instanceof AppKitSecurityUser) { return null; } try { $dbUser = $user->getNsmUser(true); $translation = $this->getContext()->getTranslationManager(); if ($dbUser instanceof NsmUser) { $langDomain = $dbUser->getPrefVal("org.icinga.appkit.locale"); if ($langDomain) { $translation->setLocale($langDomain); } } } catch (Exception $e) { // ignore } $this->__localeLoaded = true; parent::loadCurrentLocale(); }
/** * 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); }