Supp dossier translate
Before Width: | Height: | Size: 119 B |
Before Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 287 B |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 96 B |
Before Width: | Height: | Size: 108 B |
Before Width: | Height: | Size: 395 B |
@ -1,110 +0,0 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
class translate extends common {
|
||||
|
||||
public static $actions = [
|
||||
/*'config' => self::GROUP_MODERATOR,*/
|
||||
'index' => self::GROUP_MODERATOR,
|
||||
'language' => self::GROUP_VISITOR
|
||||
];
|
||||
|
||||
/**
|
||||
* Configuration
|
||||
*/
|
||||
public function index() {
|
||||
|
||||
// Soumission du formulaire
|
||||
if($this->isPost()) {
|
||||
// Edtion des langues
|
||||
foreach (self::$i18nList as $keyi18n => $value) {
|
||||
if ($keyi18n === 'fr') {continue;}
|
||||
// Effacement d'une langue installée (dossier plus option désactivée précédemment)
|
||||
if ( is_dir( self::DATA_DIR . $keyi18n ) === true
|
||||
AND $this->getInput('translateSiteFlag' . strtoupper($keyi18n) , helper::FILTER_BOOLEAN) === false )
|
||||
{
|
||||
$this->removeDir( self::DATA_DIR . $keyi18n);
|
||||
}
|
||||
// Installation d'une langue
|
||||
if ( $this->getInput('translateSiteFlag' . strtoupper($keyi18n) , helper::FILTER_BOOLEAN) === true )
|
||||
{
|
||||
// Créer le dossier
|
||||
if (is_dir( self::DATA_DIR . $keyi18n ) === false ) {
|
||||
mkdir( self::DATA_DIR . $keyi18n);
|
||||
}
|
||||
// Charger les modèles
|
||||
require_once('core/module/install/ressource/defaultdata.php');
|
||||
// Nouvelle instance des pages, module, locale
|
||||
$files = ['page','module','locale'];
|
||||
foreach ($files as $keyFile) {
|
||||
echo $keyFile;
|
||||
$e = new \Prowebcraft\JsonDb([
|
||||
'name' => $keyFile . '.json',
|
||||
'dir' => $this->dataPath ($keyFile,$keyi18n)
|
||||
]);;
|
||||
$e->set($keyFile, init::$defaultData[$keyFile]);
|
||||
$e->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Enregistrement des données
|
||||
$this->setData(['config','translate', [
|
||||
'scriptGoogle' => $this->getInput('translateScriptGoogle', helper::FILTER_BOOLEAN),
|
||||
'showCredits' => $this->getInput('translateCredits', helper::FILTER_BOOLEAN) ? $this->getInput('translateCredits', helper::FILTER_BOOLEAN) : false,
|
||||
'autoDetect' => $this->getInput('translateAutoDetect', helper::FILTER_BOOLEAN),
|
||||
'admin' => $this->getInput('translateAdmin', helper::FILTER_BOOLEAN),
|
||||
'scriptFR' => $this->getInput('translateScriptFlagFR', helper::FILTER_BOOLEAN),
|
||||
'scriptDE' => $this->getInput('translateScriptFlagDE', helper::FILTER_BOOLEAN),
|
||||
'scriptEN' => $this->getInput('translateScriptFlagEN', helper::FILTER_BOOLEAN),
|
||||
'scriptES' => $this->getInput('translateScriptFlagES', helper::FILTER_BOOLEAN),
|
||||
'scriptIT' => $this->getInput('translateScriptFlagIT', helper::FILTER_BOOLEAN),
|
||||
'scriptNL' => $this->getInput('translateScriptFlagNL', helper::FILTER_BOOLEAN),
|
||||
'scriptPT' => $this->getInput('translateScriptFlagPT', helper::FILTER_BOOLEAN),
|
||||
'site' => $this->getInput('translateSite', helper::FILTER_BOOLEAN),
|
||||
'siteFR' => $this->getInput('translateSiteFlagFR', helper::FILTER_BOOLEAN),
|
||||
'siteDE' => $this->getInput('translateSiteFlagDE', helper::FILTER_BOOLEAN),
|
||||
'siteEN' => $this->getInput('translateSiteFlagEN', helper::FILTER_BOOLEAN),
|
||||
'siteES' => $this->getInput('translateSiteFlagES', helper::FILTER_BOOLEAN),
|
||||
'siteIT' => $this->getInput('translateSiteFlagIT', helper::FILTER_BOOLEAN),
|
||||
'siteNL' => $this->getInput('translateSiteFlagNL', helper::FILTER_BOOLEAN),
|
||||
'sitePT' => $this->getInput('translateSiteFlagPT', helper::FILTER_BOOLEAN)
|
||||
]]);
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'redirect' => helper::baseUrl() . $this->getUrl(),
|
||||
'notification' => 'Modifications enregistrées',
|
||||
'state' => true
|
||||
]);
|
||||
}
|
||||
// Valeurs en sortie
|
||||
$this->addOutput([
|
||||
'title' => 'Paramètres',
|
||||
'view' => 'index'
|
||||
]);
|
||||
}
|
||||
|
||||
/*
|
||||
* Traitement du changement de langues
|
||||
*/
|
||||
public function language() {
|
||||
// Transmettre le choix au noyau
|
||||
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() . $this->getUrl(3)
|
||||
]);
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
/**
|
||||
* This file is part of Zwii.
|
||||
*
|
||||
* For full copyright and license information, please see the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*
|
||||
* @author Rémi Jean <remi.jean@outlook.com>
|
||||
* @copyright Copyright (C) 2008-2018, Rémi Jean
|
||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||
* @copyright Copyright (C) 2018-2021, Frédéric Tempez
|
||||
* @license GNU General Public License, version 3
|
||||
* @link http://zwiicms.fr/
|
||||
*/
|
||||
|
||||
|
||||
/** @import url("site/data/admin.css"); */
|
||||
|
||||
/** NE PAS EFFACER
|
||||
* admin.css
|
||||
*/
|
@ -1,124 +0,0 @@
|
||||
<?php echo template::formOpen('translateForm'); ?>
|
||||
<div class="row">
|
||||
<div class="col2">
|
||||
<?php echo template::button('translateFormBack', [
|
||||
'class' => 'buttonGrey',
|
||||
'href' => helper::baseUrl(),
|
||||
'ico' => 'left',
|
||||
'value' => 'Retour'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col2 offset8">
|
||||
<?php echo template::submit('translateFormSubmit'); ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Langues supportées</h4>
|
||||
<div class="row">
|
||||
<div class="col6">
|
||||
<b>Traduction automatique :</b>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateScriptFlagDE', true, 'Allemand', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptDE'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateScriptFlagEN', true, 'Anglais', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptEN'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateScriptFlagES', true, 'Espagnol', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptES'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateScriptFlagIT', true, 'Italien', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptIT'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateScriptFlagNL', true, 'Néerlandais', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptNL'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateScriptFlagPT', true, 'Portugais', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptPT'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateAutoDetect', true, 'Détection automatique', [
|
||||
'checked' => $this->getData(['config','translate', 'autoDetect']),
|
||||
'help' => 'Détecte la langue du navigateur.'
|
||||
]); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="col6">
|
||||
<b>Traduction rédigée :</b>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateSiteFlagEN', true, 'Anglais', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteEN'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateSiteFlagDE', true, 'Allemand', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteDE'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateSiteFlagES', true, 'Espagnol', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteES'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateSiteFlagIT', true, 'Italien', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteIT'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateSiteFlagNL', true, 'Néerlandais', [
|
||||
'checked' => $this->getData(['config', 'translate', 'siteNL'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col12">
|
||||
<?php echo template::checkbox('translateSiteFlagPT', true, 'Portugais', [
|
||||
'checked' => $this->getData(['config', 'translate', 'sitePT'])
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col12">
|
||||
<div class="block">
|
||||
<h4>Paramètres de traduction automatique</h4>
|
||||
<div class="row">
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateScriptGoogle', true, 'Active le script de traduction automatique', [
|
||||
'checked' => $this->getData(['config','translate', 'scriptGoogle'])
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateAdmin', true, 'Mode connexion', [
|
||||
'checked' => $this->getData(['config','translate', 'admin']),
|
||||
'help' => 'Traduction automatique du site et de l\'interface du CMS'
|
||||
]); ?>
|
||||
</div>
|
||||
<div class="col4">
|
||||
<?php echo template::checkbox('translateCredits', true, 'Afficher les crédits du script Google', [
|
||||
'checked' => $this->getData(['config','translate', 'showCredits']),
|
||||
'help' => 'Option vivement recommandée pour le respect du droit d\'auteur'
|
||||
]); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php echo template::formClose(); ?>
|