本文整理汇总了PHP中TimeDate::guessTimezone方法的典型用法代码示例。如果您正苦于以下问题:PHP TimeDate::guessTimezone方法的具体用法?PHP TimeDate::guessTimezone怎么用?PHP TimeDate::guessTimezone使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeDate
的用法示例。
在下文中一共展示了TimeDate::guessTimezone方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fillInAddedSessionData
/**
* Fills in any added session data needed by this client type
*
* This method is used by child classes like portal
*/
public function fillInAddedSessionData()
{
if ($this->canStartSession() && !empty($this->userBean)) {
// Grab the user's timezone preference if it's set
$val = $this->userBean->getPreference('timezone');
$needPreferenceSet = false;
// If there is no setting for the user, fall back to the system setting
if (!$val) {
$val = TimeDate::guessTimezone();
$needPreferenceSet = true;
}
// If there is still no timezone, fallback to UTC
if (!$val) {
$val = 'UTC';
$needPreferenceSet = true;
}
if ($needPreferenceSet === true) {
$this->userBean->setPreference('timezone', $val);
$this->userBean->savePreferencesToDB();
}
$this->userBean->loadPreferences();
}
return true;
}
示例2: lookupTimezone
/**
* best guesses Timezone based on webserver's TZ settings
*/
function lookupTimezone($userOffset = 0)
{
return TimeDate::guessTimezone($userOffset);
}
示例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
/**
* @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];
//.........这里部分代码省略.........
示例5: 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
//.........这里部分代码省略.........
示例6: 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}
示例7: get_select_options_with_id
//// LOCALE SETTINGS
//// Date/time format
$dformat = $locale->getPrecedentPreference($focus->id ? 'datef' : 'default_date_format', $focus);
$tformat = $locale->getPrecedentPreference($focus->id ? 'timef' : 'default_time_format', $focus);
$timeOptions = get_select_options_with_id($sugar_config['time_formats'], $tformat);
$dateOptions = get_select_options_with_id($sugar_config['date_formats'], $dformat);
$sugar_smarty->assign('TIMEOPTIONS', $timeOptions);
$sugar_smarty->assign('DATEOPTIONS', $dateOptions);
//// Timezone
if (empty($focus->id)) {
// remove default timezone for new users(set later)
$focus->user_preferences['timezone'] = '';
}
$userTZ = $focus->getPreference('timezone');
if (empty($userTZ) && !$focus->is_group && !$focus->portal_only) {
$userTZ = TimeDate::guessTimezone();
$focus->setPreference('timezone', $userTZ);
}
if (!$focus->getPreference('ut')) {
$sugar_smarty->assign('PROMPTTZ', ' checked');
}
//$sugar_smarty->assign('TIMEZONE_CURRENT', $userTZ); // fix bug 1034
$sugar_smarty->assign('TIMEZONE_CURRENT', "Asia/Ho_Chi_Minh");
$sugar_smarty->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
示例8: elseif
}
// end outer forloop
}
// end foreach loop
}
$display .= "<br><b>" . $mod_strings['LBL_DST_FIX_DONE_DESC'] . "</b>";
} elseif (!$done) {
// show primary screen
$disabled = "";
$confirmed = 'true';
require_once 'include/timezone/timezones.php';
global $timezones;
$timezoneOptions = '';
ksort($timezones);
if (!isset($defaultServerZone)) {
$defaultServerZone = TimeDate::guessTimezone(0);
}
foreach ($timezones as $key => $value) {
if (!empty($value['dstOffset'])) {
$dst = " (+DST)";
} else {
$dst = "";
}
if ($key == $defaultServerZone) {
$selected = 'selected';
} else {
$selected = '';
}
$gmtOffset = $value['gmtOffset'] / 60;
if (!strstr($gmtOffset, '-')) {
$gmtOffset = "+" . $gmtOffset;