Example #1
0
function GetPanel()
{
    $panel = CTopPanel::GetPanelHtml();
    if (strlen($panel) > 0) {
        return "<tr><td id=\"panel\">" . $panel . "</td></tr>";
    }
}
Example #2
0
    function GetPanelHtml()
    {
        global $USER, $APPLICATION, $adminPage;
        if ($APPLICATION->ShowPanel === false || !$USER->IsAuthorized() && $APPLICATION->ShowPanel !== true) {
            return "";
        }
        CTopPanel::InitPanelIcons();
        $arPanelButtons =& $APPLICATION->arPanelButtons;
        $bShowPanel = false;
        foreach ($arPanelButtons as $arValue) {
            if (trim($arValue["HREF"]) != "" || is_array($arValue["MENU"]) && !empty($arValue["MENU"])) {
                //we have at least one button to show
                $bShowPanel = true;
                break;
            }
        }
        if ($bShowPanel == false) {
            $bShowPanel = self::IsShownForUser();
        }
        if ($bShowPanel == false && $APPLICATION->ShowPanel !== true) {
            return "";
        }
        $APPLICATION->PanelShowed = true;
        if (isset($_GET["back_url_admin"]) && $_GET["back_url_admin"] != "" && strpos($_GET["back_url_admin"], "/") === 0) {
            $_SESSION["BACK_URL_ADMIN"] = $_GET["back_url_admin"];
        }
        $aUserOpt = CUserOptions::GetOption("admin_panel", "settings");
        $aUserOptGlobal = CUserOptions::GetOption("global", "settings");
        $toggleModeSet = false;
        if (isset($_GET["freetrix_include_areas"]) && $_GET["freetrix_include_areas"] != "") {
            $APPLICATION->SetShowIncludeAreas($_GET["freetrix_include_areas"] == "Y");
            $toggleModeSet = true;
        }
        $params = DeleteParam(array("freetrix_include_areas", "freetrix_show_mode", "back_url_admin"));
        $href = $APPLICATION->GetCurPage();
        $hrefEnc = htmlspecialcharsbx($href);
        $toggleModeDynamic = $aUserOptGlobal['panel_dynamic_mode'] == 'Y';
        $toggleMode = $toggleModeDynamic && !$toggleModeSet ? $aUserOpt['edit'] == 'on' : $APPLICATION->GetShowIncludeAreas() == 'Y';
        //Save if changed
        $old_edit = $aUserOpt['edit'];
        $aUserOpt['edit'] = $toggleMode ? 'on' : 'off';
        if ($old_edit !== $aUserOpt['edit']) {
            CUserOptions::SetOption('admin_panel', 'settings', $aUserOpt);
        }
        $toggleModeLink = $hrefEnc . '?freetrix_include_areas=' . ($toggleMode ? 'N' : 'Y') . ($params != "" ? "&amp;" . htmlspecialcharsbx($params) : "");
        $result = CTopPanel::ShowPanelScripts(true);
        $result .= '
	<!--[if lte IE 7]>
	<style type="text/css">#bx-panel {display:none !important;}</style>
	<div id="bx-panel-error">' . GetMessage("top_panel_browser") . '</div><![endif]-->
	<script type="text/javascript">BX.admin.dynamic_mode=' . ($toggleModeDynamic ? 'true' : 'false') . '; BX.admin.dynamic_mode_show_borders = ' . ($toggleMode ? 'true' : 'false') . ';</script>
	<div style="display:none; overflow:hidden;" id="bx-panel-back"></div>
	<div id="bx-panel"' . ($aUserOpt["collapsed"] == "on" ? ' class="bx-panel-folded"' : '') . '>
		<div id="bx-panel-top">
			<div id="bx-panel-top-gutter"></div>
			<div id="bx-panel-tabs">
	';
        $result .= '
				<a id="bx-panel-menu" href="" ' . CTopPanel::AddAttrHint(GetMessage('top_panel_start_menu_tooltip_title'), GetMessage('top_panel_start_menu_tooltip')) . '><span id="bx-panel-menu-icon"></span><span id="bx-panel-menu-text">' . GetMessage("top_panel_menu") . '</span></a><a id="bx-panel-view-tab"><span>' . GetMessage("top_panel_site") . '</span></a><a id="bx-panel-admin-tab" href="' . (isset($_SESSION["BACK_URL_ADMIN"]) && $_SESSION["BACK_URL_ADMIN"] != "" ? htmlspecialcharsbx($_SESSION["BACK_URL_ADMIN"]) . (strpos($_SESSION["BACK_URL_ADMIN"], "?") !== false ? "&amp;" : "?") : '/freetrix/admin/index.php?lang=' . LANGUAGE_ID . '&amp;') . 'back_url_pub=' . urlencode($href . ($params != "" ? "?" . $params : "")) . '"><span>' . GetMessage("top_panel_admin") . '</span></a>';
        $back_url = CUtil::JSUrlEscape(CUtil::addslashes($href . ($params != "" ? "?" . $params : "")));
        $arStartMenuParams = array('DIV' => 'bx-panel-menu', 'ACTIVE_CLASS' => 'bx-pressed', 'MENU_URL' => '/freetrix/admin/get_start_menu.php?lang=' . LANGUAGE_ID . '&back_url_pub=' . urlencode($back_url) . '&' . freetrix_sessid_get(), 'MENU_PRELOAD' => $aUserOptGlobal["start_menu_preload"] == 'Y');
        $result .= '<script type="text/javascript">BX.message({MENU_ENABLE_TOOLTIP: ' . ($aUserOptGlobal['start_menu_title'] != 'N' ? 'true' : 'false') . '}); new BX.COpener(' . CUtil::PhpToJsObject($arStartMenuParams) . ');</script>';
        $hkInstance = CHotKeys::getInstance();
        $Execs = $hkInstance->GetCodeByClassName("top_panel_menu", GetMessage("top_panel_menu"));
        $result .= $hkInstance->PrintJSExecs($Execs);
        $Execs = $hkInstance->GetCodeByClassName("top_panel_admin", GetMessage("top_panel_admin"));
        $result .= $hkInstance->PrintJSExecs($Execs);
        if ($USER->CanDoOperation("cache_control")) {
            $result .= '<a id="bx-panel-clear-cache" href="" onclick="BX.clearCache(); return false;"><span id="bx-panel-clear-cache-icon"></span><span id="bx-panel-clear-cache-text">' . GetMessage("top_panel_cache_new_tooltip_title") . '</span></a>';
        }
        $result .= '
			</div>
			<div id="bx-panel-userinfo">
	';
        $bCanProfile = $USER->CanDoOperation('view_own_profile') || $USER->CanDoOperation('edit_own_profile');
        $userName = CUser::FormatName(CSite::GetNameFormat(false), array("NAME" => $USER->GetFirstName(), "LAST_NAME" => $USER->GetLastName(), "SECOND_NAME" => $USER->GetSecondName(), "LOGIN" => $USER->GetLogin()), $bUseLogin = true, $bHTMLSpec = true);
        if ($bCanProfile) {
            $result .= '<a href="/freetrix/admin/user_edit.php?lang=' . LANGUAGE_ID . '&ID=' . $USER->GetID() . '" id="bx-panel-user" ' . CTopPanel::AddAttrHint(GetMessage('top_panel_profile_tooltip')) . '><span id="bx-panel-user-icon"></span><span id="bx-panel-user-text">' . $userName . '</span></a>';
        } else {
            $result .= '<a id="bx-panel-user"><span id="bx-panel-user-icon"></span><span id="bx-panel-user-text">' . $userName . '</span></a>';
        }
        $result .= '<a href="' . $hrefEnc . '?logout=yes' . htmlspecialcharsbx(($s = DeleteParam(array("logout"))) == "" ? "" : "&" . $s) . '" id="bx-panel-logout" ' . CTopPanel::AddAttrHint(GetMessage('top_panel_logout_tooltip') . $hkInstance->GetTitle("bx-panel-logout", true)) . '>' . GetMessage("top_panel_logout") . '</a>';
        $toggleCaptionOn = '<span id="bx-panel-toggle-caption-mode-on">' . GetMessage("top_panel_on") . '</span>';
        $toggleCaptionOff = '<span id="bx-panel-toggle-caption-mode-off">' . GetMessage("top_panel_off") . '</span>';
        $toggleCaptions = $toggleMode ? $toggleCaptionOn . $toggleCaptionOff : $toggleCaptionOff . $toggleCaptionOn;
        $toogle = '<a href="' . $toggleModeLink . '" id="bx-panel-toggle" class="bx-panel-toggle' . ($toggleMode ? '-on' : '-off') . '"' . ($toggleModeDynamic ? '' : ' ' . CTopPanel::AddAttrHint(GetMessage("top_panel_edit_mode_new_tooltip_title"), GetMessage('top_panel_toggle_tooltip') . $hkInstance->GetTitle("bx-panel-small-toggle", true))) . '><span id="bx-panel-switcher-gutter-left"></span><span id="bx-panel-toggle-indicator"><span id="bx-panel-toggle-icon"></span><span id="bx-panel-toggle-icon-overlay"></span></span><span class="bx-panel-break"></span><span id="bx-panel-toggle-caption">' . GetMessage("top_panel_edit_mode_new") . '</span><span class="bx-panel-break"></span><span id="bx-panel-toggle-caption-mode">' . $toggleCaptions . '</span><span id="bx-panel-switcher-gutter-right"></span></a>';
        if ($aUserOpt["collapsed"] == "on") {
            $result .= $toogle;
        }
        $result .= '<a href="" id="bx-panel-expander" ' . CTopPanel::AddAttrHint(GetMessage("top_panel_expand_tooltip_title"), GetMessage("top_panel_expand_tooltip") . $hkInstance->GetTitle("bx-panel-expander", true)) . '><span id="bx-panel-expander-text">' . GetMessage("top_panel_expand") . '</span><span id="bx-panel-expander-arrow"></span></a>';
        if ($hkInstance->IsActive()) {
            $result .= '<a id="bx-panel-hotkeys" href="javascript:void(0)" onclick="BXHotKeys.ShowSettings();" ' . CTopPanel::AddAttrHint(GetMessage("HK_PANEL_TITLE") . $hkInstance->GetTitle("bx-panel-hotkeys", true)) . '></a>';
        }
        $result .= '<a href="javascript:void(0)" id="bx-panel-pin"' . ($aUserOpt['fix'] == 'on' ? ' class="bx-panel-pin-fixed"' : '') . ' ' . CTopPanel::AddAttrHint(GetMessage('top_panel_pin_tooltip')) . '></a>';
        $Execs = $hkInstance->GetCodeByClassName("bx-panel-logout", GetMessage('top_panel_logout_tooltip'));
        $result .= $hkInstance->PrintJSExecs($Execs);
        $Execs = $hkInstance->GetCodeByClassName("bx-panel-small-toggle", GetMessage("top_panel_edit_mode_new_tooltip_title"), 'location.href="' . $href . '?freetrix_include_areas=' . ($toggleMode ? 'N' : 'Y') . ($params != "" ? "&" . $params : "") . '";');
        $result .= $hkInstance->PrintJSExecs($Execs);
        $Execs = $hkInstance->GetCodeByClassName("bx-panel-expander", GetMessage("top_panel_expand_tooltip_title") . "/" . GetMessage("top_panel_collapse_tooltip_title"));
        $result .= $hkInstance->PrintJSExecs($Execs);
        $result .= '
			</div>
		</div>
	';
        /* BUTTONS */
        $result .= '<div id="bx-panel-site-toolbar"><div id="bx-panel-buttons-gutter"></div><div id="bx-panel-switcher">';
        if ($aUserOpt["collapsed"] != "on") {
            $result .= $toogle;
        }
        $result .= '<a href="" id="bx-panel-hider" ' . CTopPanel::AddAttrHint(GetMessage("top_panel_collapse_tooltip_title"), GetMessage("top_panel_collapse_tooltip") . $hkInstance->GetTitle("bx-panel-expander", true)) . '>' . GetMessage("top_panel_collapse") . '<span id="bx-panel-hider-arrow"></span></a>';
        $result .= '</div><div id="bx-panel-buttons"><div id="bx-panel-buttons-inner">';
        $main_sort = "";
        $last_btn_type = '';
        $last_btn_small_cnt = 0;
        $groupId = -1;
        $result .= '<span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
        sortByColumn($arPanelButtons, array("MAIN_SORT" => SORT_ASC, "SORT" => SORT_ASC));
        foreach ($arPanelButtons as $key => $arButton) {
            $result .= $hkInstance->PrintTPButton($arButton);
            if ($main_sort != $arButton["MAIN_SORT"] && $main_sort != "") {
                $result .= '</span><span class="bx-panel-button-separator"></span><span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
                $last_btn_small_cnt = 0;
            }
            if (!isset($arButton['TYPE']) || $arButton['TYPE'] != 'BIG') {
                $arButton['TYPE'] = 'SMALL';
            }
            //very old behaviour
            if (is_set($arButton, "SRC_0")) {
                $arButton["SRC"] = $arButton["SRC_0"];
            }
            $arButton['HREF'] = isset($arButton['HREF']) ? trim($arButton['HREF']) : '';
            $bHasAction = $arButton['HREF'] != '';
            if (array_key_exists("RESORT_MENU", $arButton) && $arButton["RESORT_MENU"] === true && is_array($arButton['MENU']) && !empty($arButton['MENU'])) {
                sortByColumn($arButton['MENU'], "SORT", '', PHP_INT_MAX);
            }
            $bHasMenu = is_array($arButton['MENU']) && count($arButton['MENU']) > 0;
            if ($bHasMenu && !$bHasAction) {
                foreach ($arButton['MENU'] as $arItem) {
                    if (isset($arItem['DEFAULT']) && $arItem['DEFAULT']) {
                        $arButton['HREF'] = $arItem['HREF'];
                        $bHasAction = true;
                    }
                }
            }
            if ($last_btn_type != '' && $arButton['TYPE'] != $last_btn_type && $main_sort == $arButton["MAIN_SORT"]) {
                $result .= '</span><span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
                $last_btn_small_cnt = 0;
            }
            if ($bHasAction && substr(strtolower($arButton['HREF']), 0, 11) == 'javascript:') {
                $arButton['ONCLICK'] = substr($arButton['HREF'], 11);
                $arButton['HREF'] = 'javascript:void(0)';
            }
            if ($arButton['HINT']) {
                if (isset($arButton['HINT']['ID']) && $arButton['HINT']['ID']) {
                    $hintOptions = CUtil::GetPopupOptions($arButton['HINT']['ID']);
                    if ($hintOptions['display'] == 'off') {
                        unset($arButton['HINT']);
                    }
                }
                if ($arButton['HINT']) {
                    unset($arButton['ALT']);
                }
                if ($bHasMenu && (!isset($arButton['HINT_MENU']) || !$arButton['HINT_MENU'])) {
                    $arButton['HINT']['TARGET'] = 'parent';
                }
            }
            $title = isset($arButton['ALT']) ? htmlspecialcharsbx($arButton['ALT']) : '';
            $onClick = isset($arButton['ONCLICK']) ? htmlspecialcharsbx($arButton['ONCLICK']) : '';
            $onClickJs = isset($arButton['ONCLICK']) ? CUtil::JSEscape($arButton['ONCLICK']) : '';
            $hintMenu = isset($arButton['HINT_MENU']) ? CUtil::PhpToJsObject($arButton['HINT_MENU']) : '';
            switch ($arButton['TYPE']) {
                case 'SMALL':
                    if ($last_btn_small_cnt >= 3 && $main_sort == $arButton["MAIN_SORT"]) {
                        $result .= '</span><span class="bx-panel-button-group" data-group-id="' . ++$groupId . '">';
                        $last_btn_small_cnt = 0;
                    } elseif ($last_btn_small_cnt > 0) {
                        $result .= '<span class="bx-panel-break"></span>';
                    }
                    $result .= '<span class="bx-panel-small-button"><span class="bx-panel-small-button-inner">';
                    $button_icon = '<span class="bx-panel-small-button-icon' . ($arButton['ICON'] ? ' ' . $arButton['ICON'] : '') . '"' . (isset($arButton['SRC']) && $arButton['SRC'] ? ' style="background: scroll transparent url(' . htmlspecialcharsbx($arButton['SRC']) . ') no-repeat center center !important;"' : '') . '></span>';
                    $button_text = '<span class="bx-panel-small-button-text">' . htmlspecialcharsbx($arButton['TEXT']) . '</span>';
                    $button_text_js = CUtil::JSEscape($arButton['TEXT']);
                    if ($bHasAction) {
                        $result .= '<a href="' . htmlspecialcharsbx($arButton['HREF']) . '" onclick="' . $onClick . ';BX.removeClass(this.parentNode.parentNode, \'bx-panel-small-button' . ($bHasMenu ? '-text' : '') . '-active\')" id="bx_topmenu_btn_' . $key . '"' . ($title ? ' title="' . $title . $hkInstance->GetTitle("bx_topmenu_btn_" . $key) . '"' : '"' . $hkInstance->GetTitle("bx_topmenu_btn_" . $key) . '"') . '>' . $button_icon . $button_text . '</a>';
                        $result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '\', TYPE: \'SMALL\', ACTIVE_CSS: \'bx-panel-small-button' . ($bHasMenu ? '-text' : '') . '-active\', HOVER_CSS: \'bx-panel-small-button' . ($bHasMenu ? '-text' : '') . '-hover\'' . ($arButton['HINT'] ? ', HINT: ' . CUtil::PhpToJsObject($arButton['HINT']) : '') . ', GROUP_ID : ' . $groupId . ', SKIP : ' . ($bHasMenu ? "true" : "false") . ', LINK: "' . CUtil::JSEscape($arButton['HREF']) . '", ACTION : "' . $onClickJs . '",TEXT :  "' . $button_text_js . '" })</script>';
                        if ($bHasMenu) {
                            $result .= '<a href="javascript:void(0)" class="bx-panel-small-button-arrow" id="bx_topmenu_btn_' . $key . '_menu"><span class="bx-panel-small-button-arrow"></span></a>';
                            $result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '_menu\', TYPE: \'SMALL\', MENU: ' . CUtil::PhpToJsObject($arButton['MENU']) . ', ACTIVE_CSS: \'bx-panel-small-button-arrow-active\', HOVER_CSS: \'bx-panel-small-button-arrow-hover\'' . ($hintMenu ? ', HINT: ' . $hintMenu : '') . ', GROUP_ID : ' . $groupId . ', TEXT :  "' . $button_text_js . '"})</script>';
                        }
                    } elseif ($bHasMenu) {
                        $result .= '<a href="javascript:void(0)" id="bx_topmenu_btn_' . $key . '"' . ($title ? ' title="' . $title . '"' : '') . '>' . $button_icon . $button_text . '<span class="bx-panel-small-single-button-arrow"></span></a>';
                        $result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '\', TYPE: \'SMALL\', MENU: ' . CUtil::PhpToJsObject($arButton['MENU']) . ', ACTIVE_CSS: \'bx-panel-small-button-active\', HOVER_CSS: \'bx-panel-small-button-hover\'' . ($arButton['HINT'] ? ', HINT: ' . CUtil::PhpToJsObject($arButton['HINT']) : '') . ', GROUP_ID : ' . $groupId . ', TEXT :  "' . $button_text_js . '"})</script>';
                    }
                    $result .= '</span></span>';
                    $last_btn_small_cnt++;
                    break;
                case 'BIG':
                    $last_btn_small_cnt = 0;
                    $result .= '<span class="bx-panel-button"><span class="bx-panel-button-inner">';
                    $button_icon = '<span class="bx-panel-button-icon' . ($arButton['ICON'] ? ' ' . $arButton['ICON'] : '') . '"' . (isset($arButton['SRC']) && $arButton['SRC'] ? ' style="background: scroll transparent url(' . htmlspecialcharsbx($arButton['SRC']) . ') no-repeat center center !important;"' : '') . '></span>';
                    $button_text_js = CUtil::JSEscape(str_replace('#BR#', ' ', $arButton['TEXT']));
                    if ($bHasAction && $bHasMenu) {
                        $button_text = '<span class="bx-panel-button-text">' . str_replace('#BR#', '<span class="bx-panel-break"></span>', $arButton['TEXT']) . '&nbsp;<span class="bx-panel-button-arrow"></span></span>';
                        $result .= '<a href="' . htmlspecialcharsbx($arButton['HREF']) . '" onclick="' . $onClick . ';BX.removeClass(this.parentNode.parentNode, \'bx-panel-button-icon-active\');" id="bx_topmenu_btn_' . $key . '"' . ($title ? ' title="' . $title . '"' : '') . '>' . $button_icon . '</a><a id="bx_topmenu_btn_' . $key . '_menu" href="javascript:void(0)">' . $button_text . '</a>';
                        $result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '\', TYPE: \'BIG\', ACTIVE_CSS: \'bx-panel-button-icon-active\', HOVER_CSS: \'bx-panel-button-icon-hover\'' . ($arButton['HINT'] ? ', HINT: ' . CUtil::PhpToJsObject($arButton['HINT']) : '') . ', GROUP_ID : ' . $groupId . ', SKIP : true }); BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '_menu\', TYPE: \'BIG\', MENU: ' . CUtil::PhpToJsObject($arButton['MENU']) . ', ACTIVE_CSS: \'bx-panel-button-text-active\', HOVER_CSS: \'bx-panel-button-text-hover\'' . ($hintMenu ? ', HINT: ' . $hintMenu : '') . ', GROUP_ID : ' . $groupId . ', TEXT :  "' . $button_text_js . '"})</script>';
                    } else {
                        if ($bHasAction) {
                            $button_text = '<span class="bx-panel-button-text">' . str_replace('#BR#', '<span class="bx-panel-break"></span>', $arButton['TEXT']) . '</span>';
                            $result .= '<a href="' . htmlspecialcharsbx($arButton['HREF']) . '" onclick="' . $onClick . ';BX.removeClass(this.parentNode.parentNode, \'bx-panel-button-active\');" id="bx_topmenu_btn_' . $key . '"' . ($title ? ' title="' . $title . '"' : '') . '>' . $button_icon . $button_text . '</a>';
                            $result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '\', TYPE: \'BIG\', ACTIVE_CSS: \'bx-panel-button-active\', HOVER_CSS: \'bx-panel-button-hover\'' . ($arButton['HINT'] ? ', HINT: ' . CUtil::PhpToJsObject($arButton['HINT']) : '') . ', GROUP_ID : ' . $groupId . ', LINK: "' . CUtil::JSEscape($arButton['HREF']) . '", ACTION : "' . $onClickJs . '", TEXT :  "' . $button_text_js . '"});</script>';
                        } else {
                            $button_text = '<span class="bx-panel-button-text">' . str_replace('#BR#', '<span class="bx-panel-break"></span>', $arButton['TEXT']) . '&nbsp;<span class="bx-panel-button-arrow"></span></span>';
                            $result .= '<a href="javascript:void(0)" id="bx_topmenu_btn_' . $key . '_menu">' . $button_icon . $button_text . '</a>';
                            $result .= '<script type="text/javascript">BX.admin.panel.RegisterButton({ID: \'bx_topmenu_btn_' . $key . '_menu\', TYPE: \'BIG\', MENU: ' . CUtil::PhpToJsObject($arButton['MENU']) . ', ACTIVE_CSS: \'bx-panel-button-active\', HOVER_CSS: \'bx-panel-button-hover\'' . ($arButton['HINT'] ? ', HINT: ' . CUtil::PhpToJsObject($arButton['HINT']) : '') . ', GROUP_ID : ' . $groupId . ', TEXT :  "' . $button_text_js . '"});</script>';
                        }
                    }
                    $result .= '</span></span>';
                    break;
            }
            $main_sort = $arButton["MAIN_SORT"];
            $last_btn_type = $arButton['TYPE'];
        }
        $result .= '</span>';
        $result .= '</div>
			</div>
		</div>';
        if ($USER->IsAdmin()) {
            $result .= CAdminNotify::GetHtml();
        }
        $result .= '
	</div>
	';
        $result .= '<script type="text/javascript">
		BX.admin.panel.state = {
			fixed: ' . ($aUserOpt["fix"] == "on" ? 'true' : 'false') . ',
			collapsed: ' . ($aUserOpt["collapsed"] == "on" ? 'true' : 'false') . '
		}
		BX.admin.moreButton.init({ buttonTitle : "' . GetMessageJS("top_panel_more_button_title") . '"});
		</script>';
        //start menu preload
        // if($aUserOptGlobal["start_menu_preload"] == 'Y')
        // 	$result .= '<script type="text/javascript">BX.ready(function(){jsStartMenu.PreloadMenu(\''.CUtil::JSEscape($href.($params<>""? "?".$params:"")).'\');});</script>';
        //show script to play sound
        $result .= $adminPage->ShowSound();
        return $result;
    }
