Ejemplo n.º 1
0
 protected function _getLangNavigation()
 {
     global $REX;
     // ul id
     if ($this->langUlId == '') {
         $ulIdAttribute = '';
     } else {
         $ulIdAttribute = ' id="' . $this->langUlId . '"';
     }
     $out = '<ul' . $ulIdAttribute . '>';
     foreach ($REX['CLANG'] as $clangId => $clangName) {
         $article = OOArticle::getArticleById($REX['ARTICLE_ID'], $clangId);
         // new article id
         if (OOArticle::isValid($article) && $article->isOnline()) {
             $newArticleId = $article->getId();
             $articleStatus = true;
         } else {
             $newArticleId = $REX['START_ARTICLE_ID'];
             $articleStatus = false;
         }
         if (!$articleStatus && $this->langHideLiIfOfflineArticle) {
             // do nothing
         } else {
             $langCode = '';
             $originalName = '';
             $langSlug = '';
             if (class_exists('seo42')) {
                 $langCode = seo42::getLangCode($clangId);
                 $originalName = seo42::getOriginalLangName($clangId);
                 $langSlug = seo42::getLangUrlSlug($clangId);
             }
             if ($langCode == '') {
                 $langCode = $clangName;
             }
             if ($originalName == '') {
                 $originalName = $clangName;
             }
             if ($langSlug == '') {
                 $langSlug = $clangName;
             }
             // link text
             if ($this->langUseLangCodeAsLinkText) {
                 $linkText = $langCode;
             } else {
                 $linkText = $originalName;
             }
             if ($this->langUpperCaseLinkText) {
                 $linkText = strtoupper($linkText);
             }
             // li attribute
             if ($this->langShowLiIds) {
                 $liIdAttribute = ' id="' . $langSlug . '"';
             } else {
                 $liIdAttribute = '';
             }
             // class attribute
             if ($REX['CUR_CLANG'] == $clangId) {
                 $liClassAttribute = ' class="' . $this->langSelectedClass . '"';
             } else {
                 $liClassAttribute = '';
             }
             // li out
             $out .= '<li' . $liIdAttribute . $liClassAttribute . '><a href="' . rex_getUrl($newArticleId, $clangId) . '">' . $linkText . '</a></li>';
         }
     }
     $out .= '</ul>';
     return $out;
 }