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


PHP ConfigQuery::getDefaultLangWhenNoTranslationAvailable方法代码示例

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


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

示例1: renderDefault

 public function renderDefault(array $param = array(), $status = 200)
 {
     $data = array();
     foreach (LangQuery::create()->find() as $lang) {
         $data[LangUrlForm::LANG_PREFIX . $lang->getId()] = $lang->getUrl();
     }
     $langUrlForm = $this->createForm(AdminForm::LANG_URL, 'form', $data);
     $this->getParserContext()->addForm($langUrlForm);
     return $this->render('languages', array_merge($param, array('lang_without_translation' => ConfigQuery::getDefaultLangWhenNoTranslationAvailable(), 'one_domain_per_lang' => ConfigQuery::isMultiDomainActivated())), $status);
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:10,代码来源:LangController.php

示例2: renderDefault

 public function renderDefault(array $param = array())
 {
     $data = array();
     foreach (LangQuery::create()->find() as $lang) {
         $data[LangUrlForm::LANG_PREFIX . $lang->getId()] = $lang->getUrl();
     }
     $langUrlForm = new LangUrlForm($this->getRequest(), 'form', $data);
     $this->getParserContext()->addForm($langUrlForm);
     return $this->render('languages', array_merge($param, array('lang_without_translation' => ConfigQuery::getDefaultLangWhenNoTranslationAvailable(), 'one_domain_per_lang' => ConfigQuery::read("one_domain_foreach_lang", false))));
 }
开发者ID:alex63530,项目名称:thelia,代码行数:10,代码来源:LangController.php

示例3: getProduct

 public function getProduct(ConnectionInterface $con = null, $locale = null)
 {
     $product = parent::getProduct($con);
     $translation = $product->getTranslation($locale);
     if ($translation->isNew()) {
         if (ConfigQuery::getDefaultLangWhenNoTranslationAvailable()) {
             $locale = Lang::getDefaultLanguage()->getLocale();
         }
     }
     $product->setLocale($locale);
     return $product;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:12,代码来源:CartItem.php

示例4: getFrontEndI18n

 /**
  * @param ModelCriteria $search
  * @param               $requestedLocale
  * @param array $columns
  * @param null $foreignTable
  * @param string $foreignKey
  * @param bool $forceReturn
  * @param string $forceReturn
  */
 public static function getFrontEndI18n(ModelCriteria &$search, $requestedLocale, $columns, $foreignTable, $foreignKey, $forceReturn = false, $localeAlias = null)
 {
     if (!empty($columns)) {
         if ($foreignTable === null) {
             $foreignTable = $search->getTableMap()->getName();
             $aliasPrefix = '';
         } else {
             $aliasPrefix = $foreignTable . '_';
         }
         if ($localeAlias === null) {
             $localeAlias = $search->getTableMap()->getName();
         }
         $defaultLangWithoutTranslation = ConfigQuery::getDefaultLangWhenNoTranslationAvailable();
         $requestedLocaleI18nAlias = $aliasPrefix . 'requested_locale_i18n';
         $defaultLocaleI18nAlias = $aliasPrefix . 'default_locale_i18n';
         if ($defaultLangWithoutTranslation == Lang::STRICTLY_USE_REQUESTED_LANGUAGE) {
             $requestedLocaleJoin = new Join();
             $requestedLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias);
             $requestedLocaleJoin->setJoinType($forceReturn === false ? Criteria::INNER_JOIN : Criteria::LEFT_JOIN);
             $defaultLocaleJoin = new Join();
             $defaultLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias);
             $search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias)->addJoinCondition($requestedLocaleI18nAlias, '`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR);
             $search->addJoinObject($defaultLocaleJoin, $defaultLocaleI18nAlias)->addJoinCondition($defaultLocaleI18nAlias, '`' . $defaultLocaleI18nAlias . '`.LOCALE <> ?', $requestedLocale, null, \PDO::PARAM_STR);
             $search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED');
             foreach ($columns as $column) {
                 $search->withColumn('`' . $requestedLocaleI18nAlias . '`.`' . $column . '`', $aliasPrefix . 'i18n_' . $column);
             }
         } else {
             $defaultLocale = Lang::getDefaultLanguage()->getLocale();
             $defaultLocaleJoin = new Join();
             $defaultLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $defaultLocaleI18nAlias);
             $defaultLocaleJoin->setJoinType(Criteria::LEFT_JOIN);
             $search->addJoinObject($defaultLocaleJoin, $defaultLocaleI18nAlias)->addJoinCondition($defaultLocaleI18nAlias, '`' . $defaultLocaleI18nAlias . '`.LOCALE = ?', $defaultLocale, null, \PDO::PARAM_STR);
             $requestedLocaleJoin = new Join();
             $requestedLocaleJoin->addExplicitCondition($localeAlias, $foreignKey, null, $foreignTable . '_i18n', 'ID', $requestedLocaleI18nAlias);
             $requestedLocaleJoin->setJoinType(Criteria::LEFT_JOIN);
             $search->addJoinObject($requestedLocaleJoin, $requestedLocaleI18nAlias)->addJoinCondition($requestedLocaleI18nAlias, '`' . $requestedLocaleI18nAlias . '`.LOCALE = ?', $requestedLocale, null, \PDO::PARAM_STR);
             $search->withColumn('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.`ID`)', $aliasPrefix . 'IS_TRANSLATED');
             if ($forceReturn === false) {
                 $search->where('NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.ID)')->_or()->where('NOT ISNULL(`' . $defaultLocaleI18nAlias . '`.ID)');
             }
             foreach ($columns as $column) {
                 $search->withColumn('CASE WHEN NOT ISNULL(`' . $requestedLocaleI18nAlias . '`.ID) THEN `' . $requestedLocaleI18nAlias . '`.`' . $column . '` ELSE `' . $defaultLocaleI18nAlias . '`.`' . $column . '` END', $aliasPrefix . 'i18n_' . $column);
             }
         }
     }
 }
开发者ID:zorn-v,项目名称:thelia,代码行数:56,代码来源:ModelCriteriaTools.php


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