forked from ZwiiCMS-Team/ZwiiCMS
Paramètres du module WIP
This commit is contained in:
parent
41ae0e18e1
commit
dc31fc3ee6
@ -229,7 +229,7 @@ class common {
|
||||
}
|
||||
|
||||
// Auto traduction
|
||||
if ( $this->getData(['translate','active'])) {
|
||||
if ( $this->getData(['translate','activated'])) {
|
||||
// Lire la langue du navigateur
|
||||
$lan = substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2);
|
||||
|
||||
@ -1559,7 +1559,9 @@ class common {
|
||||
$this->setData(['locale','searchPageId',$this->getData(['config','searchPageId'])]);
|
||||
$this->setData(['locale','metaDescription',$this->getData(['config','metaDescription'])]);
|
||||
$this->setData(['locale','title',$this->getData(['config','title'])]);
|
||||
|
||||
$this->setData(['translate','activated',false]);
|
||||
$this->setData(['translate','showCredits',false]);
|
||||
$this->setData(['translate','autoDetect',false]);
|
||||
$this->setData(['core', 'dataVersion', 10400]);
|
||||
}
|
||||
}
|
||||
@ -2981,7 +2983,7 @@ class layout extends common {
|
||||
echo '<div id="i18nContainer"><ul>';
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
echo '<li>';
|
||||
echo '<img class= "flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png" />';
|
||||
echo '<a href="' . helper::baseUrl() . 'translate/language/' . $key . '"><img class= "flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png" /></a>';
|
||||
echo '</li>';
|
||||
}
|
||||
echo '</ul></div>';
|
||||
|
@ -715,7 +715,7 @@ li .menuSideChild {
|
||||
#i18nContainer {
|
||||
z-index: 100;
|
||||
position: absolute ;
|
||||
width: 80px;
|
||||
width: auto;
|
||||
height: 20px;
|
||||
margin: 5px;
|
||||
top: 5px;
|
||||
|
@ -81,8 +81,9 @@ class init extends common {
|
||||
]
|
||||
],
|
||||
'translate' => [
|
||||
'active' => false,
|
||||
'showCredits' => false
|
||||
'activated' => false,
|
||||
'showCredits' => false,
|
||||
'autoDetect' => false
|
||||
],
|
||||
'module' => [],
|
||||
'user' => [],
|
||||
|
@ -16,7 +16,8 @@ class translate extends common {
|
||||
|
||||
public static $actions = [
|
||||
/*'config' => self::GROUP_MODERATOR,*/
|
||||
'index' => self::GROUP_MODERATOR
|
||||
'index' => self::GROUP_MODERATOR,
|
||||
'language' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
/**
|
||||
@ -26,8 +27,9 @@ class translate extends common {
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
$this->setData(['translate', [
|
||||
'active' => $this->getInput('translateActive', helper::FILTER_BOOLEAN),
|
||||
'showCredits' => $this->getInput('translateActive', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false,
|
||||
'activated' => $this->getInput('translateActivated', helper::FILTER_BOOLEAN),
|
||||
'showCredits' => $this->getInput('translateCredits', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false,
|
||||
'autoDetect' => $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN)
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -41,7 +43,28 @@ class translate extends common {
|
||||
'title' => 'Paramètres',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langues
|
||||
*/
|
||||
public function language() {
|
||||
echo $this->getUrl(2);
|
||||
die();
|
||||
// Traitement du changement de langue
|
||||
if (isset($lan)) {
|
||||
$this->seti18n($lan);
|
||||
// Valeurs en sortie sans post
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl(false),
|
||||
'state' => true
|
||||
]);
|
||||
} else {
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl(false)
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -15,22 +15,38 @@
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Configuration</h4>
|
||||
<h4>Paramètres</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateActive', true, 'Traduction automatique', [
|
||||
'checked' => $this->getData(['translate', 'active']),
|
||||
'help' => 'Traduction automatique du site hors connexion par le script Google Translate selon la langue du navigateur du visiteur.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits', [
|
||||
'checked' => $this->getData(['translate', 'showCredits']),
|
||||
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
|
||||
<?php echo template::checkbox('translateActivated', true, 'Activer le mode multi-langues', [
|
||||
'checked' => $this->getData(['translate', 'activated'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Traduction automatique</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique de langue', [
|
||||
'checked' => $this->getData(['translate', 'autoDetect']),
|
||||
'help' => 'Détecte la langue du navigateur et effectue une traduction grâce à Google Translate.'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
|
||||
'checked' => $this->getData(['translate', 'showCredits']),
|
||||
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|
Loading…
Reference in New Issue
Block a user