[9.2.0.dev] Choix de la page des mentions légales dans la config

This commit is contained in:
fredtempez 2019-06-24 21:52:24 +02:00
parent f05922b090
commit ee3b0dc8b1
6 changed files with 48 additions and 51 deletions

View File

@ -1963,9 +1963,9 @@ class layout extends common {
$items .= '</span>';
// Affichage des mentions légales
$items .= '<span id="footerDisplayLegal"';
$items .= $this->getData(['theme','footer','legalPageId']) === '' ? ' class="displayNone" >' : '>';
if ($this->getData(['theme','footer','legalPageId']) !== '') {
$items .= '<wbr>&nbsp;|&nbsp;<a href="' . helper::baseUrl() . $this->getData(['theme','footer','legalPageId']) . '" data-tippy-content="Mentions Légales">Mentions légales</a>';
$items .= $this->getData(['theme','footer','displayLegal']) === false ? ' class="displayNone" >' : '>';
if ($this->getData(['config','legalPageId']) !== '') {
$items .= '<wbr>&nbsp;|&nbsp;<a href="' . helper::baseUrl() . $this->getData(['config','legalPageId']) . '" data-tippy-content="Mentions Légales">Mentions légales</a>';
}
$items .= '</span>';
// Affichage du lien de connexion

View File

@ -263,6 +263,11 @@ class config extends common {
public function index() {
// Soumission du formulaire
if($this->isPost()) {
if ($this->getInput('configLegalCheck', helper::FILTER_BOOLEAN) === true ) {
$legalPageId = $this->getInput('configLegalPageId', helper::FILTER_ID);
} else {
$legalPageId = '';
}
$this->setData([
'config',
[
@ -284,7 +289,8 @@ class config extends common {
],
'timezone' => $this->getInput('configTimezone', helper::FILTER_STRING_SHORT, true),
'title' => $this->getInput('configTitle', helper::FILTER_STRING_SHORT, true),
'itemsperPage' => $this->getInput('itemsperPage', helper::FILTER_INT,true)
'itemsperPage' => $this->getInput('itemsperPage', helper::FILTER_INT,true),
'legalPageId' => $this->getInput('configLegalPageId')
]
]);
if(self::$inputNotices === []) {

View File

@ -43,36 +43,51 @@
<div class="col6">
<div class="block">
<h4>Réglages</h4>
<div class="row">
<div class="col6">
<?php echo template::file('configFavicon', [
'type' => 1,
'help' => 'Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.',
'label' => 'Favicon',
'value' => $this->getData(['config', 'favicon'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('itemsperPage', $module::$ItemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['config', 'itemsperPage']),
'help' => 'Modules Blog et News'
]); ?>
</div>
<div class="row">
<div class="col6">
<?php echo template::file('configFavicon', [
'type' => 1,
'help' => 'Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.',
'label' => 'Favicon',
'value' => $this->getData(['config', 'favicon'])
]); ?>
</div>
<div class="col12">
<div class="col6">
<?php echo template::select('itemsperPage', $module::$ItemsList, [
'label' => 'Articles par page',
'selected' => $this->getData(['config', 'itemsperPage']),
'help' => 'Modules Blog et News'
]); ?>
</div>
</div>
<div class="row">
<div class="col6">
<?php echo template::select('configTimezone', $module::$timezones, [
'label' => 'Fuseau horaire',
'selected' => $this->getData(['config', 'timezone'])
]); ?>
</div>
<div class="col6">
<?php $listePageId = array_merge(['' => 'Sélectionner'] , helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC') );
?>
<?php echo template::select('configLegalPageId', $listePageId , [
'label' => 'Page des mentions légales',
'class' => $this->getData(['config', 'legalPageId']) === '' ? 'displayNone' : '',
'selected' => $this->getData(['config', 'legalPageId'])
]); ?>
</div>
</div>
<div class="col12">
<?php echo template::checkbox('configCookieConsent', true, 'Message de consentement aux cookies', [
'checked' => $this->getData(['config', 'cookieConsent'])
]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('rewrite', true, 'Réécriture d\'URL', [
'checked' => helper::checkRewrite(),
'help' => 'Vérifiez d\'abord que votre serveur l\'autorise : ce n\'est pas le cas chez Free.'
]); ?>
</div>
</div>
</div>
<div class="col6">

View File

@ -299,11 +299,6 @@ class theme extends common {
'state' => false
]);
} else {
if ($this->getInput('themeFooterLegalCheck', helper::FILTER_BOOLEAN) === true ) {
$legalPageId = $this->getInput('themeFooterLegalPageId', helper::FILTER_ID);
} else {
$legalPageId = '';
}
$this->setData(['theme', 'footer', [
'backgroundColor' => $this->getInput('themeFooterBackgroundColor'),
'copyrightAlign' => $this->getInput('themeFooterCopyrightAlign'),
@ -325,8 +320,8 @@ class theme extends common {
'displayVersion' => $this->getInput('themefooterDisplayVersion', helper::FILTER_BOOLEAN),
'displaySiteMap' => $this->getInput('themefooterDisplaySiteMap', helper::FILTER_BOOLEAN),
'displayCopyright' => $this->getInput('themefooterDisplayCopyright', helper::FILTER_BOOLEAN),
'template' => $this->getInput('themeFooterTemplate'),
'legalPageId' => $legalPageId
'displayLegal' => $this->getInput('themeFooterDisplayLegal', helper::FILTER_BOOLEAN),
'template' => $this->getInput('themeFooterTemplate')
]]);
// Valeurs en sortie
$this->addOutput([

View File

@ -203,17 +203,6 @@ $("#themeFooterCopyrightPosition").on("change", function() {
}).trigger("change");
// Mention Légales activation de la liste de choix
$("#themeFooterLegalCheck").on("change",function() {
if($(this).is(":checked")) {
$("#themeFooterLegalPageId").show();
$("#footerDisplayLegal").show();
} else {
$("#themeFooterLegalPageId").hide();
$("#footerDisplayLegal").hide();
}
});
// Lien de connexion
$("#themeFooterLoginLink").on("change", function() {
if($(this).is(":checked")) {

View File

@ -192,20 +192,12 @@
</div>
<div class="col3">
<div class="row">
<?php echo template::checkbox('themeFooterLegalCheck', true, 'Pages des mentions légales', [
'checked' => $this->getData(['theme', 'footer', 'legalPageId']) === '' ? false : true
<?php echo template::checkbox('themeFooterDisplayLegal', true, 'Pages des mentions légales', [
'checked' => $this->getData(['theme', 'footer', 'displayLegal'])
]); ?>
<p></p>
</div>
</div>
<div class="col3">
<div class="row">
<?php echo template::select('themeFooterLegalPageId', helper::arrayCollumn($this->getData(['page']), 'title', 'SORT_ASC'), [
'class' => $this->getData(['theme', 'footer', 'legalPageId']) === '' ? 'displayNone' : '',
'selected' => $this->getData(['theme', 'footer', 'legalPageId'])
]); ?>
</div>
</div>
</div>
</div>
</div>