本文整理汇总了PHP中TimeDate::getTimezoneList方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::getTimezoneList方法的具体用法?PHP TimeDate::getTimezoneList怎么用?PHP TimeDate::getTimezoneList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::getTimezoneList方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: localeOptions
public function localeOptions($api, $args)
{
global $locale, $sugar_config, $current_user;
$data = array();
$dformat = $locale->getPrecedentPreference($current_user->id ? 'datef' : 'default_date_format', $current_user);
$tformat = $locale->getPrecedentPreference($current_user->id ? 'timef' : 'default_time_format', $current_user);
$nformat = $locale->getPrecedentPreference('default_locale_name_format', $current_user);
if (!array_key_exists($nformat, $sugar_config['name_formats'])) {
$nformat = $sugar_config['default_locale_name_format'];
}
$data['timepref'] = $sugar_config['time_formats'];
$data['datepref'] = $sugar_config['date_formats'];
$data['default_locale_name_format'] = $locale->getUsableLocaleNameOptions($sugar_config['name_formats']);
$data['timezone'] = $timezoneList = TimeDate::getTimezoneList();
$data['_hash'] = $current_user->getUserMDHash();
return $data;
}
示例2: setDateTimeProperties
private function setDateTimeProperties($field_map = array())
{
global $current_user, $sugar_config;
$timeFormat = $current_user->getUserDateTimePreferences();
$defaultTimeOption = isset($field_map['importlocale_timeformat']) ? $field_map['importlocale_timeformat'] : $timeFormat['time'];
$defaultDateOption = isset($field_map['importlocale_dateformat']) ? $field_map['importlocale_dateformat'] : $timeFormat['date'];
$timeOptions = get_select_options_with_id($sugar_config['time_formats'], $defaultTimeOption);
$dateOptions = get_select_options_with_id($sugar_config['date_formats'], $defaultDateOption);
// get list of valid timezones
$userTZ = isset($field_map['importlocale_timezone']) ? $field_map['importlocale_timezone'] : $current_user->getPreference('timezone');
if (empty($userTZ)) {
$userTZ = TimeDate::userTimezone();
}
$this->ss->assign('TIMEZONE_CURRENT', $userTZ);
$this->ss->assign('TIMEOPTIONS', $timeOptions);
$this->ss->assign('DATEOPTIONS', $dateOptions);
$this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
}
示例3: session_destroy
if (isset($_SESSION['isMobile'])) {
session_destroy();
session_start();
$_SESSION['login_error'] = $mod_strings['ERR_NO_LOGIN_MOBILE'];
header("Location: index.php?module=Users&action=Login&mobile=1");
sugar_cleanup(true);
}
///////////////////////////////////////////////////////////////////////////////
//// HELPER FUNCTIONS
//// END HELPER FUNCTIONS
///////////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['userOffset'])) {
// ajax call to lookup timezone
echo 'userTimezone = "' . TimeDate::guessTimezone($_REQUEST['userOffset']) . '";';
exit;
}
$admin = Administration::getSettings();
$sugar_smarty = new Sugar_Smarty();
$sugar_smarty->assign('MOD', $mod_strings);
$sugar_smarty->assign('APP', $app_strings);
global $current_user;
$selectedZone = $current_user->getPreference('timezone');
if (empty($selectedZone) && !empty($_REQUEST['gmto'])) {
$selectedZone = TimeDate::guessTimezone(-1 * $_REQUEST['gmto']);
}
if (empty($selectedZone)) {
$selectedZone = TimeDate::guessTimezone();
}
$sugar_smarty->assign('TIMEZONE_CURRENT', $selectedZone);
$sugar_smarty->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
$sugar_smarty->display('modules/Users/SetTimezone.tpl');
示例4: display
//.........这里部分代码省略.........
$fieldtype = ' [' . $mod_strings['LBL_IMPORT_FIELDDEF_' . strtoupper($properties['type'])] . '] ';
}
if (isset($properties['comment'])) {
$fieldtype .= ' - ' . $properties['comment'];
}
$options[$displayname . $fieldname] = '<option value="' . $fieldname . '" title="' . $displayname . $fieldtype . '"' . $selected . $req_class . '>' . $displayname . $req_mark . '</option>\\n';
}
// get default field value
$defaultFieldHTML = '';
if (!empty($defaultField)) {
$defaultFieldHTML = getControl($_REQUEST['import_module'], $defaultField, $fields[$defaultField], $default_value);
}
// Bug 27046 - Sort the column name picker alphabetically
ksort($options);
$columns[] = array('field_choices' => implode('', $options), 'default_field' => $defaultFieldHTML, 'show_remove' => true);
$ret_field_count++;
}
}
$this->ss->assign("COLUMNCOUNT", $ret_field_count);
$this->ss->assign("rows", $columns);
// get list of valid date/time formats
$timeFormat = $current_user->getUserDateTimePreferences();
$timeOptions = get_select_options_with_id($sugar_config['time_formats'], $timeFormat['time']);
$dateOptions = get_select_options_with_id($sugar_config['date_formats'], $timeFormat['date']);
$this->ss->assign('TIMEOPTIONS', $timeOptions);
$this->ss->assign('DATEOPTIONS', $dateOptions);
$this->ss->assign('datetimeformat', $GLOBALS['timedate']->get_cal_date_time_format());
// get list of valid timezones
$userTZ = $current_user->getPreference('timezone');
if (empty($userTZ)) {
$userTZ = TimeDate::userTimezone();
}
$this->ss->assign('TIMEZONE_CURRENT', $userTZ);
$this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
// get currency preference
require_once 'modules/Currencies/ListCurrency.php';
$currency = new ListCurrency();
$cur_id = $locale->getPrecedentPreference('currency', $current_user);
if ($cur_id) {
$selectCurrency = $currency->getSelectOptions($cur_id);
$this->ss->assign("CURRENCY", $selectCurrency);
} else {
$selectCurrency = $currency->getSelectOptions();
$this->ss->assign("CURRENCY", $selectCurrency);
}
$currenciesVars = "";
$i = 0;
foreach ($locale->currencies as $id => $arrVal) {
$currenciesVars .= "currencies[{$i}] = '{$arrVal['symbol']}';\n";
$i++;
}
$currencySymbolsJs = <<<eoq
var currencies = new Object;
{$currenciesVars}
function setSymbolValue(id) {
document.getElementById('symbol').value = currencies[id];
}
eoq;
$this->ss->assign('currencySymbolJs', $currencySymbolsJs);
// fill significant digits dropdown
$significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $current_user);
$sigDigits = '';
for ($i = 0; $i <= 6; $i++) {
if ($significantDigits == $i) {
$sigDigits .= '<option value="' . $i . '" selected="true">' . $i . '</option>';
} else {
示例5: display
/**
* @see SugarView::display()
*/
public function display()
{
global $mod_strings, $current_user, $locale, $sugar_config, $app_list_strings, $sugar_version;
$themeObject = SugarThemeRegistry::current();
$css = $themeObject->getCSS();
$this->ss->assign('SUGAR_CSS', $css);
$favicon = $themeObject->getImageURL('sugar_icon.ico', false);
$this->ss->assign('FAVICON_URL', getJSPath($favicon));
$this->ss->assign('CSS', '<link rel="stylesheet" type="text/css" href="' . SugarThemeRegistry::current()->getCSSURL('wizard.css') . '" />');
$this->ss->assign('JAVASCRIPT', user_get_validate_record_js() . user_get_chooser_js() . user_get_confsettings_js());
$this->ss->assign('PRINT_URL', 'index.php?' . $GLOBALS['request_string']);
$this->ss->assign('SKIP_WELCOME', isset($_REQUEST['skipwelcome']) && $_REQUEST['skipwelcome'] == 1);
$this->ss->assign('ID', $current_user->id);
$this->ss->assign('USER_NAME', $current_user->user_name);
$this->ss->assign('FIRST_NAME', $current_user->first_name);
$this->ss->assign('SUGAR_VERSION', $sugar_version);
$this->ss->assign('LAST_NAME', $current_user->last_name);
$this->ss->assign('TITLE', $current_user->title);
$this->ss->assign('DEPARTMENT', $current_user->department);
$this->ss->assign('REPORTS_TO_ID', $current_user->reports_to_id);
$this->ss->assign('REPORTS_TO_NAME', $current_user->reports_to_name);
$this->ss->assign('PHONE_HOME', $current_user->phone_home);
$this->ss->assign('PHONE_MOBILE', $current_user->phone_mobile);
$this->ss->assign('PHONE_WORK', $current_user->phone_work);
$this->ss->assign('PHONE_OTHER', $current_user->phone_other);
$this->ss->assign('PHONE_FAX', $current_user->phone_fax);
$this->ss->assign('EMAIL1', $current_user->email1);
$this->ss->assign('EMAIL2', $current_user->email2);
$this->ss->assign('ADDRESS_STREET', $current_user->address_street);
$this->ss->assign('ADDRESS_CITY', $current_user->address_city);
$this->ss->assign('ADDRESS_STATE', $current_user->address_state);
$this->ss->assign('ADDRESS_POSTALCODE', $current_user->address_postalcode);
$this->ss->assign('ADDRESS_COUNTRY', $current_user->address_country);
$configurator = new Configurator();
if ($configurator->config['passwordsetting']['SystemGeneratedPasswordON'] || $configurator->config['passwordsetting']['forgotpasswordON']) {
$this->ss->assign('REQUIRED_EMAIL_ADDRESS', '1');
} else {
$this->ss->assign('REQUIRED_EMAIL_ADDRESS', '0');
}
// get javascript
ob_start();
$this->options['show_javascript'] = true;
$this->renderJavascript();
$this->options['show_javascript'] = false;
$this->ss->assign("SUGAR_JS", ob_get_contents() . $themeObject->getJS());
ob_end_clean();
$messenger_type = '<select tabindex="5" name="messenger_type">';
$messenger_type .= get_select_options_with_id($app_list_strings['messenger_type_dom'], $current_user->messenger_type);
$messenger_type .= '</select>';
$this->ss->assign('MESSENGER_TYPE_OPTIONS', $messenger_type);
$this->ss->assign('MESSENGER_ID', $current_user->messenger_id);
// set default settings
$use_real_names = $current_user->getPreference('use_real_names');
if (empty($use_real_names)) {
$current_user->setPreference('use_real_names', 'on');
}
$current_user->setPreference('reminder_time', 1800);
$current_user->setPreference('email_reminder_time', 3600);
$current_user->setPreference('mailmerge_on', 'on');
//// Timezone
if (empty($current_user->id)) {
// remove default timezone for new users(set later)
$current_user->user_preferences['timezone'] = '';
}
$userTZ = $current_user->getPreference('timezone');
if (empty($userTZ) && !$current_user->is_group && !$current_user->portal_only) {
$userTZ = TimeDate::guessTimezone();
$current_user->setPreference('timezone', $userTZ);
}
if (!$current_user->getPreference('ut')) {
$this->ss->assign('PROMPTTZ', ' checked');
}
$this->ss->assign('TIMEZONE_CURRENT', $userTZ);
$this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
//// Numbers and Currency display
require_once 'modules/Currencies/ListCurrency.php';
$currency = new ListCurrency();
// 10/13/2006 Collin - Changed to use Localization.getConfigPreference
// This was the problem- Previously, the "-99" currency id always assumed
// to be defaulted to US Dollars. However, if someone set their install to use
// Euro or other type of currency then this setting would not apply as the
// default because it was being overridden by US Dollars.
$cur_id = $locale->getPrecedentPreference('currency', $current_user);
if ($cur_id) {
$selectCurrency = $currency->getSelectOptions($cur_id);
$this->ss->assign("CURRENCY", $selectCurrency);
} else {
$selectCurrency = $currency->getSelectOptions();
$this->ss->assign("CURRENCY", $selectCurrency);
}
$currenciesArray = $locale->currencies;
$currenciesVars = $this->correctCurrenciesSymbolsSort($currenciesArray);
$currencySymbolsJs = <<<eoq
var currencies = new Object;
{$currenciesVars}
function setSymbolValue(id) {
\tdocument.getElementById('symbol').value = currencies[id];
//.........这里部分代码省略.........
示例6: setupAdvancedTabLocaleSettings
protected function setupAdvancedTabLocaleSettings()
{
global $locale, $sugar_config, $app_list_strings;
///////////////////////////////////////////////////////////////////////////////
//// LOCALE SETTINGS
//// Date/time format
$dformat = $locale->getPrecedentPreference($this->bean->id ? 'datef' : 'default_date_format', $this->bean);
$tformat = $locale->getPrecedentPreference($this->bean->id ? 'timef' : 'default_time_format', $this->bean);
$nformat = $locale->getPrecedentPreference('default_locale_name_format', $this->bean);
if (!array_key_exists($nformat, $sugar_config['name_formats'])) {
$nformat = $sugar_config['default_locale_name_format'];
}
$timeOptions = get_select_options_with_id($sugar_config['time_formats'], $tformat);
$dateOptions = get_select_options_with_id($sugar_config['date_formats'], $dformat);
$nameOptions = get_select_options_with_id($locale->getUsableLocaleNameOptions($sugar_config['name_formats']), $nformat);
$this->ss->assign('TIMEOPTIONS', $timeOptions);
$this->ss->assign('DATEOPTIONS', $dateOptions);
$this->ss->assign('NAMEOPTIONS', $nameOptions);
$this->ss->assign('DATEFORMAT', $sugar_config['date_formats'][$dformat]);
$this->ss->assign('TIMEFORMAT', $sugar_config['time_formats'][$tformat]);
$this->ss->assign('NAMEFORMAT', $sugar_config['name_formats'][$nformat]);
//// Timezone
if (empty($this->bean->id)) {
// remove default timezone for new users(set later)
$this->bean->user_preferences['timezone'] = '';
}
$userTZ = $this->bean->getPreference('timezone');
if (empty($userTZ) && !$this->bean->is_group && !$this->bean->portal_only) {
$userTZ = TimeDate::guessTimezone();
$this->bean->setPreference('timezone', $userTZ);
}
if (!$this->bean->getPreference('ut')) {
$this->ss->assign('PROMPTTZ', ' checked');
}
$this->ss->assign('TIMEZONE_CURRENT', $userTZ);
$this->ss->assign('TIMEZONEOPTIONS', TimeDate::getTimezoneList());
$this->ss->assign("TIMEZONE", TimeDate::tzName($userTZ));
// FG - Bug 4236 - Managed First Day of Week
$fdowDays = array();
foreach ($app_list_strings['dom_cal_day_long'] as $d) {
if ($d != "") {
$fdowDays[] = $d;
}
}
$this->ss->assign("FDOWOPTIONS", $fdowDays);
$currentFDOW = $this->bean->get_first_day_of_week();
if (!isset($currentFDOW)) {
$currentFDOW = 0;
}
$this->ss->assign("FDOWCURRENT", $currentFDOW);
$this->ss->assign("FDOWDISPLAY", $fdowDays[$currentFDOW]);
//// Numbers and Currency display
require_once 'modules/Currencies/ListCurrency.php';
$currency = new ListCurrency();
// 10/13/2006 Collin - Changed to use Localization.getConfigPreference
// This was the problem- Previously, the "-99" currency id always assumed
// to be defaulted to US Dollars. However, if someone set their install to use
// Euro or other type of currency then this setting would not apply as the
// default because it was being overridden by US Dollars.
$cur_id = $locale->getPrecedentPreference('currency', $this->bean);
if ($cur_id) {
$selectCurrency = $currency->getSelectOptions($cur_id);
$this->ss->assign("CURRENCY", $selectCurrency);
} else {
$selectCurrency = $currency->getSelectOptions();
$this->ss->assign("CURRENCY", $selectCurrency);
}
// convert base currency values to user preferred
$this->ss->assign("currency_show_preferred", $locale->getPrecedentPreference('currency_show_preferred', $this->bean));
$currencyList = array();
foreach ($locale->currencies as $id => $val) {
$currencyList[$id] = $val['symbol'];
}
$currencySymbolJSON = json_encode($currencyList);
$this->ss->assign('currencySymbolJSON', $currencySymbolJSON);
$currencyDisplay = BeanFactory::getBean('Currencies');
if (isset($cur_id)) {
$currencyDisplay->retrieve($cur_id);
$this->ss->assign('CURRENCY_DISPLAY', $currencyDisplay->iso4217 . ' ' . $currencyDisplay->symbol);
} else {
$this->ss->assign("CURRENCY_DISPLAY", $currencyDisplay->getDefaultISO4217() . ' ' . $currencyDisplay->getDefaultCurrencySymbol());
}
// fill significant digits dropdown
$significantDigits = $locale->getPrecedentPreference('default_currency_significant_digits', $this->bean);
$sigDigits = '';
for ($i = 0; $i <= 6; $i++) {
if ($significantDigits == $i) {
$sigDigits .= "<option value=\"{$i}\" selected=\"true\">{$i}</option>";
} else {
$sigDigits .= "<option value=\"{$i}\">{$i}</option>";
}
}
$this->ss->assign('sigDigits', $sigDigits);
$this->ss->assign('CURRENCY_SIG_DIGITS', $significantDigits);
$num_grp_sep = $this->bean->getPreference('num_grp_sep');
$dec_sep = $this->bean->getPreference('dec_sep');
$this->ss->assign("NUM_GRP_SEP", empty($num_grp_sep) ? $GLOBALS['sugar_config']['default_number_grouping_seperator'] : $num_grp_sep);
$this->ss->assign("DEC_SEP", empty($dec_sep) ? $GLOBALS['sugar_config']['default_decimal_seperator'] : $dec_sep);
$this->ss->assign('getNumberJs', $locale->getNumberJs());
//// Name display format
//.........这里部分代码省略.........
示例7: getFormItems
//.........这里部分代码省略.........
</div>
<div class="clear"></div>
<div class="formrow">
<!-- file upload -->
<label>{$mod_strings['NEW_LOGO']} <i>i<div class="tooltip">{$mod_strings['NEW_LOGO_HELP']}</div></i></label>
<input type="file" name="company_logo" id="company_logo">
</div>
<div class="clear"></div>
<div class="formrow">
<label> </label>
<input type="button" name="company_logo_upload_btn" value="{$mod_strings['COMPANY_LOGO_UPLOAD_BTN']}" onclick="onUploadImageClick(this);">
</div>
<div class="clear"></div>
<div class="formrow" id="current_logo_row">
<label>{$mod_strings['CURRENT_LOGO']} <i>i<div class="tooltip">{$mod_strings['CURRENT_LOGO_HELP']}</div></i> </label>
<img height="100" src="{$currentLogoLink}" alt="Company Logo" style="max-height: 100px; max-width: 230px; float:left; {$hiddenLogo}" />
</div>
<div class="clear"></div>
</div>
EOQ;
// System location defaults
// TODO--low: 1000s sep, Decimal Symb, Name Format
$defaultDateFormatSelect = self::getSelect('default_date_format', $sugarConfigDefaults['date_formats'], empty($_SESSION['default_date_format']) ? $sugarConfigDefaults['default_date_format'] : $_SESSION['default_date_format']);
$defaultTimeFormatSelect = self::getSelect('default_time_format', $sugarConfigDefaults['time_formats'], empty($_SESSION['default_time_format']) ? 'h:ia' : $_SESSION['default_time_format']);
$timezoneSelect = self::getSelect('timezone', array_merge(array(TimeDate::guessTimezone() => TimeDate::guessTimezone()), TimeDate::getTimezoneList()), TimeDate::guessTimezone());
//$defaultLanguageSelect = get_select_options_with_id($supportedLanguages, $current_language);
$defaultLanguageSelect = self::getSelect('default_language', $supportedLanguages, $current_language);
// example name formats (its are in the original language file so may this functionality was there in the original sugarcrm installer also)
$nonDBLocalization = new NonDBLocalization();
$sugarConfigDefaults['name_formats'] = $nonDBLocalization->getUsableLocaleNameOptions($sugarConfigDefaults['name_formats']);
$defaultLocalNameFormatSelect = self::getSelect('default_locale_name_format', $sugarConfigDefaults['name_formats'], empty($_SESSION['default_locale_name_format']) ? $sugarConfigDefaults['default_locale_name_format'] : $_SESSION['default_locale_name_format']);
$out .= <<<EOQ
</div>
<!-- System Local Settings -->
<!-- TODO--low: add the time-zone settings here!! -->
<div class="floatbox full" id="fb4">
<h3 onclick="\$(this).next().toggle();" class="toggler">» {$mod_strings['LBL_LOCALE_TITLE']}</h3>
<div class="form_section" style="display: none;">
<p class="ibmsg">{$mod_strings['LBL_WIZARD_LOCALE_DESC']}</p>
<div class="formrow">
<label>{$mod_strings['LBL_DATE_FORMAT']}</label>
{$defaultDateFormatSelect}
</div>
<div class="formrow">
<label>{$mod_strings['LBL_TIME_FORMAT']}</label>
{$defaultTimeFormatSelect}
</div>
<div class="clear"></div>
<div class="formrow">
<label>{$mod_strings['LBL_TIMEZONE']}</label>
{$timezoneSelect}