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


PHP ca_locales::getPrimaryKey方法代码示例

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


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

示例1: getPreferredDisplayLocaleIDs

 /**
  *
  */
 public function getPreferredDisplayLocaleIDs($pn_item_locale_id = null)
 {
     $vs_mode = $this->getPreference('cataloguing_display_label_mode');
     $va_locale_ids = array();
     switch ($vs_mode) {
         case 'cataloguing_locale':
             if ($vs_locale = $this->getPreference('cataloguing_locale')) {
                 $t_locale = new ca_locales();
                 if ($t_locale->loadLocaleByCode($vs_locale)) {
                     $va_locale_ids[$t_locale->getPrimaryKey()] = true;
                 }
             }
             break;
         case 'item_locale':
             if ($pn_item_locale_id) {
                 $va_locale_ids[$pn_item_locale_id] = true;
             }
             break;
         case 'cataloguing_and_item_locale':
         default:
             if ($vs_locale = $this->getPreference('cataloguing_locale')) {
                 $t_locale = new ca_locales();
                 if ($t_locale->loadLocaleByCode($vs_locale)) {
                     $va_locale_ids[$t_locale->getPrimaryKey()] = true;
                 }
             }
             if ($pn_item_locale_id) {
                 $va_locale_ids[$pn_item_locale_id] = true;
             }
             break;
     }
     return array_keys($va_locale_ids);
 }
开发者ID:kai-iak,项目名称:providence,代码行数:36,代码来源:ca_users.php

示例2: processLocales

 public function processLocales()
 {
     require_once __CA_MODELS_DIR__ . "/ca_locales.php";
     $t_locale = new ca_locales();
     $t_locale->setMode(ACCESS_WRITE);
     // Find any existing locales
     $va_locales = $t_locale->getLocaleList(array('index_by_code' => true));
     foreach ($va_locales as $vs_code => $va_locale) {
         $this->opa_locales[$vs_code] = $va_locale['locale_id'];
     }
     if ($this->ops_base_name) {
         $va_locales = array();
         foreach ($this->opo_profile->locales->children() as $vo_locale) {
             $va_locales[] = $vo_locale;
         }
         foreach ($this->opo_base->locales->children() as $vo_locale) {
             $va_locales[] = $vo_locale;
         }
     } else {
         $va_locales = $this->opo_profile->locales->children();
     }
     foreach ($va_locales as $vo_locale) {
         $vs_language = self::getAttribute($vo_locale, "lang");
         $vs_dialect = self::getAttribute($vo_locale, "dialect");
         $vs_country = self::getAttribute($vo_locale, "country");
         $vb_dont_use_for_cataloguing = self::getAttribute($vo_locale, "dontUseForCataloguing");
         if (isset($this->opa_locales[$vs_language . "_" . $vs_country])) {
             // don't insert duplicate locales
             continue;
         }
         $t_locale->set('name', (string) $vo_locale);
         $t_locale->set('country', $vs_country);
         $t_locale->set('language', $vs_language);
         if ($vs_dialect) {
             $t_locale->set('dialect', $vs_dialect);
         }
         $t_locale->set('dont_use_for_cataloguing', (bool) $vb_dont_use_for_cataloguing);
         $t_locale->insert();
         if ($t_locale->numErrors()) {
             $this->addError("There was an error while inserting locale {$vs_language}_{$vs_country}: " . join(" ", $t_locale->getErrors()));
         }
         $this->opa_locales[$vs_language . "_" . $vs_country] = $t_locale->getPrimaryKey();
     }
     $va_locales = $t_locale->getAppConfig()->getList('locale_defaults');
     $vn_locale_id = $t_locale->localeCodeToID($va_locales[0]);
     if (!$vn_locale_id) {
         throw new Exception("The locale default is set to a non-existing locale. Try adding '" . $va_locales[0] . "' to your profile.");
     }
     return true;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:50,代码来源:Installer.php


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