Merge branch '11200_cookies_clean' into 11200_cookies_fusion
This commit is contained in:
commit
39aaa035b4
@ -219,28 +219,28 @@ core.start = function() {
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
/**
|
||||
* Traitement du formulaire cookies
|
||||
*/
|
||||
$("#cookieForm").submit(function(event){
|
||||
const ga = document.getElementById('googleAnalytics');
|
||||
var samesite = "samesite=lax";
|
||||
var expires = new Date();
|
||||
expires.setFullYear(expires.getFullYear() + 1);
|
||||
expires = "expires=" + expires.toUTCString();
|
||||
// Crée le cookie d'acceptation Google Analytics si nécessaire
|
||||
<?php $analytics = $this->getData(['config', 'seo', 'analyticsId']);?>
|
||||
<?php if( $analytics !== null AND $analytics !=='' ){
|
||||
$path = str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF']));?>
|
||||
if(ga.checked){
|
||||
document.cookie = "ZWII_COOKIE_GA_CONSENT=true_<?php echo $path;?>;" + expires +";"+ samesite;
|
||||
}
|
||||
else{
|
||||
document.cookie = "ZWII_COOKIE_GA_CONSENT=false_<?php echo $path;?>;" + expires +";"+ samesite;
|
||||
}
|
||||
<?php } ?>
|
||||
document.cookie = "ZWII_COOKIE_CONSENT=true_<?php echo str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])); ?>;" + expires +";"+ samesite;
|
||||
*/
|
||||
$("#cookieForm").submit(function(event){
|
||||
var samesite = "samesite=lax";
|
||||
var getUrl = window.location;
|
||||
var domain = "domain=" + getUrl.host;
|
||||
var path = "path=" + getUrl.pathname.split('/')[1];
|
||||
var samesite = "samesite=lax";
|
||||
var e = new Date();
|
||||
e.setFullYear(e.getFullYear() + 1);
|
||||
var expires = "expires=" + e.toUTCString();
|
||||
|
||||
// Crée le cookie d'acceptation Google Analytics si nécessaire
|
||||
var analytics = "<?php echo $this->getData(['config', 'seo', 'analyticsId']);?>";
|
||||
if( analytics.length > 0){
|
||||
document.cookie = "ZWII_COOKIE_CONSENT_GA=" + $("#googleAnalytics").prop("checked") + ";" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
}
|
||||
//document.cookie = "ZWII_COOKIE_CONSENT=true;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
document.cookie = "ZWII_COOKIE_CONSENT=<?php echo str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])); ?>;" + domain + ";" + path + ";" + samesite + ";" + expires;
|
||||
});
|
||||
|
||||
$("#cookieConsent .cookieClose").on("click", function() {
|
||||
$(this).parents("#cookieConsent").fadeOut();
|
||||
});
|
||||
|
@ -1189,26 +1189,34 @@ class common {
|
||||
* Affiche le consentement aux cookies
|
||||
*/
|
||||
public function showCookies() {
|
||||
if($this->getInput('ZWII_COOKIE_CONSENT') !== 'true_'.str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])) AND $this->getData(['config','cookieConsent']) === true){ ?>
|
||||
<div id="cookieConsent">
|
||||
<div class="cookieClose">X</div>
|
||||
<h3><?php echo $this->getData(['config', 'cookies', 'cookiesTitleText']); ?></h3>
|
||||
<?php $analytics = $this->getData(['config', 'seo', 'analyticsId']);?>
|
||||
<p><?php echo $this->getData(['config', 'cookies', 'cookiesZwiiText']); ?></p>
|
||||
<?php $legalPage = $this->getData(['locale','legalPageId']) ==='none'? 'mentions-legales' : $this->getData(['locale','legalPageId']); ?>
|
||||
<p><a href=" <?php echo helper::baseUrl() . $legalPage ?> "><?php echo $this->getData(['config', 'cookies', 'cookiesLinkMlText']); ?></a></p>
|
||||
<?php if( $analytics !== null AND $analytics !=='' ){ ?>
|
||||
<p><?php echo $this->getData(['config', 'cookies', 'cookiesGaText']); ?></p>
|
||||
<?php } ?>
|
||||
<form method="POST" action="" id="cookieForm">
|
||||
<?php if( $analytics !== null AND $analytics !=='' ){ ?>
|
||||
<input type="checkbox" id="googleAnalytics" name="googleAnalytics" value="GA">
|
||||
<label for="googleAnalytics"><?php echo $this->getData(['config', 'cookies', 'cookiesCheckboxGaText']); ?></label> <?php } ?><br><br>
|
||||
<input type="submit" id="cookieConsentConfirm" value="Valider">
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
if( $this->getInput('ZWII_COOKIE_CONSENT') !== str_replace('index.php','',str_replace( '/','',$_SERVER['PHP_SELF'])) AND
|
||||
$this->getData(['config','cookieConsent']) === true
|
||||
){
|
||||
|
||||
$analytics = $this->getData(['config', 'seo', 'analyticsId']);
|
||||
$legalPage = $this->getData(['locale','legalPageId']) ==='none'? 'mentions-legales' : $this->getData(['locale','legalPageId']);
|
||||
$item = '<div id="cookieConsent">';
|
||||
$item .= '<div class="cookieClose">';
|
||||
$item .= template::ico('cancel');
|
||||
$item .= '</div>';
|
||||
$item .= '<h3>'. $this->getData(['config', 'cookies', 'cookiesTitleText']) . '</h3>';
|
||||
$item .= '<p>' . $this->getData(['config', 'cookies', 'cookiesZwiiText']) . '</p>';
|
||||
$item .= '<p><a href="' . helper::baseUrl() . $legalPage . '">' . $this->getData(['config', 'cookies', 'cookiesLinkMlText']) . '</a></p>';
|
||||
if( $analytics !== null AND $analytics !=='' ){
|
||||
$item .= '<p>' . $this->getData(['config', 'cookies', 'cookiesGaText']) . '</p>';
|
||||
}
|
||||
$item .= '<form method="POST" action="" id="cookieForm">';
|
||||
if( $analytics !== null AND $analytics !=='' ) {
|
||||
$item .= '<input type="checkbox" id="googleAnalytics" name="googleAnalytics" value="GA">';
|
||||
$item .= '<label for="googleAnalytics">' . $this->getData(['config', 'cookies', 'cookiesCheckboxGaText']) . '</label>';
|
||||
}
|
||||
$item .= '<br><br>';
|
||||
$item .= '<input type="submit" id="cookieConsentConfirm" value="Valider">';
|
||||
$item .= '</form></div>';
|
||||
echo $item;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +174,7 @@
|
||||
|
||||
<!-- Corps de page -->
|
||||
<?php $this->showSection();?>
|
||||
|
||||
|
||||
<!-- footer -->
|
||||
<?php $this->showFooter();?>
|
||||
|
||||
@ -183,7 +183,7 @@
|
||||
|
||||
<!-- Lien remonter en haut -->
|
||||
<div id="backToTop"><?php echo template::ico('up'); ?></div>
|
||||
<!-- Affichage du consentement aux cookies-->
|
||||
<!-- Affichage du consentement aux cookies-->
|
||||
<?php $this->showCookies(); ?>
|
||||
<!-- Les scripts -->
|
||||
<?php $this->showScript();?>
|
||||
|
Loading…
Reference in New Issue
Block a user