Example #3
0
 /**
  * Checks if admin panel will be shown or not.
  * Disables itself if panel will be show.
  *
  * @return void
  */
 public static function checkAdminPanel()
 {
     if ($GLOBALS["APPLICATION"]->showPanelWasInvoked === true && self::getUseHTMLCache() && !self::isAjaxRequest() && \CTopPanel::shouldShowPanel()) {
         self::setEnable(false);
     }
 }
Example #4
0
 function GetPanel()
 {
     global $USER;
     if (isset($GLOBALS["USER"]) && is_object($USER) && $USER->IsAuthorized() && !isset($_REQUEST["bx_hit_hash"])) {
         echo CTopPanel::GetPanelHtml();
     }
 }
Example #5
0
 public static function catchCatalogOrder($orderId, $arFields, $arOrder, $isNew)
 {
     if (!static::isOn()) {
         return;
     }
     if (!$isNew) {
         // only new orders
         return;
     }
     $data = static::getOrderInfo($orderId);
     // catalog items only
     if (empty($data['products'])) {
         return;
     }
     // add bxuid
     $data['bx_user_id'] = static::getBxUserId();
     if (empty($data['bx_user_id']) && !empty($data['user_id'])) {
         $orderUser = UserTable::getRow(array('select' => array('BX_USER_ID'), 'filter' => array('=ID' => $data['user_id'])));
         if (!empty($orderUser) && !empty($orderUser['BX_USER_ID'])) {
             $data['bx_user_id'] = $orderUser['BX_USER_ID'];
         }
     }
     // add general info
     $data['paid'] = '0';
     $data['domain'] = Context::getCurrent()->getServer()->getHttpHost();
     $data['date'] = date(DATE_ISO8601);
     // add debug info
     global $USER;
     $data['real_user_id'] = $USER->getId() ?: 0;
     $data['cookie_size'] = count($_COOKIE);
     $data['is_admin'] = (int) $USER->IsAdmin();
     $data['admin_section'] = (int) (defined('ADMIN_SECTION') && ADMIN_SECTION);
     $data['admin_panel'] = (int) \CTopPanel::shouldShowPanel();
     // try to guess unnatural orders
     $data['artificial_order'] = (int) ($data['user_id'] != $data['real_user_id'] || !$data['cookie_size'] || $data['is_admin'] || $data['admin_section'] || $data['admin_panel']);
     CounterDataTable::add(array('TYPE' => 'order', 'DATA' => $data));
     // set bxuid to the order
     if (!empty($data['bx_user_id'])) {
         // if sale version is fresh enough
         if (OrderTable::getEntity()->hasField('BX_USER_ID')) {
             OrderTable::update($data['order_id'], array('BX_USER_ID' => $data['bx_user_id']));
         }
     }
 }
