当前位置: 首页>>代码示例>>PHP>>正文


PHP SugarBean::setPreference方法代码示例

本文整理汇总了PHP中SugarBean::setPreference方法的典型用法代码示例。如果您正苦于以下问题:PHP SugarBean::setPreference方法的具体用法?PHP SugarBean::setPreference怎么用?PHP SugarBean::setPreference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SugarBean的用法示例。


在下文中一共展示了SugarBean::setPreference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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
//.........这里部分代码省略.........
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:101,代码来源:UserViewHelper.php


注:本文中的SugarBean::setPreference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。