Поддержка серверов

CCatalogAdmin::get_sections_menu: метод Битрикс

Постоянная ссылка: http://bxapi.ru/src/?id=179467

//    CCatalogAdmin::get_sections_menu()
//    /bitrix/modules/catalog/general/admin.php:51

    public static function get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL, $SECTION_ID, $arSectionsChain = false)
    {
        global $adminMenu;
        if ($arSectionsChain === false)
        {
            $arSectionsChain = array();
            if (isset($_REQUEST['admin_mnu_menu_id']))
            {
                $menu_id = "menu_catalog_category_".$IBLOCK_ID."/";
                if (strncmp($_REQUEST['admin_mnu_menu_id'], $menu_id, strlen($menu_id)) == 0)
                {
                    $rsSections = CIBlockSection::GetNavChain($IBLOCK_ID, substr($_REQUEST['admin_mnu_menu_id'], strlen($menu_id)), array('ID', 'IBLOCK_ID'));
                    while ($arSection = $rsSections->Fetch())
                        $arSectionsChain[$arSection["ID"]] = $arSection["ID"];
                }
            }
            if(
                isset($_REQUEST["find_section_section"])
                && (int)$_REQUEST["find_section_section"] > 0
                && isset($_REQUEST["IBLOCK_ID"])
                && $_REQUEST["IBLOCK_ID"] == $IBLOCK_ID
            )
            {
                $rsSections = CIBlockSection::GetNavChain($IBLOCK_ID, $_REQUEST["find_section_section"], array('ID', 'IBLOCK_ID'));
                while ($arSection = $rsSections->Fetch())
                    $arSectionsChain[$arSection["ID"]] = $arSection["ID"];
            }
            if (isset($_REQUEST["public_menu"]) || (defined("PUBLIC_MODE") && PUBLIC_MODE == 1))
            {
                $arSectionsChain = array();
                $rsSections = CIBlockSection::GetList(array(), array("IBLOCK_ID" => $IBLOCK_ID), false, array("ID"));
                while ($arSection = $rsSections->Fetch())
                {
                    $arSectionsChain[$arSection["ID"]] = $arSection["ID"];
                }
            }
        }

        $baseUrlSectionAdminPage = CIBlock::GetAdminSectionListLink($IBLOCK_ID, array("catalog" => null, "skip_public" => true));

        $arSections = array();
        $rsSections = CIBlockSection::GetList(
            array("LEFT_MARGIN" => "ASC"),
            array(
                "IBLOCK_ID" => $IBLOCK_ID,
                "SECTION_ID" => $SECTION_ID,
            ),
            false,
            array("ID", "IBLOCK_SECTION_ID", "NAME", "LEFT_MARGIN", "RIGHT_MARGIN")
        );
        $intCount = 0;
        $arOtherSectionTmp = array();
        $limit = (int)Option::get('iblock', 'iblock_menu_max_sections');
        $sortCount = 0.01;
        while ($arSection = $rsSections->Fetch())
        {
            $arSection['ID'] = (int)$arSection['ID'];
            $arSection['IBLOCK_SECTION_ID'] = (int)$arSection['IBLOCK_SECTION_ID'];
            if ($limit > 0 && $intCount >= $limit)
            {
                if (empty($arOtherSectionTmp))
                {
                    $urlSectionAdminPage = $baseUrlSectionAdminPage."&find_section_section=".
                        $arSection["IBLOCK_SECTION_ID"]."&SECTION_ID=".$arSection["IBLOCK_SECTION_ID"];
                    $arOtherSectionTmp = array(
                        "text" => Loc::getMessage("CAT_MENU_ALL_OTH"),
                        "url" => $urlSectionAdminPage."&apply_filter=Y",
                        "more_url" => array(
                            $urlSectionAdminPage,
                            CIBlock::GetAdminElementListLink($IBLOCK_ID, array("find_section_section" => $arSection["ID"])),
                            CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array("find_section_section" => $arSection["ID"])),
                            CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null)),
                            CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null)),
                        ),
                        "title" => Loc::getMessage("CAT_MENU_ALL_OTH_TITLE"),
                        "icon" => "iblock_menu_icon_sections",
                        "page_icon" => "iblock_page_icon_sections",
                        "skip_chain" => true,
                        "items_id" => "menu_catalog_category_".$IBLOCK_ID."/".$arSection["ID"],
                        "module_id" => "catalog",
                        "items" => array(),
                        "sort" => 203+$sortCount,
                    );
                    CCatalogAdmin::get_other_elements_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $arSection, $arOtherSectionTmp["more_url"]);
                }
                else
                {
                    $arOtherSectionTmp['more_url'][] = $baseUrlSectionAdminPage."&find_section_section=".$arSection["ID"]."&SECTION_ID=".$arSection["ID"];
                    $arOtherSectionTmp['more_url'][] = CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array("find_section_section" => $arSection["ID"]));
                    $arOtherSectionTmp['more_url'][] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null));
                    $arOtherSectionTmp['more_url'][] = CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null));
                }
                $sortCount += $sortCount + 0.01;
            }
            else
            {
                $urlSectionAdminPage = $baseUrlSectionAdminPage."&find_section_section=".$arSection["ID"]."&SECTION_ID=".$arSection["ID"];
                $arSectionTmp = array(
                    "text" => htmlspecialcharsEx($arSection["NAME"]),
                    "url" => $urlSectionAdminPage."&apply_filter=Y",
                    "more_url" => array(
                        $urlSectionAdminPage,
                        CIBlock::GetAdminElementListLink($IBLOCK_ID, array("find_section_section" => $arSection["ID"])),
                        CIBlock::GetAdminElementEditLink($IBLOCK_ID, 0, array("find_section_section" => $arSection["ID"])),
                        CIBlock::GetAdminSectionEditLink($IBLOCK_ID, 0, array('catalog' => null)),
                        CIBlock::GetAdminSectionEditLink($IBLOCK_ID, $arSection["ID"], array('catalog' => null)),
                    ),
                    "title" => htmlspecialcharsEx($arSection["NAME"]),
                    "icon" => "iblock_menu_icon_sections",
                    "page_icon" => "iblock_page_icon_sections",
                    "skip_chain" => true,
                    "items_id" => "menu_catalog_category_".$IBLOCK_ID."/".$arSection["ID"],
                    "module_id" => "catalog",
                    "dynamic" => (($arSection["RIGHT_MARGIN"] - $arSection["LEFT_MARGIN"]) > 1),
                    "items" => array(),
                    "sort" => 203+$sortCount,
                );

                if (isset($arSectionsChain[$arSection["ID"]]))
                {
                    $arSectionTmp["items"] = CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"], $arSectionsChain);
                }
                elseif (method_exists($adminMenu, "IsSectionActive"))
                {

                    if ($adminMenu->IsSectionActive("menu_catalog_category_".$IBLOCK_ID."/".$arSection["ID"]))
                        $arSectionTmp["items"] = CCatalogAdmin::get_sections_menu($IBLOCK_TYPE_ID, $IBLOCK_ID, $DEPTH_LEVEL + 1, $arSection["ID"], $arSectionsChain);
                }

                $arSections[] = $arSectionTmp;
                $sortCount += $sortCount + 0.01;
            }
            $intCount++;
        }
        if (!empty($arOtherSectionTmp))
            $arSections[] = $arOtherSectionTmp;
        return $arSections;
    }

Блог разработчика

9 Августа 2016 ResizeImageGet и простой водяной знак налету

Сегодня поговорим о том как проще всего воткнуть водяной знак на картинки в Битрикс. Например, на все изображения каталога.

21 Июля 2016 Добавление вкладки в CRM коробки Битрикс24

В этом посте я покажу, как легко и просто добавить вкладку в сущность CRM. И не просто добавить, а вывести там свой контент.

21 Июля 2016 Как просто обращаться из коробки Битрикс24 на сайт на базе Битрикс

К примеру вам хочется внутренним скриптом дернуть с сайта-магазина информацию, которая там, в свою очередь, закрыта некоторыми правами. Например, админскими. Можно конечно мутить свой REST, или иной формат общения, но проще всего воспользоваться штатным инструментом:

Текст сообщения*
Загрузить изображение