Example #6
0
 /**
  * <p>Выводит HTML представляющий из себя панель управления публичной частью. Динамичный метод.</p>
  *
  *
  * @return string 
  *
  * <h4>See Also</h4> 
  * <ul> <li> <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cmain/showpanel.php">CMain::ShowPanel</a> </li> <li>
  * <a href="http://dev.1c-bitrix.ru/api_help/main/reference/cmain/addpanelbutton.php">CMain::AddPanelButton</a> </li>
  * </ul><br><br>
  *
  *
  * @static
  * @link http://dev.1c-bitrix.ru/api_help/main/reference/cmain/getpanel.php
  * @author Bitrix
  */
 public static function GetPanel()
 {
     global $USER;
     $isFrameAjax = Bitrix\Main\Page\Frame::getUseHTMLCache() && Bitrix\Main\Page\Frame::isAjaxRequest();
     if (isset($GLOBALS["USER"]) && is_object($USER) && $USER->IsAuthorized() && !isset($_REQUEST["bx_hit_hash"]) && !$isFrameAjax) {
         echo CTopPanel::GetPanelHtml();
     }
 }
Example #7
0
	function GetPanel()
	{
		if(isset($GLOBALS["USER"]) && is_object($GLOBALS["USER"]) && $GLOBALS["USER"]->IsAuthorized() && !isset($_REQUEST["bx_hit_hash"]))
			echo CTopPanel::GetPanelHtml();
	}