Options pages admin + choix et position des drapeux
This commit is contained in:
parent
949e4468c5
commit
51361afc12
@ -143,10 +143,10 @@ class common {
|
||||
];
|
||||
// Langues proposées
|
||||
public static $i18nList = [
|
||||
'fr' => 'Français (fr)',
|
||||
'de' => 'Allemand (de)',
|
||||
'en' => 'Anglais (en)',
|
||||
'es' => 'Espagnol (es)',
|
||||
'fr' => 'Français (fr)',
|
||||
'it' => 'Italien (it)',
|
||||
'nl' => 'Néerlandais (nl)',
|
||||
'pt' => 'Portugais (pt)',
|
||||
@ -2156,9 +2156,12 @@ class core extends common {
|
||||
}
|
||||
|
||||
// Librairie googtrans ajouté dynamiquement
|
||||
if ( substr($_SERVER['HTTP_ACCEPT_LANGUAGE'], 0, 2) !== 'fr'
|
||||
AND $this->getData(['config','translate','activated']) === true
|
||||
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) {
|
||||
if ( $this->getData(['config','translate','activated']) === true
|
||||
AND ( $this->getData(['config','translate','admin']) === true
|
||||
OR $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')
|
||||
)
|
||||
)
|
||||
{
|
||||
$this->addOutput([
|
||||
'vendor' => array_merge($this->output['vendor'], ['i18n'])
|
||||
]);
|
||||
@ -2986,13 +2989,14 @@ class layout extends common {
|
||||
* Affiche le cadre avec les drapeaux
|
||||
*/
|
||||
public function showi18n() {
|
||||
if ( $this->getData(['config','translate','activated']) === true
|
||||
AND $this->getUser('password') !== $this->getInput('ZWII_USER_PASSWORD')) {
|
||||
if ( $this->getData(['config','translate','activated']) === true ) {
|
||||
echo '<div id="i18nContainer"><ul>';
|
||||
foreach (self::$i18nList as $key => $value) {
|
||||
echo '<li>';
|
||||
echo '<a href="' . helper::baseUrl() . 'translate/language/' . $key . '"><img class= "flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png" /></a>';
|
||||
echo '</li>';
|
||||
if ($this->getData(['config','translate','flag' . strtoupper($key)]) ) {
|
||||
echo '<li>';
|
||||
echo '<a href="' . helper::baseUrl() . 'translate/language/' . $key . '/' . $this->getUrl(0) . '"><img class= "flag" src="' . helper::baseUrl(false) . 'core/vendor/i18n/png/' . $key . '.png" /></a>';
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
echo '</ul></div>';
|
||||
}
|
||||
|
@ -730,6 +730,10 @@ li .menuSideChild {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#i18nContainer img {
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -45,7 +45,16 @@ class init extends common {
|
||||
'translate' => [
|
||||
'activated' => false,
|
||||
'showCredits' => false,
|
||||
'autoDetect' => false
|
||||
'autoDetect' => false,
|
||||
'admin' => false,
|
||||
'translateFlagFR' => true,
|
||||
'translateFlagDE' => true,
|
||||
'translateFlagEN' => true,
|
||||
'translateFlagES' => false,
|
||||
'translateFlagIT' => false,
|
||||
'translateFlagNL' => false,
|
||||
'translateFlagPT' => false
|
||||
|
||||
],
|
||||
],
|
||||
'core' => [
|
||||
|
@ -29,7 +29,15 @@ class translate extends common {
|
||||
$this->setData(['config','translate', [
|
||||
'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)
|
||||
'autoDetect' => $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN),
|
||||
'admin' => $this->getInput('translateAdmin', helper::FILTER_BOOLEAN),
|
||||
'flagFR' => $this->getInput('translateFlagFR', helper::FILTER_BOOLEAN),
|
||||
'flagDE' => $this->getInput('translateFlagDE', helper::FILTER_BOOLEAN),
|
||||
'flagEN' => $this->getInput('translateFlagEN', helper::FILTER_BOOLEAN),
|
||||
'flagES' => $this->getInput('translateFlagES', helper::FILTER_BOOLEAN),
|
||||
'flagIT' => $this->getInput('translateFlagIT', helper::FILTER_BOOLEAN),
|
||||
'flagNL' => $this->getInput('translateFlagNL', helper::FILTER_BOOLEAN),
|
||||
'flagPT' => $this->getInput('translateFlagPT', helper::FILTER_BOOLEAN)
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
@ -53,7 +61,7 @@ class translate extends common {
|
||||
setcookie('ZWII_USER_I18N', $this->getUrl(2), time() + 3600, helper::baseUrl(false, false) , '', helper::isHttps(), true);
|
||||
// Valeurs en sortie sans post
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl(false)
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(3)
|
||||
]);
|
||||
}
|
||||
}
|
@ -22,6 +22,11 @@
|
||||
'checked' => $this->getData(['config','translate', 'activated'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<?php echo template::checkbox('translateAdmin', true, 'Traduire les pages d\'administration', [
|
||||
'checked' => $this->getData(['config','translate', 'admin'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -44,8 +49,45 @@
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagFR', true, 'Français', [
|
||||
'checked' => $this->getData(['config','translate', 'flagFR'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagDE', true, 'Allemand', [
|
||||
'checked' => $this->getData(['config','translate', 'flagDE'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagEN', true, 'Anglais', [
|
||||
'checked' => $this->getData(['config','translate', 'flagEN'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagES', true, 'Espagnol', [
|
||||
'checked' => $this->getData(['config','translate', 'flagES'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagIT', true, 'Italien', [
|
||||
'checked' => $this->getData(['config','translate', 'flagIT'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagNL', true, 'Néerlandais', [
|
||||
'checked' => $this->getData(['config','translate', 'flagNL'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col3">
|
||||
<?php echo template::checkbox('translateFlagPT', true, 'Portugais', [
|
||||
'checked' => $this->getData(['config','translate', 'flagPT'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user