1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
top_panel.php
См. документацию.
1<?php
2
3if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true)
4{
5 die();
6}
7
15
16IncludeModuleLangFile(__FILE__);
17
19{
21 {
22 global $USER, $APPLICATION;
23
24 $session = \Bitrix\Main\Application::getInstance()->getSession();
25
26 if (isset($_GET["back_url_pub"]) && !is_array($_GET["back_url_pub"]) && str_starts_with($_GET["back_url_pub"], "/"))
27 {
28 $session["BACK_URL_PUB"] = $_GET["back_url_pub"];
29 }
30
31 $arPanelButtons = [];
32
33 //Help
34 $module = (defined("ADMIN_MODULE_NAME") ? ADMIN_MODULE_NAME : "main");
35 $page = (defined("HELP_FILE") && !str_contains(HELP_FILE, '/') ? HELP_FILE : basename($APPLICATION->GetCurPage()));
36
37 $aActiveSection = $adminMenu->ActiveSection();
38 $section = $aActiveSection["help_section"] . "/";
39 if (defined("HELP_FILE") && str_starts_with(HELP_FILE, $section))
40 {
41 $section = "";
42 }
43
44 if ($USER->IsAuthorized())
45 {
46 $settingsButton = static::getSettingsButton();
47 if (!empty($settingsButton))
48 {
49 $arPanelButtons[] = $settingsButton;
50 }
51 }
52
53 $arPanelButtons[] = static::getLanguageButton();
54
55 if ($USER->IsAuthorized())
56 {
57 $hkInstance = CHotKeys::getInstance();
58 $Execs = $hkInstance->GetCodeByClassName("top_panel_menu", GetMessage("admin_panel_menu"));
59 echo $hkInstance->PrintJSExecs($Execs);
60 $Execs = $hkInstance->GetCodeByClassName("admin_panel_site", GetMessage("admin_panel_site"));
61 echo $hkInstance->PrintJSExecs($Execs);
62 $Execs = $hkInstance->GetCodeByClassName("admin_panel_admin", GetMessage("admin_panel_admin"));
63 echo $hkInstance->PrintJSExecs($Execs);
64 }
65
66 // security status
67 $context = \Bitrix\Main\Context::getCurrent();
68 $modulesToUpdateCount = RuleRecordTable::getCount([], ['ttl' => 60]);
70
71 $showWwallPopup = false;
72 $wwallPopupLastView = $context->getRequest()->getCookie('WWALL_POPUP_LAST_VIEW');
73 if ($USER->isAdmin() && $modulesToUpdateCount && empty($wwallPopupLastView))
74 {
75 $showWwallPopup = true;
76 $context->getResponse()->addCookie(new \Bitrix\Main\Web\Cookie(
77 'WWALL_POPUP_LAST_VIEW', '1', time() + 3600 * 48
78 ));
79 }
80
81 // security notifications
82 $vendorNotification = static::getVendorNotification();
83
84 // js for notifications
85 if ($showWwallPopup || $vendorNotification)
86 {
87 Extension::load([
88 'main.wwallpopup',
89 'main.coreAjax',
90 ]);
91 }
92 ?>
93
94 <?php
95 if ($showWwallPopup): // wwall popup ?>
96 <script>
97 BX.ready(function () {
98 let popup = new BX.Main.WwallPopup({
99 colorTheme: 'danger',
100 isSuccess: false,
101 isPortal: <?= Json::encode($isPortal) ?>,
102 closeIcon: true,
103 isToolTipShow: true
104 });
105 popup.show();
106 });
107 </script>
108 <?php
109 endif;
110 ?>
111
112
113 <?php
114 if (!$showWwallPopup && !empty($vendorNotification)): // security popup ?>
115 <script>
116 BX.ready(function () {
117
118 let popup = new BX.Main.WwallPopup({
119 colorTheme: '<?=CUtil::JSescape($vendorNotification['colorTheme'])?>',
120 title: '<?=CUtil::JSescape(Loc::getMessage('SEC_WWALL_POPUP_NOTIFICATION_TITLE'))?>',
121 subtitle: '<?=CUtil::JSescape($vendorNotification['title'])?>',
122 text: '<?=CUtil::JSescape($vendorNotification['text'])?>',
123 closeIcon: <?=!empty($vendorNotification['allowClose']) ? 'true' : 'false'?>,
124 buttons: {
125 primary: {
126 text: '<?=CUtil::JSescape(Loc::getMessage('SEC_WWALL_POPUP_ACTION_ACCEPT'))?>',
127 type: 'accept',
128 onclick: () => {
129 popup.close();
130
131 BX.ajax.runAction('main.security.vendorNotification.sign', {
132 data: {
133 notificationId: '<?=CUtil::JSescape($vendorNotification['vendorId'])?>'
134 }
135 });
136 }
137 },
138 <?php if (!empty($vendorNotification['allowClose'])): ?>
139 secondary: {
140 text: '<?=CUtil::JSescape(Loc::getMessage('SEC_WWALL_POPUP_ACTION_CLOSE'))?>',
141 type: 'close',
142 onclick: () => {
143 popup.close();
144 }
145 },
146 <?php endif; ?>
147 }
148 });
149
150 popup.show();
151
152 popup.popup.subscribeOnce('onClose', function () {
153 BX.setCookie(
154 BX.message('COOKIE_PREFIX') + '_SECURITY_POPUP_LAST_VIEW_<?=CUtil::JSescape($vendorNotification['vendorId'])?>',
155 '1',
156 {expires: 3600 * 48, path: '/'}
157 );
158 });
159 });
160 </script>
161 <?php
162 endif;
163 ?>
164
165 <div id="bx-panel" class="adm-header">
166 <div class="adm-header-left">
167 <div class="adm-header-btn-wrap">
168 <?php
169 $params = DeleteParam(["logout", "back_url_pub", "sessid"]);
170 $sPubUrl = (
171 $session["BACK_URL_PUB"] <> ""
172 ? htmlspecialcharsbx($session["BACK_URL_PUB"]) . (str_contains($session["BACK_URL_PUB"], "?") ? "&amp;" : "?")
173 : '/?'
174 )
175 . 'back_url_admin=' . urlencode($APPLICATION->GetCurPage() . ($params <> "" ? "?" . $params : ""));
176
177 $adminPanelSiteList = [];
178
179 if (Option::get("sale", "~IS_SALE_CRM_SITE_MASTER_FINISH") === "Y" || Option::get('sale', '~IS_SALE_BSM_SITE_MASTER_FINISH') === 'Y')
180 {
181 $adminPanelSiteIdList = [];
182 $isAdminPanelDefaultSiteExists = false;
183
184 $adminPanelSiteIterator = \Bitrix\Main\SiteTable::getList([
185 'select' => ['LID', 'NAME', 'DEF', 'SITE_NAME', 'SERVER_NAME', 'SORT'],
186 'filter' => [
187 '=ACTIVE' => 'Y',
188 ],
189 'cache' => ['ttl' => 86400],
190 ]);
191 while ($adminPanelSiteData = $adminPanelSiteIterator->fetch())
192 {
193 $adminPanelSiteIdList[] = $adminPanelSiteData['LID'];
194
195 if (empty($adminPanelSiteData['SERVER_NAME']))
196 {
197 continue;
198 }
199
200 $adminPanelSiteList[] = [
201 'ID' => $adminPanelSiteData['LID'],
202 'NAME' => $adminPanelSiteData['SITE_NAME'] ?: $adminPanelSiteData['NAME'],
203 'SERVER_NAME' => $adminPanelSiteData['SERVER_NAME'],
204 'DEF' => $adminPanelSiteData['DEF'],
205 'SORT' => $adminPanelSiteData['SORT'],
206 ];
207
208 if ($adminPanelSiteData['DEF'] === 'Y')
209 {
210 $isAdminPanelDefaultSiteExists = true;
211 }
212 }
213 unset($adminPanelSiteData, $adminPanelSiteIterator);
214
215 if ($adminPanelSiteIdList)
216 {
217 $adminPanelSiteDomainIterator = \Bitrix\Main\SiteDomainTable::getList([
218 'select' => [
219 'LID',
220 'DOMAIN',
221 'NAME' => 'SITE.NAME',
222 'SITE_NAME' => 'SITE.SITE_NAME',
223 'DEF' => 'SITE.DEF',
224 'SORT' => 'SITE.SORT',
225 ],
226 'filter' => [
227 '=LID' => $adminPanelSiteIdList,
228 ],
229 'cache' => ['ttl' => 86400],
230 ]);
231 while ($adminPanelSiteDomainData = $adminPanelSiteDomainIterator->fetch())
232 {
233 $isAdminDomainExists = (bool)array_filter($adminPanelSiteList, static function ($site) use ($adminPanelSiteDomainData) {
234 return $site['SERVER_NAME'] === $adminPanelSiteDomainData['DOMAIN'];
235 });
236
237 if (!$isAdminDomainExists)
238 {
239 $adminPanelSiteList[] = [
240 'ID' => $adminPanelSiteDomainData['LID'],
241 'NAME' => $adminPanelSiteDomainData['SITE_NAME'] ?: $adminPanelSiteDomainData['NAME'],
242 'SERVER_NAME' => $adminPanelSiteDomainData['DOMAIN'],
243 'DEF' => $adminPanelSiteDomainData['DEF'],
244 'SORT' => $adminPanelSiteDomainData['SORT'],
245 ];
246
247 if ($adminPanelSiteDomainData['DEF'] === 'Y')
248 {
249 $isAdminPanelDefaultSiteExists = true;
250 }
251 }
252 }
253 unset($adminPanelSiteDomainData, $adminPanelSiteDomainIterator, $isAdminDomainExists);
254 }
255 unset($adminPanelSiteIdList);
256
257 if (!$isAdminPanelDefaultSiteExists)
258 {
259 $adminPanelDefaultServerName = Option::get("main", "server_name");
260 $isAdminPanelDefaultSiteExists = (bool)array_filter($adminPanelSiteList, static function ($adminPanelSite) use ($adminPanelDefaultServerName) {
261 return $adminPanelSite['SERVER_NAME'] === $adminPanelDefaultServerName;
262 });
263 if (!$isAdminPanelDefaultSiteExists)
264 {
265 array_unshift(
266 $adminPanelSiteList,
267 [
268 'NAME' => Option::get("main", "site_name"),
269 'SERVER_NAME' => $adminPanelDefaultServerName,
270 'DEF' => 'Y',
271 'SORT' => 1,
272 ]
273 );
274 }
275 unset($adminPanelDefaultServerName);
276 }
277 unset($isAdminPanelDefaultSiteExists);
278
279 if (count($adminPanelSiteList) > 1)
280 {
281 \Bitrix\Main\Type\Collection::sortByColumn($adminPanelSiteList, ['SORT' => SORT_ASC]);
282
283 $adminPanelSiteMenu = [];
284 $adminPanelDefaultButtonTitle = '';
285 $adminPanelDefaultButtonLink = '';
286 $adminPanelProtocol = $context->getRequest()->isHttps() ? "https://" : "http://";
287 foreach ($adminPanelSiteList as $adminPanelSite)
288 {
289 $adminPanelSiteId = $adminPanelSite['ID'] ?? null;
290 $adminPanelMenuItemTitle =
291 $adminPanelSite['NAME']
292 . ' (' . $adminPanelSite['SERVER_NAME'] . ')'
293 . ($adminPanelSiteId ? ' [' . $adminPanelSiteId . ']' : '');
294 $adminPanelMenuItemLink = $adminPanelProtocol . $adminPanelSite['SERVER_NAME'];
295
296 $adminPanelSiteMenu[] = [
297 'TEXT' => $adminPanelMenuItemTitle,
298 'LINK' => $adminPanelMenuItemLink,
299 ];
300
301 if ($adminPanelSite['DEF'] === 'Y')
302 {
303 $adminPanelDefaultButtonTitle = $adminPanelMenuItemTitle;
304 $adminPanelDefaultButtonLink = $adminPanelMenuItemLink;
305 }
306 }
307 unset($adminPanelSite, $adminPanelSiteId, $adminPanelMenuItemTitle, $adminPanelMenuItemLink);
308
309 if (!$adminPanelDefaultButtonTitle || !$adminPanelDefaultButtonLink)
310 {
311 $adminPanelDefaultButtonTitle = current($adminPanelSiteMenu)['TEXT'];
312 $adminPanelDefaultButtonLink = current($adminPanelSiteMenu)['LINK'];
313 }
314
315 $adminPanelDefaultButtonTitle = htmlspecialcharsbx($adminPanelDefaultButtonTitle);
316 $adminPanelDefaultButtonLink = htmlspecialcharsbx($adminPanelDefaultButtonLink);
317
318 if (mb_strlen($adminPanelDefaultButtonTitle) > 30)
319 {
320 $adminPanelDefaultButtonTitle = mb_substr($adminPanelDefaultButtonTitle, 0, 30) . '...';
321 }
322 ?>
323 <a id="bx-panel-view-site-btn" class="adm-header-notif-block"
324 href="<?= $adminPanelDefaultButtonLink ?>" title="<?= $adminPanelDefaultButtonTitle ?>"
325 hidefocus="true" onfocus="this.blur();">
326 <strong>
327 <span id="bx-panel-view-tab-select"
328 class="adm-header-notif-counter"><?= $adminPanelDefaultButtonTitle ?></span>
329 </strong>
330 </a>
331 <script>
332 BX.adminPanel.registerButton(
333 "bx-panel-view-site-btn",
334 {
335 MENU: <?= Json::encode($adminPanelSiteMenu) ?>,
336 }
337 )
338 </script>
339 <?php
340 unset(
341 $adminPanelSiteMenu,
342 $adminPanelDefaultButtonTitle,
343 $adminPanelDefaultButtonLink,
344 $adminPanelProtocol
345 );
346 }
347 else
348 {
349 ?>
350 <a hidefocus="true" href="<?= $sPubUrl ?>" id="bx-panel-view-tab"
351 class="adm-header-btn adm-header-btn-site"
352 title="<?= GetMessage("adm_top_panel_view_title") ?>"><?= GetMessage("admin_panel_site") ?></a>
353 <?php
354 }
355 }
356 else
357 {
358 ?>
359 <a hidefocus="true" href="<?= $sPubUrl ?>" id="bx-panel-view-tab"
360 class="adm-header-btn adm-header-btn-site"
361 title="<?= GetMessage("adm_top_panel_view_title") ?>"><?= GetMessage("admin_panel_site") ?></a>
362 <?php
363 }
364
365 if (count($adminPanelSiteList) > 1)
366 {
367 ?>
368 <a hidefocus="true" href="<?= BX_ROOT . "/admin/index.php?lang=" . LANGUAGE_ID ?>"
369 class="adm-header-notif-block"><span
370 class="adm-header-notif-counter"><?= GetMessage("admin_panel_admin") ?></span></a>
371 <?php
372 }
373 else
374 {
375 ?>
376 <a hidefocus="true" href="<?= BX_ROOT . "/admin/index.php?lang=" . LANGUAGE_ID ?>"
377 class="adm-header-btn adm-header-btn-admin"><?= GetMessage("admin_panel_admin") ?></a>
378 <?php
379 }
380
381 unset($adminPanelSiteList);
382 ?>
383 </div>
384
385 <?php
386 if (\Bitrix\Main\Loader::includeModule('security')): ?>
387 <?php
388 if ($modulesToUpdateCount): ?>
389 <a href="/bitrix/admin/security_dashboard.php"><div
390 class="adm-header-btn adm-security-btn --warning"><?= Loc::getMessage('adm_top_panel_wwall_unsec') ?></div></a>
391 <?php
392 else: ?>
393 <a href="/bitrix/admin/security_dashboard.php"><div class="adm-header-btn adm-security-btn"><?=
394 $isPortal
395 ? Loc::getMessage('adm_top_panel_wwall_sec_cp')
396 : Loc::getMessage('adm_top_panel_wwall_sec') ?></div></a>
397 <?php
398 endif; ?>
399 <?php
400 endif; ?>
401 <?php
402 $informerItemsCount = CAdminInformer::InsertMainItems();
403
404 if ($USER->IsAuthorized() && $informerItemsCount > 0):
405
406 ?><span class="adm-header-notif-block" id="adm-header-notif-block"
407 onclick="BX.adminInformer.Toggle(this);"
408 title="<?= GetMessage("admin_panel_notif_block_title") ?>"><span
409 class="adm-header-notif-icon"></span><span class="adm-header-notif-counter"
410 id="adm-header-notif-counter"><?= CAdminInformer::$alertCounter ?></span>
411 </span><?
412 endif;
413
414 static::showTopPanelButtonsSection($arPanelButtons, $hkInstance);
415
416 ?></div>
417 <div class="adm-header-right"><?
418 if ($USER->IsAuthorized() && IsModuleInstalled("search")):
419
420 ?>
421 <div class="adm-header-search-block" id="bx-search-box"><input class="adm-header-search"
422 id="bx-search-input"
423 onfocus="if (this.value=='<?= GetMessage("top_panel_search_def") ?>') {this.value=''; BX.addClass(this.parentNode,'adm-header-search-block-active');}"
424 value="<?= GetMessage("top_panel_search_def") ?>"
425 onblur="if (this.value==''){this.value='<?= GetMessage("top_panel_search_def") ?>'; BX.removeClass(this.parentNode,'adm-header-search-block-active');}"
426 type="text" autocomplete="off"/><a
427 href="#" onclick="BX('bx-search-input').value=''; BX('bx-search-input').onblur();"
428 class="adm-header-search-block-btn"></a></div>
429 <script>
430 let jsControl = new JCAdminTitleSearch({
431 'AJAX_PAGE': '/bitrix/admin/get_search.php?lang=<?=LANGUAGE_ID?>',
432 'CONTAINER_ID': 'bx-search-box',
433 'INPUT_ID': 'bx-search-input',
434 'MIN_QUERY_LEN': 1
435 });
436 </script><?
437
438 $Execs = $hkInstance->GetCodeByClassName("bx-search-input", GetMessage("top_panel_search_def"));
439 echo $hkInstance->PrintJSExecs($Execs);
440
441 endif;
442 ?>
443 <div class="adm-header-right-block"><?
444
445 if ($USER->IsAuthorized()):
446 $ssoSwitcher = $adminPage->getSSOSwitcherButton();
447 $bShowSSO = is_array($ssoSwitcher) && !empty($ssoSwitcher);
448
449 $userName = $USER->GetFormattedName();
450 if ($bShowSSO)
451 {
452 $userName = '<span class="adm-header-separate-left">' . $userName . '</span><span class="adm-header-separate-right" id="bx-panel-sso"></span>';
453 }
454
455 if ($USER->CanDoOperation('view_own_profile') || $USER->CanDoOperation('edit_own_profile')):
456
457 ?><a hidefocus="true"
458 href="/bitrix/admin/user_edit.php?lang=<?= LANGUAGE_ID ?>&amp;ID=<?= $USER->GetID() ?>"
459 class="adm-header-user-block<?= $bShowSSO ? ' adm-header-separate' : '' ?>"
460 onfocus="this.blur()"><?= $userName; ?></a><?
461
462 else:
463
464 ?><span class="adm-header-user-block<?= $bShowSSO ? ' adm-header-separate' : '' ?>"
465 id="bx-panel-user"><?= $userName ?></span><?
466
467 endif;
468
469 if ($bShowSSO)
470 {
471 ?>
472 <script>BX.adminPanel.registerButton('bx-panel-sso', {MENU: <?= Json::encode($ssoSwitcher) ?>});</script>
473 <?
474 }
475
476 ?><a hidefocus="true"
477 href="<?= htmlspecialcharsbx((defined('BX_ADMIN_SECTION_404') && BX_ADMIN_SECTION_404 == 'Y' ? '/bitrix/admin/' : $APPLICATION->GetCurPage()) . '?' . CUser::getLogoutParams()) ?>"
478 class="adm-header-exit" id="bx-panel-logout"
479 title="<?= GetMessage('admin_panel_logout_title') ?>"><?= GetMessage("admin_panel_logout") ?></a><?
480
481 $Execs = $hkInstance->GetCodeByClassName("bx-panel-logout", GetMessage('admin_panel_logout'));
482 echo $hkInstance->PrintJSExecs($Execs);
483
484 endif;
485
486 static::showTopPanelButtonsSection($arPanelButtons, $hkInstance, 1);
487
488 if ($USER->IsAuthorized()):
489 if ($hkInstance->IsActive()):
490
491 ?><a hidefocus="true" id="bx-panel-hotkeys" href="javascript:void(0)"
492 onclick="BXHotKeys.ShowSettings();" class="header-keyboard"
493 title="<?= GetMessage('admin_panel_hotkeys_title') ?>"></a><?
494
495 endif;
496
497 $aUserOpt = CUserOptions::GetOption("admin_panel", "settings");
498
499 ?><a hidefocus="true" href="javascript:void(0)" id="bx-panel-pin" class="adm-header-pin"
500 onclick="BX.adminPanel.Fix(this)"
501 title="<?= GetMessage('top_panel_pin_' . (isset($aUserOpt['fix']) && $aUserOpt['fix'] == 'on' ? 'off' : 'on')) ?>"></a><?
502
503 if (LANGUAGE_ID == "ru")
504 {
505 CJSCore::Init(['helper']);
506 $helpUrl = (new Uri('https://helpdesk.bitrix24.ru/widget2/dev/'))->addParams([
507 "url" => "https://" . $_SERVER["HTTP_HOST"] . $APPLICATION->GetCurPageParam(),
508 "user_id" => $USER->GetID(),
509 "is_admin" => $USER->IsAdmin() ? 1 : 0,
510 "help_url" => "https://dev.1c-bitrix.ru/user_help/" . $section . (defined("HELP_FILE") && str_contains(HELP_FILE, '/') ? HELP_FILE : $module . "/" . $page),
511 ]);
512
513 $frameOpenUrl = (clone $helpUrl)->addParams([
514 "action" => "open",
515 ])->getUri();
516 ?>
517 <span class="adm-header-help-btn" id="bx_top_panel_button_helper"
518 <? if (!isset($helperHeroOption["show"])): ?>onclick="BX.userOptions.save('main', 'helper_hero_admin', 'show', 'Y');"<?endif ?>>
519 <span class="adm-header-help-btn-icon"></span>
520 <span class="adm-header-help-btn-text"><?= GetMessage("top_panel_help") ?></span>
521 </span>
522 <script>
523 BX.Helper.init({
524 frameOpenUrl: '<?=$frameOpenUrl?>',
525 helpBtn: BX('bx_top_panel_button_helper'),
526 langId: '<?=LANGUAGE_ID?>',
527 needCheckNotify: 'N',
528 isAdmin: 'Y'
529 });
530 </script>
531 <?
532 }
533 else
534 {
535 $helpLink = "https://www.bitrixsoft.com/help/index.html?page=" . urlencode("source/" . $module . "/help/en/" . $page . ".html");
536 ?>
537 <span onclick="document.location.href = '<?= $helpLink ?>';" class="adm-header-help-btn"
538 id="bx_top_panel_button_helper">
539 <span class="adm-header-help-btn-icon"></span>
540 <span class="adm-header-help-btn-text"><?= GetMessage("top_panel_help") ?></span>
541 </span>
542 <?
543 }
544
545 $Execs = $hkInstance->GetCodeByClassName("bx-panel-pin", GetMessage('top_panel_pin'));
546 echo $hkInstance->PrintJSExecs($Execs);
547
548 endif;
549 ?></div>
550 </div>
551 <div class="adm-header-bottom"></div><?
552
553 if ($USER->IsAdmin())
554 {
556 }
557
558 ?></div>
559
560 <?php
561 }
562
563 protected static function showTopPanelButtonsSection($arPanelButtons, $hkInstance, $section = null)
564 {
565 global $USER;
566
567 foreach ($arPanelButtons as $item):
568 if (isset($item["SEPARATOR"]) && $item["SEPARATOR"])
569 {
570 continue;
571 }
572 if ($section == null && isset($item['SECTION']))
573 {
574 continue;
575 }
576 if ($section != null && (!isset($item['SECTION']) || $item['SECTION'] != $section))
577 {
578 continue;
579 }
580
581 $id = $item['ID'] ?? 'bx_top_panel_button_' . RandString();
582 $bHasMenu = (!empty($item["MENU"]) && is_array($item["MENU"]));
583
584 if ($USER->IsAuthorized())
585 {
586 echo $hkInstance->PrintTPButton($item);
587 }
588
589 if ($item['LINK']):
590
591 ?><a id="<?= htmlspecialcharsEx($id) ?>"
592 href="<?= htmlspecialcharsEx($item['LINK']) ?>" class="<?= $item['ICON'] ?>"<?= isset($item["TITLE"]) ? ' title="' . htmlspecialcharsEx($item["TITLE"]) . '"' : '' ?><?= isset($item["TARGET"]) ? ' target="' . htmlspecialcharsEx($item["TARGET"]) . '"' : '' ?>
593 hidefocus="true" onfocus="this.blur();"><?= htmlspecialcharsbx($item["TEXT"]) ?></a><?
594
595 else:
596
597 ?><span
598 id="<?= htmlspecialcharsEx($id) ?>" class="<?= $item['ICON'] ?>"<?= isset($item["TITLE"]) ? 'title="' . htmlspecialcharsEx($item["TITLE"]) . '"' : '' ?>><?= htmlspecialcharsbx($item["TEXT"]) ?></span><?
599
600 endif;
601
602 if ($bHasMenu || (isset($item['TOOLTIP']) && $item['TOOLTIP'] && $item['TOOLTIP_ID'])):
603 ?>
604 <script><?
605
606 if (isset($item['TOOLTIP']) && $item['TOOLTIP']):
607 if (isset($item['TOOLTIP_ID']) && $item['TOOLTIP_ID']):
608
609 ?>
610 BX.ready(function () {
611 BX.hint(BX('<?=CUtil::JSEscape($id)?>'), '<?=CUtil::JSEscape($item["TITLE"])?>', '<?=CUtil::JSEscape($item['TOOLTIP'])?>', '<?=CUtil::JSEscape($item['TOOLTIP_ID'])?>')
612 });
613 <?
614
615 endif;
616 endif;
617 if ($bHasMenu):
618
619 ?>
620 BX.adminPanel.registerButton('<?=CUtil::JSEscape($id)?>', {MENU: <?= Json::encode($item['MENU']) ?>});
621 <?
622
623 endif;
624
625 ?></script><?
626
627 endif;
629 }
630
631 protected static function getLanguageButton(): array
632 {
634
635 $arLangButton = [];
636 $arLangMenu = [];
637
638 foreach ($arLangs as $adminLang)
639 {
640 if ($adminLang['SELECTED'])
641 {
642 $arLangButton = [
643 "TEXT" => strtoupper($adminLang["LID"]),
644 "TITLE" => GetMessage("top_panel_lang") . " " . $adminLang["NAME"],
645 "LINK" => htmlspecialcharsback($adminLang["PATH"]),
646 "SECTION" => 1,
647 "ICON" => "adm-header-language",
648 ];
649 }
650
651 $arLangMenu[] = [
652 "TEXT" => '(' . $adminLang["LID"] . ') ' . $adminLang["NAME"],
653 "TITLE" => GetMessage("top_panel_lang") . " " . $adminLang["NAME"],
654 "LINK" => htmlspecialcharsback($adminLang["PATH"]),
655 ];
656 }
657
658 if (count($arLangMenu) > 1)
659 {
660 CJSCore::Init(['admin_interface']);
661 $arLangButton['MENU'] = $arLangMenu;
662 }
663 return $arLangButton;
664 }
665
666 protected static function getSettingsButton(): array
667 {
668 global $USER, $APPLICATION;
669
670 $settingsButton = [];
671 $bCanViewSettings = (is_callable([$USER, 'CanDoOperation']) && ($USER->CanDoOperation('view_other_settings') || $USER->CanDoOperation('edit_other_settings')));
672 if ($bCanViewSettings)
673 {
674 $settingsUrl = BX_ROOT . "/admin/settings.php?lang=" . LANG
675 . "&mid=" . (defined("ADMIN_MODULE_NAME") ? ADMIN_MODULE_NAME : "main")
676 . ($APPLICATION->GetCurPage() <> BX_ROOT . "/admin/settings.php" ? "&back_url_settings=" . urlencode($_SERVER["REQUEST_URI"]) : "");
677
678 $settingsButton = [
679 "TEXT" => GetMessage("top_panel_settings"),
680 "TITLE" => GetMessage("button_settings"),
681 "LINK" => $settingsUrl,
682 "ICON" => "adm-header-setting-btn",
683 "HK_ID" => "top_panel_settings",
684 ];
685 }
686 return $settingsButton;
687 }
688
689 protected static function getVendorNotification()
690 {
691 global $USER;
692
693 $vendorNotification = null;
694 $context = \Bitrix\Main\Context::getCurrent();
695
696 $notifications = VendorNotificationTable::query()
697 ->addSelect('*')
698 ->where('NOT_SIGNED', true)
699 ->fetchAll()
700 ;
701
702 foreach ($notifications as $notification)
703 {
704 try
705 {
706 $notificationData = Json::decode($notification['DATA']);
707
708 // admin filter
709 if (!empty($notificationData['forAdmin']) && !$USER->isAdmin())
710 {
711 continue;
712 }
713
714 // last view timeout
715 $securityPopupLastView = $context->getRequest()->getCookie('SECURITY_POPUP_LAST_VIEW_' . $notification['VENDOR_ID']);
716
717 if (!empty($securityPopupLastView))
718 {
719 continue;
720 }
721
722 // sanitize
723 $sanitizer = new CBXSanitizer();
724 $sanitizer->setLevel(CBXSanitizer::SECURE_LEVEL_MIDDLE);
725
726 $notificationData['title'] = strip_tags($notificationData['title']);
727 $notificationData['text'] = $sanitizer->SanitizeHtml($notificationData['text']);
728
729 if (empty($notificationData['colorTheme'])
730 && !in_array($notificationData['colorTheme'], ['danger', 'warning', 'success']))
731 {
732 $notificationData['colorTheme'] = 'warning';
733 }
734
735 $vendorNotification = $notificationData;
736 $vendorNotification['vendorId'] = $notification['VENDOR_ID'];
737
738 break;
739 }
740 catch (Throwable)
741 {
742 }
743 }
744 return $vendorNotification;
745 }
746}
const BX_ROOT
Определения bx_root.php:3
global $APPLICATION
Определения include.php:80
const ADMIN_MODULE_NAME
Определения prolog.php:2
static getInstance()
Определения application.php:98
static isModuleInstalled($moduleName)
Определения modulemanager.php:125
static getList(array $parameters=array())
Определения datamanager.php:431
static sortByColumn(array &$array, $columns, $callbacks='', $defaultValueIfNotSetValue=null, $preserveKeys=false)
Определения collection.php:24
Определения json.php:9
Определения uri.php:17
static $alertCounter
Определения admin_informer.php:11
static InsertMainItems()
Определения admin_informer.php:140
Определения admin_lib.php:682
static GetHtml()
Определения admin_notify.php:166
Определения admin_lib.php:22
Определения top_panel.php:19
static getLanguageButton()
Определения top_panel.php:631
static getSettingsButton()
Определения top_panel.php:666
static showTopPanelButtonsSection($arPanelButtons, $hkInstance, $section=null)
Определения top_panel.php:563
static Show(CAdminPage $adminPage, CAdminMenu $adminMenu)
Определения top_panel.php:20
static getVendorNotification()
Определения top_panel.php:689
static GetLangSwitcherArray()
Определения language.php:308
Определения sanitizer.php:23
const SECURE_LEVEL_MIDDLE
Определения sanitizer.php:29
static Init($arExt=array(), $bReturn=false)
Определения jscore.php:66
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$hkInstance
Определения hot_keys_act.php:7
global $adminMenu
Определения init_admin.php:7
global $adminPage
Определения init_admin.php:7
$_SERVER["DOCUMENT_ROOT"]
Определения cron_frame.php:9
global $USER
Определения csv_new_run.php:40
$context
Определения csv_new_setup.php:223
endif
Определения csv_new_setup.php:990
DeleteParam($ParamNames)
Определения tools.php:4548
htmlspecialcharsback($str)
Определения tools.php:2693
IsModuleInstalled($module_id)
Определения tools.php:5301
htmlspecialcharsEx($str)
Определения tools.php:2685
htmlspecialcharsbx($string, $flags=ENT_COMPAT, $doubleEncode=true)
Определения tools.php:2701
IncludeModuleLangFile($filepath, $lang=false, $bReturnArray=false)
Определения tools.php:3778
GetMessage($name, $aReplace=null)
Определения tools.php:3397
$arLangMenu
Определения prolog_auth_admin.php:34
$arLangs
Определения prolog_auth_admin.php:31
$arLangButton
Определения prolog_auth_admin.php:33
$aUserOpt
Определения prolog_auth_admin.php:23
global_menu_<?echo $menu["menu_id"]?> adm main menu item icon adm main menu item text text adm main menu hover adm submenu menucontainer menu_id menu_id items_id items_id desktop menu_id block none adm global submenu<?=($subMenuDisplay=="block" ? " adm-global-submenu-active" :"")?> global_submenu_<?echo $menu["menu_id"]?> text MAIN_PR_ADMIN_FAV items adm submenu items wrap adm submenu items stretch wrap BX adminMenu itemsStretchScroll()"> <table class if (!empty( $menu["items"])) elseif ( $menu[ 'menu_id']=='desktop') if ( $menu[ 'menu_id']=='desktop') endforeach
Определения prolog_main_admin.php:255
$aActiveSection
Определения prolog_main_admin.php:141
<? endif;?> window document title
Определения prolog_main_admin.php:76
die
Определения quickway.php:367
lang
Определения options.php:182
$page
Определения order_form.php:33
else $userName
Определения order_form.php:75
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
Определения waybill.php:936
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения template.php:799
const HELP_FILE
Определения update_log.php:7
$site
Определения yandex_run.php:614