コード例 #1
0
ファイル: page_report.php プロジェクト: Zyqsempai/amanet
 public function assign_page()
 {
     Loader::model('section', 'multilingual');
     if (Loader::helper('validation/token')->validate('assign_page', $_POST['token'])) {
         if ($_REQUEST['destID'] == $_REQUEST['sourceID']) {
             print '<span class="ccm-error">' . t("You cannot assign this page to itself.") . '</span>';
             exit;
         }
         $destPage = Page::getByID($_POST['destID']);
         if (MultilingualSection::isMultilingualSection($destPage)) {
             $ms = MultilingualSection::getByID($destPage->getCollectionID());
         } else {
             $ms = MultilingualSection::getBySectionOfSite($destPage);
         }
         if (is_object($ms)) {
             $page = Page::getByID($_POST['sourceID']);
             // we need to assign/relate the source ID too, if it doesn't exist
             if (!MultilingualSection::isAssigned($page)) {
                 MultilingualSection::assignAdd($page);
             }
             MultilingualSection::relatePage($page, $destPage, $ms->getLocale());
             print '<a href="' . Loader::helper("navigation")->getLinkToCollection($destPage) . '">' . $destPage->getCollectionName() . '</a>';
         } else {
             print '<span class="ccm-error">' . t("The destination page doesn't appear to be in a valid multilingual section.") . '</span>';
         }
     }
     exit;
 }
コード例 #2
0
ファイル: translated_pages.php プロジェクト: Zyqsempai/amanet
 public function getTranslatedPages($page = false, $sans = false)
 {
     $langms = new MultilingualSection();
     if ($page) {
         $ms = MultilingualSection::getByID($page->getCollectionID());
     } else {
         $page = Page::getCurrentPage();
         $ms = MultilingualSection::getCurrentSection();
     }
     if (is_object($ms)) {
         $lang = $ms->getLocale();
     }
     if ($sans) {
         $locales = self::getLocales($sans);
     } else {
         $locales = self::getLocales($lang);
     }
     $tpages = array();
     foreach ($locales as $locale) {
         $langms->msLocale = $locale;
         $id = $langms->getTranslatedPageID($page);
         $transPage = Page::getByID($id);
         $transPage->locale = $locale;
         if ($id > 0) {
             $tpages[$locale] = $transPage;
         }
     }
     return $tpages;
 }
コード例 #3
0
ファイル: setup.php プロジェクト: Zyqsempai/amanet
	<p><?php 
            echo t('Since one of your multilingual sections is the home page, you may not duplicate your site tree using this tool. You must manually assign pages using the page report.');
            ?>
</p>

<?php 
        }
    }
}
?>

