<?
if (!defined('B_PROLOG_INCLUDED') || B_PROLOG_INCLUDED !== true)
die();
use Bitrix\Main\Localization\Loc;
use Citfact\SiteCore\EventAlert\EventAlertManager;
$frame = new \Bitrix\Main\Page\FrameBuffered('authorize_'.ToLower($arParams['ID']));
$frame->begin();
$cUser = new \CUser();
if ($cUser->IsAuthorized()) {
$userId = (int)$cUser->GetID();
// Счетчик оповещений о событиях
$alertManager = new EventAlertManager($userId);
$allAlertsCnt = $alertManager->getAllAlertsCnt();
?>
<div class="header__link header__link--auth header__lk"
<?= ((int)$allAlertsCnt > 0 ) ? 'not_empty' : 'empty'; ?>
data-alerts-num-wrap>
<svg class='i-icon header-nav__link'>
<use xlink:href='#icon-personal'></use>
</svg>
<span data-alerts-num><?= $allAlertsCnt; ?></span>
<div class="header-nav__down">
<ul class="header-nav__down-list">
<li>
<a href="<?= SITE_DIR; ?>account">
<?= Loc::getMessage('HEADER_PERSONAL_AREA'); ?>
</a>
</li>
<li>
<a href="<?= SITE_DIR; ?>?logout=yes">
<?= Loc::getMessage('HEADER_EXIT'); ?>
</a>
</li>
</ul>
</div>
</div>
<? } else { ?>
<div class="header__link header__link--right">
<a data-href="/local/include/modals/auth.php?site=<?= SITE_ID; ?>" class="header__link header__link--auth" data-modal="ajax">
<svg class='i-icon'>
<use xlink:href='#icon-personal'></use>
</svg>
</a>
<a data-href="/local/include/modals/auth.php?site=<?= SITE_ID; ?>" class="header__link header__link--auth header__link__button" data-modal="ajax"><?= Loc::getMessage('CITFACT_TEMPLATE_SUBSCRIBE_BUTTON'); ?></a>
</div>
<? } ?>
<? $frame->beginStub(); ?>
<a data-href="/local/include/modals/auth.php?site=<?= SITE_ID; ?>" class="header__link header__link--auth" data-modal="ajax">
<svg class='i-icon'>
<use xlink:href='#icon-personal'></use>
</svg>
</a>
<? $frame->end(); ?>
$frame = new \Bitrix\Main\Page\FrameBuffered("my_dynamic");
$frame->begin();
// Содержание динамической области
$frame->beginStub();
// Заглушка
$frame->end();
$(document).on('click', '.header__link.header__link--auth', callback);