Пример #1
0
 public function view()
 {
     $uh = Loader::helper('concrete/urls');
     $bt = BlockType::getByHandle('switch_language');
     Loader::model('section', 'multilingual');
     $ml = MultilingualSection::getList();
     $c = Page::getCurrentPage();
     $al = MultilingualSection::getBySectionOfSite($c);
     $languages = array();
     $locale = ACTIVE_LOCALE;
     if (is_object($al)) {
         $locale = $al->getLanguage();
     }
     foreach ($ml as $m) {
         $languages[$m->getCollectionID()] = $m->getLanguageText($locale) . ' ' . (strlen($m->msIcon) ? '(' . $m->msIcon . ')' : '');
     }
     $this->set('languages', $languages);
     $this->set('languageSections', $ml);
     $this->set('action', $uh->getBlockTypeToolsURL($bt) . '/switch');
     if (is_object($al)) {
         $this->set('activeLanguage', $al->getCollectionID());
     }
     $pkg = Package::getByHandle('multilingual');
     $mdl = Loader::helper('default_language', 'multilingual');
     $this->set('defaultLanguage', $mdl->getSessionDefaultLocale());
     $this->set('cID', $c->getCollectionID());
 }
Пример #2
0
 public function view()
 {
     Loader::model('section', 'multilingual');
     $list = MultilingualSection::getList();
     $sections = array();
     foreach ($list as $pc) {
         $sections[$pc->getCollectionID()] = $pc->getLanguageText() . " (" . $pc->getLocale() . ")";
     }
     $this->set('sections', $sections);
     $this->set('sectionList', $list);
     if (!isset($_REQUEST['sectionID']) && count($sections) > 0) {
         foreach ($sections as $key => $value) {
             $sectionID = $key;
             break;
         }
     } else {
         $sectionID = $_REQUEST['sectionID'];
     }
     if (!isset($_REQUEST['targets']) && count($sections) > 1) {
         $i = 0;
         foreach ($sections as $key => $value) {
             if ($key != $sectionID) {
                 $targets[$key] = $key;
                 break;
             }
             $i++;
         }
     } else {
         $targets = $_REQUEST['targets'];
     }
     if (!isset($targets) || !is_array($targets)) {
         $targets = array();
     }
     $targetList = array();
     foreach ($targets as $key => $value) {
         $targetList[] = MultilingualSection::getByID($key);
     }
     $this->set('targets', $targets);
     $this->set('targetList', $targetList);
     $this->set('sectionID', $sectionID);
     if (isset($sectionID) && $sectionID > 0) {
         Loader::model('multilingual_page_list', 'multilingual');
         $pl = new MultilingualPageList();
         $pl->filterByIsAlias(false);
         $pc = Page::getByID($sectionID);
         $pl->filterByPath($pc->getCollectionPath());
         $pl->setItemsPerPage(25);
         $pl->ignoreAliases();
         if (!$_REQUEST['showAllPages']) {
             $pl->filterByMissingTargets($targetList);
         }
         $pages = $pl->getPage();
         $this->set('pages', $pages);
         $this->set('section', MultilingualSection::getByID($sectionID));
         $this->set('pl', $pl);
     }
 }
Пример #3
0
 public function __construct()
 {
     $mslist = MultilingualSection::getList();
     $query = ',  (select mpRelationID from MultilingualPageRelations where cID = p1.cID LIMIT 1) as mpr';
     foreach ($mslist as $ms) {
         $query .= ', (select count(mpRelationID) from MultilingualPageRelations where MultilingualPageRelations.mpRelationID = mpr and mpLocale = \'' . $ms->getLocale() . '\') as relationCount' . $ms->getCollectionID();
     }
     $this->setBaseQuery($query);
 }
Пример #4
0
 public function view()
 {
     Loader::library('3rdparty/Zend/Locale');
     Loader::library('content_localization', 'multilingual');
     $localesx = MultilingualContentLocalization::getLanguages();
     $locales = array('' => t('** Choose a Language'));
     foreach ($localesx as $key => $value) {
         // remove languages like klingon
         //if (strlen($key) < 3) {
         $locales[$key] = $value;
         //}
     }
     asort($locales);
     $this->set('ch', Loader::helper('interface/flag', 'multilingual'));
     $this->set('pages', MultilingualSection::getList());
     $this->set('locales', $locales);
     $pkg = Package::getByHandle('multilingual');
     $this->set('defaultLanguage', $pkg->config('DEFAULT_LANGUAGE'));
     $this->set('redirectHomeToDefaultLanguage', $pkg->config('REDIRECT_HOME_TO_DEFAULT_LANGUAGE'));
     $this->set('useBrowserDetectedLanguage', $pkg->config('TRY_BROWSER_LANGUAGE'));
 }
Пример #5
0
$class1 = 'icon-select-list';
$class2 = 'icon-select-page';
if (version_compare(APP_VERSION, '5.5.2.2', '>')) {
    $class1 = 'item-select-list';
    $class2 = 'item-select-page';
}
$c = Page::getByID($_REQUEST['cID'], 'RECENT');
$cp = new Permissions($c);
$pc = Page::getByPath('/dashboard/multilingual');
$pcp = new Permissions($pc);
$nav = Loader::helper('navigation');
$ih = Loader::helper('interface/flag', 'multilingual');
if ($cp->canRead() && $pcp->canRead()) {
    // grab all languages
    Loader::model('section', 'multilingual');
    $mlist = MultilingualSection::getList();
    $currentSection = MultilingualSection::getCurrentSection();
    $ml[] = $currentSection;
    foreach ($mlist as $m) {
        if ($m->getCollectionID() != $currentSection->getCollectionID()) {
            $ml[] = $m;
        }
    }
    // then loop through them and show if a page exists
    ?>

	<ul class="<?php 
    echo $class1;
    ?>
">
	<?php 
Пример #6
0
 /** Adds the link rel="alternate" hreflang=".." href=".." tag to the specified page.
  * @param Page $page
  */
 public function addAlternateHrefLang($page)
 {
     if ($page || ($page = Page::getCurrentPage())) {
         if (!$page->isAdminArea()) {
             if ($lang = MultilingualSection::getBySectionOfSite($page)) {
                 if (!is_array(self::$_allLanguages)) {
                     self::$_allLanguages = MultilingualSection::getList();
                 }
                 $html = Loader::helper('html');
                 $navigation = Loader::helper('navigation');
                 $v = View::getInstance();
                 if (!$page->isAlias() && $page->cID == $lang->cID) {
                     $isRoot = true;
                 } else {
                     $isRoot = false;
                 }
                 foreach (self::$_allLanguages as $otherLang) {
                     if ($otherLang->msLocale != $lang->msLocale) {
                         if ($isRoot) {
                             $otherPage = $otherLang;
                         } else {
                             $otherPage = $this->getTranslatedPageWithAliasSupport($page, $otherLang, false);
                         }
                         if ($otherPage) {
                             $v->addHeaderItem('<link rel="alternate" hreflang="' . $otherLang->msLocale . '" href="' . $navigation->getLinkToCollection($otherPage) . '" />');
                         }
                     }
                 }
             }
         }
     }
 }