<?php 
if (count($pages) > 0) {
    $defaultLanguages = array('' => t('** None Set'));
    foreach ($pages as $pc) {
        $pcl = MultilingualSection::getByID($pc->getCollectionID());
        $defaultLanguages[$pcl->getLocale()] = $pcl->getLanguageText();
    }
    $defaultLanguagesSelect = $form->select('defaultLanguage', $defaultLanguages, $defaultLanguage);
    ?>

<br/>

<h3><?php 
    echo t('Multilingual Settings');
    ?>
</h3>

	<form method="post" action="<?php 
    echo $this->action('set_default');
    ?>
コード例 #4
0
ファイル: setup.php プロジェクト: Zyqsempai/amanet
 public function add_content_section()
 {
     if (Loader::helper('validation/token')->validate('add_content_section')) {
         if (!Loader::helper('validation/numbers')->integer($this->post('pageID')) || $this->post('pageID') < 1) {
             $this->error->add(t('You must specify a page for this multilingual content section.'));
         } else {
             $pc = Page::getByID($this->post('pageID'));
         }
         if (!$this->error->has()) {
             $lc = MultilingualSection::getByID($this->post('pageID'));
             if (is_object($lc)) {
                 $this->error->add(t('A language section page at this location already exists.'));
             }
         }
         if (!$this->error->has()) {
             if ($this->post('msIcon')) {
                 $combination = $this->post('msLanguage') . '_' . $this->post('msIcon');
                 $locale = MultilingualSection::getByLocale($combination);
                 if (is_object($locale)) {
                     $this->error->add(t('This language/region combination already exists.'));
                 }
             }
         }
         if (!$this->error->has()) {
             MultilingualSection::assign($pc, $this->post('msLanguage'), $this->post('msIcon'));
             $this->redirect('/dashboard/multilingual/setup', 'multilingual_content_updated');
         }
     } else {
         $this->error->add(Loader::helper('validation/token')->getErrorMessage());
     }
     $this->view();
 }
コード例 #5
0
ファイル: switch.php プロジェクト: Zyqsempai/amanet
<?php

defined('C5_EXECUTE') or die(_("Access Denied."));
Loader::model('section', 'multilingual');
// first we get the selected language
if (isset($_POST['ccmMultilingualSiteDefaultLanguage'])) {
    // this is coming from "set default" custom template
    if (isset($_POST['ccmMultilingualSiteRememberDefault']) && $_POST['ccmMultilingualSiteRememberDefault']) {
        setcookie('DEFAULT_LOCALE', $_POST['ccmMultilingualSiteDefaultLanguage'], time() + 60 * 60 * 24 * 365, DIR_REL . '/');
    }
    if (empty($_POST['ccmMultilingualSiteRememberDefault'])) {
        setcookie('DEFAULT_LOCALE', '', time() - 3600, DIR_REL . '/');
    }
    $lang = MultilingualSection::getByLocale($_REQUEST['ccmMultilingualSiteDefaultLanguage']);
} else {
    $lang = MultilingualSection::getByID($_REQUEST['ccmMultilingualChooseLanguage']);
}
if (is_object($lang)) {
    if (isset($_REQUEST['ccmMultilingualCurrentPageID'])) {
        $page = Page::getByID($_REQUEST['ccmMultilingualCurrentPageID']);
        if (!$page->isError()) {
            $relatedID = $lang->getTranslatedPageID($page);
            if ($relatedID) {
                $pc = Page::getByID($relatedID);
                header('Location: ' . Loader::helper('navigation')->getLinkToCollection($pc, true));
                exit;
            } elseif ($page->isGeneratedCollection()) {
                $_SESSION['DEFAULT_LOCALE'] = (string) $lang->getLocale();
                header('Location: ' . Loader::helper('navigation')->getLinkToCollection($page, true));
                exit;
            }
コード例 #6
0
ファイル: section.php プロジェクト: Zyqsempai/amanet
 public static function assignMove($page, $oldParent, $newParent)
 {
     if (self::isMultilingualSection($newParent)) {
         $ms = MultilingualSection::getByID($newParent->getCollectionID());
     } else {
         $ms = MultilingualSection::getBySectionOfSite($newParent);
     }
     if (self::isMultilingualSection($oldParent)) {
         $msx = MultilingualSection::getByID($oldParent->getCollectionID());
     } else {
         $msx = MultilingualSection::getBySectionOfSite($oldParent);
     }
     $db = Loader::db();
     if (is_object($ms)) {
         $cID = $db->GetOne('select cID from MultilingualPageRelations where cID = ?', array($page->getCollectionID()));
         if (!$cID) {
             $mpRelationID = $db->GetOne('select max(mpRelationID) as mpRelationID from MultilingualPageRelations');
             if (!$mpRelationID) {
                 $mpRelationID = 1;
             } else {
                 $mpRelationID++;
             }
             $v = array($mpRelationID, $page->getCollectionID(), $ms->getLanguage(), $ms->getLocale());
             $db->Execute('insert into MultilingualPageRelations (mpRelationID, cID, mpLanguage, mpLocale) values (?, ?, ?, ?)', $v);
         } else {
             $db->Execute('update MultilingualPageRelations set mpLanguage = ? where cID = ?', array($ms->getLanguage(), $page->getCollectionID()));
         }
         // now we check to see if the new target section has a different theme
         if (is_object($ms) && is_object($msx)) {
             if ($ms->getCollectionThemeID() != $msx->getCollectionThemeID()) {
                 $pt = $ms->getCollectionThemeObject();
                 $page->setTheme($pt);
             }
         }
     } else {
         self::assignDelete($page);
     }
 }
コード例 #7
0
ファイル: page_report.php プロジェクト: Zyqsempai/amanet
	<?php 
    if (count($pages) > 0) {
        ?>
		<?php 
        echo $pl->displaySummary();
        ?>
	<?php 
    }
    ?>


		<table class="ccm-results-list" cellspacing="0" cellpadding="0" border="0" id="ccm-multilingual-page-report-results">
		<thead>
		<tr>
			<th><?php 
    $sourceMS = MultilingualSection::getByID($sectionID);
    print $sourceMS->getLanguageText();
    echo " (" . $sourceMS->getLocale() . ")";
    ?>
</th>
			<?php 
    foreach ($targetList as $sc) {
        ?>
				<?php 
        if ($section->getCollectionID() != $sc->getCollectionID()) {
            ?>
					<th><?php 
            print $sc->getLanguageText();
            echo " (" . $sc->getLocale() . ")";
            ?>
</th>