public static function ShowPanel($IBLOCK_ID=0, $ELEMENT_ID=0, $SECTION_ID="", $type="news", $bGetIcons=false, $componentName="", $arLabels=array()) { /** @global CMain $APPLICATION */ global $APPLICATION; /** @global CUser $USER */ global $USER; if (($USER->IsAuthorized() || $APPLICATION->ShowPanel===true) && $APPLICATION->ShowPanel!==false) { if (CModule::IncludeModule("iblock") && strlen($type) > 0) { $arButtons = CIBlock::GetPanelButtons($IBLOCK_ID, $ELEMENT_ID, $SECTION_ID, array( "LABELS" => $arLabels, )); $mode = $APPLICATION->GetPublicShowMode(); if($bGetIcons) { return CIBlock::GetComponentMenu($mode, $arButtons); } else { CIBlock::AddPanelButtons($mode, $componentName, $arButtons); } } } return null; }
function ShowPanel($IBLOCK_ID = 0, $ELEMENT_ID = 0, $SECTION_ID = "", $type = "news", $bGetIcons = false, $componentName = "", $arLabels = array()) { global $APPLICATION, $USER; if (!(($USER->IsAuthorized() || $APPLICATION->ShowPanel === true) && $APPLICATION->ShowPanel !== false)) { return; } if (!CModule::IncludeModule("iblock") || !strlen($type)) { return; } $arButtons = CIBlock::GetPanelButtons($IBLOCK_ID, $ELEMENT_ID, $SECTION_ID, array("LABELS" => $arLabels)); $mode = $APPLICATION->GetPublicShowMode(); if ($bGetIcons) { return CIBlock::GetComponentMenu($mode, $arButtons); } else { CIBlock::AddPanelButtons($mode, $componentName, $arButtons); } }
} } } /************************************************************************* Any actions without cache (if there was some to display) *************************************************************************/ if (isset($arResult["ID"])) { $arTitleOptions = null; if (CModule::IncludeModule("iblock")) { CIBlockElement::CounterInc($arResult["ID"]); if ($USER->IsAuthorized()) { if ($APPLICATION->GetShowIncludeAreas() || $arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arReturnUrl = array("add_element" => CIBlock::GetArrayByID($arResult["IBLOCK_ID"], "DETAIL_PAGE_URL"), "delete_element" => isset($arResult["SECTION"]) ? $arResult["SECTION"]["SECTION_PAGE_URL"] : $arResult["LIST_PAGE_URL"]); $arButtons = CIBlock::GetPanelButtons($arResult["IBLOCK_ID"], $arResult["ID"], $arResult["IBLOCK_SECTION_ID"], array("RETURN_URL" => $arReturnUrl)); if ($APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $arButtons)); } if ($arParams["SET_TITLE"] || isset($arResult[$arParams["BROWSER_TITLE"]])) { $arTitleOptions = array('ADMIN_EDIT_LINK' => $arButtons["submenu"]["edit_element"]["ACTION"], 'PUBLIC_EDIT_LINK' => $arButtons["edit"]["edit_element"]["ACTION"], 'COMPONENT_NAME' => $this->GetName()); } } } } if (isset($arResult["PROPERTIES"][$arParams["META_KEYWORDS"]])) { $val = $arResult["PROPERTIES"][$arParams["META_KEYWORDS"]]["VALUE"]; if (is_array($val)) { $val = implode(" ", $val); } $APPLICATION->SetPageProperty("keywords", $val); } if (isset($arResult["PROPERTIES"][$arParams["META_DESCRIPTION"]])) {
//detail url $arResult['SECTIONS'][$arRes['ID']]['SECTION_PAGE_URL'] = htmlspecialcharsbx(str_replace( array("#SERVER_NAME#", "#SITE_DIR#", "#IBLOCK_ID#", "#SECTION_ID#", "#ELEMENT_ID#"), array(SITE_SERVER_NAME, SITE_DIR, $arParams["IBLOCK_ID"], $arRes["ID"], ""), (strlen($arParams["SECTION_URL"])>0?$arParams["SECTION_URL"]:$arRes["SECTION_PAGE_URL"]) )); } //no sections to display if(count($arResult['SECTIONS'])<=0) { $this->AbortResultCache(); @define("ERROR_404", "Y"); return false; } $this->SetResultCacheKeys(array( )); //include template $this->IncludeComponentTemplate(); } //add buttons common if($USER->IsAuthorized()) { $arButtons = CIBlock::GetPanelButtons($arParams['IBLOCK_ID'], 0, $arParams['SECTION_ID']); if($APPLICATION->GetShowIncludeAreas()) $this->AddIncludeAreaIcons(CIBlock::GetComponentMenu("configure", $arButtons)); CIBlock::AddPanelButtons($APPLICATION->GetPublicShowMode(), $this->GetName(), array("intranet"=>$arButtons["intranet"])); } ?>
/** * Add to page buttons for edit elements and sections of info-block */ protected function setEditButtons() { global $APPLICATION; if (!$APPLICATION->GetShowIncludeAreas() || $this->showEditButtons === false) { return false; } $buttons = \CIBlock::GetPanelButtons($this->arParams['IBLOCK_ID'], $this->arResult['ID'], $this->arParams['SECTION_ID'], []); $this->addIncludeAreaIcons(\CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $buttons)); if (is_array($buttons['intranet'])) { Asset::getInstance()->addJs(BX_ROOT . '/js/main/utils.js'); foreach ($buttons['intranet'] as $button) { $this->addEditButton($button); } } }
/** * Отображает кнопки управления компонентом в публичной части в режиме редактирования */ protected function showPanelButtons() { $buttons = \CIBlock::GetPanelButtons($this->arResult['IBLOCK']['ID'], 0, 0, ['SECTION_BUTTONS' => $this->arParams['ADD_PANEL_SECTION_BUTTONS'] == 'Y']); global $APPLICATION; if ($this->arParams['SHOW_PANEL_BUTTONS'] == 'Y' && $APPLICATION->GetShowIncludeAreas()) { $this->AddIncludeAreaIcons(\CIBlock::GetComponentMenu($APPLICATION->GetPublicShowMode(), $buttons)); } }