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

View File

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

View File

@ -43,36 +43,51 @@
<div class="col6"> <div class="col6">
<div class="block"> <div class="block">
<h4>Réglages</h4> <h4>Réglages</h4>
<div class="row"> <div class="row">
<div class="col6"> <div class="col6">
<?php echo template::file('configFavicon', [ <?php echo template::file('configFavicon', [
'type' => 1, 'type' => 1,
'help' => 'Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.', 'help' => 'Pensez à supprimer le cache de votre navigateur si la favicon ne change pas.',
'label' => 'Favicon', 'label' => 'Favicon',
'value' => $this->getData(['config', '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> </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, [ <?php echo template::select('configTimezone', $module::$timezones, [
'label' => 'Fuseau horaire', 'label' => 'Fuseau horaire',
'selected' => $this->getData(['config', 'timezone']) 'selected' => $this->getData(['config', 'timezone'])
]); ?> ]); ?>
</div> </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', [ <?php echo template::checkbox('configCookieConsent', true, 'Message de consentement aux cookies', [
'checked' => $this->getData(['config', 'cookieConsent']) 'checked' => $this->getData(['config', 'cookieConsent'])
]); ?> ]); ?>
</div>
<div class="col6">
<?php echo template::checkbox('rewrite', true, 'Réécriture d\'URL', [ <?php echo template::checkbox('rewrite', true, 'Réécriture d\'URL', [
'checked' => helper::checkRewrite(), 'checked' => helper::checkRewrite(),
'help' => 'Vérifiez d\'abord que votre serveur l\'autorise : ce n\'est pas le cas chez Free.' 'help' => 'Vérifiez d\'abord que votre serveur l\'autorise : ce n\'est pas le cas chez Free.'
]); ?> ]); ?>
</div>
</div> </div>
</div> </div>
<div class="col6"> <div class="col6">

View File

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

View File

@ -203,17 +203,6 @@ $("#themeFooterCopyrightPosition").on("change", function() {
}).trigger("change"); }).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 // Lien de connexion
$("#themeFooterLoginLink").on("change", function() { $("#themeFooterLoginLink").on("change", function() {
if($(this).is(":checked")) { if($(this).is(":checked")) {

View File

@ -192,20 +192,12 @@
</div> </div>
<div class="col3"> <div class="col3">
<div class="row"> <div class="row">
<?php echo template::checkbox('themeFooterLegalCheck', true, 'Pages des mentions légales', [ <?php echo template::checkbox('themeFooterDisplayLegal', true, 'Pages des mentions légales', [
'checked' => $this->getData(['theme', 'footer', 'legalPageId']) === '' ? false : true 'checked' => $this->getData(['theme', 'footer', 'displayLegal'])
]); ?> ]); ?>
<p></p> <p></p>
</div> </div>
</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> </div>
</div> </div>