[10.0.13.dev] 2 masques langues : méta et gestion

This commit is contained in:
fredtempez 2019-09-29 16:48:11 +02:00
parent afd0a6d35d
commit 1129081d10
6 changed files with 127 additions and 93 deletions

View File

@ -35,7 +35,7 @@ class common {
const TEMP_DIR = 'site/tmp/';
// Numéro de version
const ZWII_VERSION = '10.0.12.dev';
const ZWII_VERSION = '10.0.13.dev';
public static $actions = [];
public static $coreModuleIds = [
@ -2227,7 +2227,6 @@ class layout extends common {
// Fermeture du bloc copyright
$items .= '</span></div>';
$items .= $this->geti18n();
echo $items;
}

View File

@ -290,15 +290,7 @@ class config extends common {
'itemsperPage' => $this->getInput('itemsperPage', helper::FILTER_INT,true),
'legalPageId' => $this->getInput('configLegalPageId')
]
]);
$this->setData([
'page',
[
'homePageId' => $this->getInput('configHomePageId', helper::FILTER_ID, true),
'metaDescription' => $this->getInput('configMetaDescription', helper::FILTER_STRING_LONG, true),
'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true)
]
]);
]);
if(self::$inputNotices === []) {
// Ecrire les fichiers de script
file_put_contents(self::DATA_DIR . 'head.inc.html',$this->getInput('configScriptHead',null));

View File

@ -12,33 +12,6 @@
<?php echo template::submit('configSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Informations générales</h4>
<div class="row">
<div class="col4">
<?php echo template::select('pageHomePageId', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'label' => 'Page d\'accueil',
'selected' => $this->getData(['page', 'homePageId'])
]); ?>
</div>
<div class="col8">
<?php echo template::text('pageTitle', [
'label' => 'Titre du site',
'value' => $this->getData(['page', 'title']),
'help' => 'Il apparaît dans la barre de titre et les partages sur les réseaux sociaux.'
]); ?>
</div>
</div>
<?php echo template::textarea('pageMetaDescription', [
'label' => 'Description du site',
'value' => $this->getData(['page', 'metaDescription']),
'help' => 'Elle apparaît dans les partages sur les réseaux sociaux.'
]); ?>
</div>
</div>
</div>
<div class="row">
<div class="col6">
<div class="block">

View File

@ -16,14 +16,37 @@ class i18n extends common {
public static $actions = [
'index' => self::GROUP_MODERATOR,
'config' => self::GROUP_MODERATOR,
'lang' => self::GROUP_VISITOR
];
/**
* Configuration
/**
* Index : paramétrage des méta de la langue
*/
public function index() {
public function index() {
if($this->isPost()) {
$this->setData([
'page',
[
'homePageId' => $this->getInput('pagei18nHomePageId', helper::FILTER_ID, true),
'metaDescription' => $this->getInput('pagei18nMetaDescription', helper::FILTER_STRING_LONG, true),
'title' => $this->getInput('pagei18nTitle', helper::FILTER_STRING_SHORT, true)
]
]);
} else {
// Valeurs en sortie sans post
$this->addOutput([
'title' => 'Internationalisation',
'view' => 'index'
]);
}
}
/**
* Config : gestion des langues
*/
public function config() {
if($this->isPost()) {
// Et faire un backup
@ -90,7 +113,7 @@ class i18n extends common {
// Valeurs en sortie sans post
$this->addOutput([
'title' => 'Internationalisation',
'view' => 'index'
'view' => 'config'
]);
}

View File

@ -0,0 +1,53 @@
<?php echo template::formOpen('i18nConfig'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('configBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) ,
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('configSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col8">
<div class="block">
<h4>Ajouter une localisation</h4>
<div class="row">
<div class="col5">
<?php echo template::select('i18nLanguageCopyFrom', $this->i18nInstalled(true), [
'label' => 'Copier à partir ',
'help' => 'Pour démarrer sans copie des pages te des modules d\'une langue existante, ne rien sélectionner',
'selected' => -1
]); ?>
</div>
<div class="col1">
<?php echo template::ico('right-big'); ?>
</div>
<div class="col5">
<?php
$available = array ('' => 'Sélectionner');
$available = array_merge ($available, self::$i18nList);
echo template::select('i18nLanguageAdd', $available, [
'label' => 'vers'
]); ?>
</div>
</div>
</div>
</div>
<div class="col4">
<div class="block">
<h4>Supprimer une localisation</h4>
<div class="row">
<?php echo template::select('i18nLanguageRemove', $this->i18nInstalled(true, true), [
'label' => 'Localisations installées',
'help' => 'La suppression d\'une langue entraîne l\'effacement des pages et des modules',
'selected' => -1
]); ?>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>

View File

@ -1,55 +1,49 @@
<?php echo template::formOpen('i18nForm'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('configBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl(false),
'ico' => 'home',
'value' => 'Accueil'
]); ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('configSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col8">
<div class="block">
<h4>Ajouter une localisation</h4>
<div class="row">
<div class="col5">
<?php echo template::select('i18nLanguageCopyFrom', $this->i18nInstalled(true), [
'label' => 'Copier à partir ',
'help' => 'Pour démarrer sans copie des pages te des modules d\'une langue existante, ne rien sélectionner',
'selected' => -1
]); ?>
</div>
<div class="col1">
<?php echo template::ico('right-big'); ?>
</div>
<div class="col5">
<?php
$available = array ('' => 'Sélectionner');
$available = array_merge ($available, self::$i18nList);
echo template::select('i18nLanguageAdd', $available, [
'label' => 'vers'
<?php echo template::formOpen('i18nIndex'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('configBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl(false),
'ico' => 'home',
'value' => 'Accueil'
]); ?>
</div>
<div class="col2 offset6">
<?php echo template::button('configBack', [
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'value' => 'Langues'
]); ?>
</div>
<div class="col2">
<?php echo template::submit('configSubmit'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Informations langue :
<?php echo $this->geti18n();?></h4>
<div class="row">
<div class="col4">
<?php echo template::select('pagei18nHomePageId', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'label' => 'Page d\'accueil',
'selected' => $this->getData(['page', 'homePageId'])
]); ?>
</div>
<div class="col8">
<?php echo template::text('pagei18nPageTitle', [
'label' => 'Titre du site',
'value' => $this->getData(['page', 'title']),
'help' => 'Il apparaît dans la barre de titre et les partages sur les réseaux sociaux.'
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="col4">
<div class="block">
<h4>Supprimer une localisation</h4>
<div class="row">
<?php echo template::select('i18nLanguageRemove', $this->i18nInstalled(true, true), [
'label' => 'Localisations installées',
'help' => 'La suppression d\'une langue entraîne l\'effacement des pages et des modules',
'selected' => -1
<?php echo template::textarea('pagei18nMetaDescription', [
'label' => 'Description du site',
'value' => $this->getData(['page', 'metaDescription']),
'help' => 'Elle apparaît dans les partages sur les réseaux sociaux.'
]); ?>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
</div>
</div>
<?php echo template::formClose(); ?>