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


PHP Localization::isAllowedNameFormat方法代码示例

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


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

示例1: upgradeUserPreferences

/**
 * upgradeUserPreferences
 * This method updates the user_preferences table and sets the pages/dashlets for users
 * which have ACL access to Trackers so that the Tracker dashlets are set in their user perferences
 *
 */
function upgradeUserPreferences()
{
    global $sugar_config, $sugar_version;
    $uw_strings = return_module_language($GLOBALS['current_language'], 'UpgradeWizard');
    $localization = new Localization();
    $localeCoreDefaults = $localization->getLocaleConfigDefaults();
    // check the current system wide default_locale_name_format and add it to the list if it's not there
    if (empty($sugar_config['name_formats'])) {
        $sugar_config['name_formats'] = $localeCoreDefaults['name_formats'];
        if (!rebuildConfigFile($sugar_config, $sugar_version)) {
            $errors[] = $uw_strings['ERR_UW_CONFIG_WRITE'];
        }
    }
    $currentDefaultLocaleNameFormat = $sugar_config['default_locale_name_format'];
    if ($localization->isAllowedNameFormat($currentDefaultLocaleNameFormat)) {
        upgradeLocaleNameFormat($currentDefaultLocaleNameFormat);
    } else {
        $sugar_config['default_locale_name_format'] = $localeCoreDefaults['default_locale_name_format'];
        if (!rebuildConfigFile($sugar_config, $sugar_version)) {
            $errors[] = $uw_strings['ERR_UW_CONFIG_WRITE'];
        }
        $localization->createInvalidLocaleNameFormatUpgradeNotice();
    }
    $db =& DBManagerFactory::getInstance();
    $result = $db->query("SELECT id FROM users where deleted = '0'");
    while ($row = $db->fetchByAssoc($result)) {
        $current_user = new User();
        $current_user->retrieve($row['id']);
        // get the user's name locale format, check if it's in our list, add it if it's not, keep it as user's default
        $currentUserNameFormat = $current_user->getPreference('default_locale_name_format');
        if ($localization->isAllowedNameFormat($currentUserNameFormat)) {
            upgradeLocaleNameFormat($currentUserNameFormat);
        } else {
            $current_user->setPreference('default_locale_name_format', 's f l', 0, 'global');
            $current_user->savePreferencesToDB();
        }
        $changed = false;
        if (!$current_user->getPreference('calendar_publish_key')) {
            // set publish key if not set already
            $current_user->setPreference('calendar_publish_key', create_guid());
            $changed = true;
        }
        // we need to force save the changes to disk, otherwise we lose them.
        if ($changed) {
            $current_user->savePreferencesToDB();
        }
    }
    //while
}
开发者ID:omusico,项目名称:sugar_work,代码行数:55,代码来源:uw_utils.php


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