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


PHP FWLanguage::getFallbackLanguageIdById方法代码示例

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


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

示例1: performLanguageAction

 private function performLanguageAction($action, $params)
 {
     global $_CORELANG;
     // Global access check
     if (!\Permission::checkAccess(6, 'static', true) || !\Permission::checkAccess(35, 'static', true)) {
         throw new \Cx\Core\ContentManager\ContentManagerException($_CORELANG['TXT_CORE_CM_USAGE_DENIED']);
     }
     if (!\Permission::checkAccess(53, 'static', true)) {
         throw new \Cx\Core\ContentManager\ContentManagerException($_CORELANG['TXT_CORE_CM_COPY_DENIED']);
     }
     if (!isset($params['get']) || !isset($params['get']['to'])) {
         throw new \Cx\Core\ContentManager\ContentManagerException('Illegal parameter list');
     }
     $em = \Env::get('em');
     $nodeRepo = $em->getRepository('Cx\\Core\\ContentManager\\Model\\Entity\\Node');
     $targetLang = contrexx_input2raw($params['get']['to']);
     $fromLang = \FWLanguage::getFallbackLanguageIdById($targetLang);
     if ($fromLang === false) {
         throw new \Cx\Core\ContentManager\ContentManagerException('Language has no fallback to copy/link from');
     }
     $toLangCode = \FWLanguage::getLanguageCodeById($targetLang);
     if ($toLangCode === false) {
         throw new \Cx\Core\ContentManager\ContentManagerException('Could not get id for language #"' . $targetLang . '"');
     }
     $limit = 0;
     $offset = 0;
     if (isset($params['get']['limit'])) {
         $limit = contrexx_input2raw($params['get']['limit']);
     }
     if (isset($params['get']['offset'])) {
         $offset = contrexx_input2raw($params['get']['offset']);
     }
     $result = $nodeRepo->translateRecursive($nodeRepo->getRoot(), $fromLang, $targetLang, $action == 'copy', $limit, $offset);
     return $result;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:35,代码来源:JsonContentManager.class.php

示例2: getFallback

 /**
  * Returns the fallback page of this page
  * @return \Cx\Core\ContentManager\Model\Entity\Page Fallback page or null if none
  */
 public function getFallback()
 {
     if ($this->getType() != self::TYPE_FALLBACK) {
         return null;
     }
     $fallbackLanguage = \FWLanguage::getFallbackLanguageIdById($this->getLang());
     if (!$fallbackLanguage) {
         return null;
     }
     return $this->getNode()->getPage($fallbackLanguage);
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:15,代码来源:Page.class.php

示例3: translatePage

 /**
  * Creates a translated page in this node
  *
  * Does not flush EntityManager.
  *
  * @param boolean $activate whether the new page should be activated
  * @param int $targetLang target language id
  * @returns \Cx\Core\ContentManager\Model\Entity\Page the copy
  */
 public function translatePage($activate, $targetLang)
 {
     $type = \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK;
     $fallback_language = \FWLanguage::getFallbackLanguageIdById($targetLang);
     $defaultLang = \FWLanguage::getDefaultLangId();
     // copy the corresponding language version (if there is one)
     if ($fallback_language && $this->getPage($fallback_language)) {
         $pageToTranslate = $this->getPage($fallback_language);
         // find best page to copy if no corresponding language version is present
     } else {
         if ($this->getPage($defaultLang)) {
             $pageToTranslate = $this->getPage($defaultLang);
         } else {
             $pages = $this->getPages();
             $pageToTranslate = $pages[0];
         }
         if (!$fallback_language) {
             $type = \Cx\Core\ContentManager\Model\Entity\Page::TYPE_CONTENT;
         }
     }
     // copy page following redirects
     $page = $pageToTranslate->copyToLang($targetLang, true, true, true, true, true, false, true);
     $page->setActive($activate);
     $page->setType($type);
     $pageToTranslate->setupPath($targetLang);
     return $page;
 }
开发者ID:Cloudrexx,项目名称:cloudrexx,代码行数:36,代码来源:Node.class.php

示例4: getTypeByPage

 /**
  * Returns the type of the page as string.
  * 
  * @param   \Cx\Core\ContentManager\Model\Entity\Page  $page
  * @return  string                         $type
  */
 public function getTypeByPage($page)
 {
     global $_CORELANG;
     switch ($page->getType()) {
         case \Cx\Core\ContentManager\Model\Entity\Page::TYPE_REDIRECT:
             $criteria = array('nodeIdShadowed' => $page->getTargetNodeId(), 'lang' => $page->getLang());
             $targetPage = $this->findOneBy($criteria);
             $targetTitle = $targetPage ? $targetPage->getTitle() : $page->getTarget();
             $type = $_CORELANG['TXT_CORE_CM_TYPE_REDIRECT'] . ': ';
             $type .= $targetTitle;
             break;
         case \Cx\Core\ContentManager\Model\Entity\Page::TYPE_APPLICATION:
             $type = $_CORELANG['TXT_CORE_CM_TYPE_APPLICATION'] . ': ';
             $type .= $page->getModule();
             $type .= $page->getCmd() != '' ? ' | ' . $page->getCmd() : '';
             break;
         case \Cx\Core\ContentManager\Model\Entity\Page::TYPE_FALLBACK:
             $fallbackLangId = \FWLanguage::getFallbackLanguageIdById($page->getLang());
             if ($fallbackLangId == 0) {
                 $fallbackLangId = \FWLanguage::getDefaultLangId();
             }
             $type = $_CORELANG['TXT_CORE_CM_TYPE_FALLBACK'] . ' ';
             $type .= \FWLanguage::getLanguageCodeById($fallbackLangId);
             break;
         default:
             $type = $_CORELANG['TXT_CORE_CM_TYPE_CONTENT'];
     }
     return $type;
 }
开发者ID:nahakiole,项目名称:cloudrexx,代码行数:35,代码来源:PageRepository.class.php

示例5: getFrontendTemplate

 /**
  * Load the frontend template
  *
  * @return Cx\Core\View\Model\Entity\Theme Template instance
  * @throws \Exception Throws exception when no template was found
  */
 protected function getFrontendTemplate()
 {
     // fetch and return the configured frontend template
     $theme = $this->themeRepository->findById($this->currentThemesId);
     if ($theme) {
         return $theme;
     }
     // The configured frontend template does not exist
     \DBG::msg('Template width ID ' . $this->currentThemesId . ' does not exist!');
     // We will try to load the frontend template of a fallback-language therefore
     $langId = $this->frontendLangId;
     while ($langId = \FWLanguage::getFallbackLanguageIdById($langId)) {
         // fetch and return default template of fallback language
         $theme = $this->themeRepository->getDefaultTheme($this->currentChannel, $langId);
         if ($theme) {
             // reset local variables based on the loaded fallback frontend template
             $this->channelThemeId = $this->currentThemesId = $theme->getId();
             return $theme;
         }
         // template of fallback language does not exist
         \DBG::msg('Default template of language ' . $langId . ' does not exist!');
     }
     // None of the fallback-languages did have an existing frontend template.
     // Therefore, we will abort the system execution now
     throw new \Exception('Unable to load a webdesign template!');
 }
开发者ID:hbdsklf,项目名称:LimeCMS,代码行数:32,代码来源:Init.class.php


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