function init() { parent::init(); $oContentField = new AnwContentFieldSettings_select(self::FIELD_LANG_DEFAULT); $asEnumValues = array(); $asLangs = AnwComponent::globalCfgLangs(); foreach ($asLangs as $sLang) { $sLangName = $sLang . " - " . Anwi18n::langName($sLang); $asEnumValues[$sLang] = $sLangName; } $oContentField->setEnumValues($asEnumValues); $this->addContentField($oContentField); $oContentField = new AnwContentFieldSettings_string(self::FIELD_LANGS); $oContentField->addAllowedPattern("!^.{" . Anwi18n::MINLEN_LANG . "," . Anwi18n::MAXLEN_LANG . "}\$!"); $oContentMultiplicity = new AnwContentMultiplicity_multiple(); $oContentField->setMultiplicity($oContentMultiplicity); $this->addContentField($oContentField); $oContentField = new AnwContentFieldSettings_select(self::FIELD_TIMEZONE_DEFAULT); $anEnumValues = array(); $anTimezones = AnwUsers::getTimezones(); foreach ($anTimezones as $nTimezone) { $sTimezoneName = Anwi18n::timezoneName($nTimezone); $anEnumValues[$nTimezone] = $sTimezoneName; } $oContentField->setEnumValues($anEnumValues); $this->addContentField($oContentField); }
private function selectTimezone($nSelectedTimezone) { $HTML = ""; $anTimezones = AnwUsers::getTimezones(); foreach ($anTimezones as $nTimezone) { $sSelected = $nSelectedTimezone == $nTimezone ? ' selected="selected"' : ''; $sTimezoneName = Anwi18n::timezoneName($nTimezone); $sTimezoneTime = Anwi18n::dateTime(time(), false, $nTimezone); $HTML .= <<<EOF \t\t\t\t<option value="{$nTimezone}"{$sSelected}>({$sTimezoneName}) {$sTimezoneTime}</option> EOF; } return $HTML; }