<?php
/**
  * Ahead WebSoft Technologies Pvt Ltd.
  * @copyright  Copyright 2006-2026 Ahead WebSoft Technologies Pvt Ltd.
  * @license    https://www.socialengine.com/policies
*/
?>
<?php if ($this->gdpr_bannerstyle == 'left' || $this->gdpr_bannerstyle == 'right') { ?>
	<div class="gdpr_sb_cookie_banner <?php if ($this->gdpr_bannerstyle == 'left') { ?> _pl <?php } else { ?> _pr <?php } ?> gdpr_bxs">
		<div class="_des"><?php echo $this->translate($this->gdpr_bannertext) ?></div>
		<?php if (engine_in_array('changeSettings', $this->gdpr_banneroption) || engine_in_array('accept', $this->gdpr_banneroption) || engine_in_array('readMore', $this->gdpr_banneroption)) { ?>
				<div class="_links">
				<?php if (engine_in_array('accept', $this->gdpr_banneroption)) { ?>
						<div><a href="javascript:;" class="privacy_agree"><?php echo $this->translate("Accept"); ?></a></div>
				<?php } ?>
				<?php if (engine_in_array('changeSettings', $this->gdpr_banneroption)) { ?>
						<div><a
								href="<?php echo $this->url(array('action' => 'index'), 'gdpr_view', true); ?>"><?php echo $this->translate("Change Settings"); ?></a>
						</div>
				<?php } ?>
				<?php if (engine_in_array('readMore', $this->gdpr_banneroption)) { ?>
						<div><a href="<?php echo $this->gdpr_privacyurl; ?>"><?php echo $this->translate("Read More"); ?></a></div>
				<?php } ?>
				</div>
		<?php } ?>
	</div>
	<style type="text/css">
		.gdpr_sb_cookie_banner {
			background-color: #<?php echo $this->gdpr_bannerbackgroundcolor ?>;
		}
		.gdpr_sb_cookie_banner ._des {
			color: #<?php echo $this->gdpr_bannertextcolor ?>;
		}
		.gdpr_sb_cookie_banner ._links a {
			color: #<?php echo $this->gdpr_bannerlinkcolor ?>;
		}
	</style>
	<script type="application/javascript">
		scriptJquery('.privacy_agree').click(function (e) {
			e.preventDefault();
			scriptJquery('.gdpr_sb_cookie_banner').parent().remove();
      scriptJquery.post("gdpr/index/consent/type/1", {}, function (data) {
        var response = jQuery.parseJSON(data);
        if(response.status) {
          window.proxyLocation.href = response.redirectUrl;
        }
      });
		});
	</script>
<?php } else if ($this->gdpr_bannerstyle == 'top_center' || $this->gdpr_bannerstyle == 'bottom_center') { ?>
		<div
			class="gdpr_cookie_banner <?php if ($this->gdpr_bannerstyle == 'top_center') { ?> _ft <?php } else { ?> _fb <?php } ?>">
			<div class="_des"><?php echo $this->translate($this->gdpr_bannertext) ?></div>
		<?php if (engine_in_array('changeSettings', $this->gdpr_banneroption) || engine_in_array('accept', $this->gdpr_banneroption) || engine_in_array('readMore', $this->gdpr_banneroption)) { ?>
				<div class="_links">
				<?php if (engine_in_array('accept', $this->gdpr_banneroption)) { ?>
						<div><a href="javascript:;" class="privacy_agree"><?php echo $this->translate("Accept"); ?></a></div>
				<?php } ?>
				<?php if (engine_in_array('changeSettings', $this->gdpr_banneroption)) { ?>
						<div><a
								href="<?php echo $this->url(array('action' => 'index'), 'gdpr_view', true); ?>"><?php echo $this->translate("Change Settings"); ?></a>
						</div>
				<?php } ?>
				<?php if (engine_in_array('readMore', $this->gdpr_banneroption)) { ?>
						<div><a href="<?php echo $this->gdpr_privacyurl; ?>"><?php echo $this->translate("Read More"); ?></a></div>
				<?php } ?>
				</div>
		<?php } ?>
		</div>
		<style type="text/css">
			.gdpr_cookie_banner {
				background-color: #<?php echo $this->gdpr_bannerbackgroundcolor ?>;
			}

			.gdpr_cookie_banner ._des {
				color: #<?php echo $this->gdpr_bannertextcolor ?>;
			}

			.gdpr_cookie_banner ._links a {
				color: #<?php echo $this->gdpr_bannerlinkcolor ?>;
			}
		</style>
		<script type="application/javascript">
			scriptJquery('.privacy_agree').click(function (e) {
				e.preventDefault();
				scriptJquery('.gdpr_cookie_banner').parent().remove();
        scriptJquery.post("gdpr/index/consent/type/1", {}, function (data) {
          var response = jQuery.parseJSON(data);
          if(response.status) {
            window.proxyLocation.href = response.redirectUrl;
          }
        });
			});
		</script>
<?php } ?>

<?php if (Engine_Api::_()->getApi('settings', 'core')->getSetting('gdpr.popup', 0) && (($this->viewer()->getIdentity() && !Engine_Api::_()->getDbTable('settings', 'user')->getSetting($this->viewer(), 'gdpr_popup_consent')) || (!$this->viewer()->getIdentity() && empty($_COOKIE['user_popup_consent'])))) { ?>
	<!-- privacy policy popup -->
	<div class="gdpr_privacy_popup">
		<div class="gdpr_privacy_popup_inner">
			<h3><?php echo $this->translate('Our Privacy Policy has been Updated'); ?></h3>
			<p>
				<b><?php echo $this->translate("To continue using the site you need to read the revised version and agree to the policies"); ?></b>
			</p>
			<div id="privacy_pop" class="_privacy_data">
				<?php
				$str = $this->translate('_CORE_PRIVACY_STATEMENT');
				if ($str == strip_tags($str)) {
					// there is no HTML tags in the text
					echo nl2br($str);
				} else {
					echo $str;
				}
				?>
			</div>
			<div class="gdpr_agree_disagree">
				<a href="javascript:;" class="privacy_agree"><?php echo $this->translate('Agree'); ?></a>
				<?php if (!Engine_Api::_()->getApi('settings', 'core')->getSetting('gdpr_madatory_popup', 0)) { ?>
					<a href="javascript:;" class="privacy_disagree"><?php echo $this->translate('Disagree');
				}
				?></a>
			</div>
		</div>
	</div>
	<?php $settings = Engine_Api::_()->getApi('settings', 'core')->getSetting('gdpr_content', array('cookie', 'dataProtection', 'privacySettings', 'requestArchive', 'unsubscribe', 'forgotMe')); ?>
	<a href="javascript:;" data-url="gdpr/index/get-gdpr-data/type/forget" class="ajaxsmoothbox" id="consent_forgot_me" style="display:none;"><?php echo $this->translate("forgotme"); ?></a>
	<script type="application/javascript">
		scriptJquery('.privacy_agree').click(function (e) {
			e.preventDefault();
			scriptJquery('.gdpr_privacy_popup_inner').parent().remove();
			scriptJquery.post("gdpr/index/consent/type/1", {}, function (data) {
        var response = jQuery.parseJSON(data);
        if(response.status) {
          window.proxyLocation.href = response.redirectUrl;
        }
      });
		});

		scriptJquery('.privacy_disagree').click(function () {
			scriptJquery('.gdpr_privacy_popup').hide();
			scriptJquery.post('gdpr/index/popup', {}, function (response) { });
			<?php if (in_array('forgotMe', $settings)) { ?>
				scriptJquery('#consent_forgot_me').trigger('click');
			<?php } ?>
		});
	</script>
<?php } ?>
