function OnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) { global $USER; if (!CModule::IncludeModule("iblock")) { return; } //When UnRegisterModuleDependences is called from module uninstall //cached EventHandlers may be called if (defined("BX_CATALOG_UNINSTALLED")) { return; } $aMenu = array("text" => GetMessage("CAT_MENU_ROOT"), "title" => "", "items_id" => "menu_catalog_list", "items" => array()); $arCatalogs = array(); $rsCatalog = CCatalog::GetList(array("sort" => "asc")); while ($ar = $rsCatalog->Fetch()) { if ($ar["PRODUCT_IBLOCK_ID"]) { $arCatalogs[$ar["PRODUCT_IBLOCK_ID"]] = 1; } else { $arCatalogs[$ar["IBLOCK_ID"]] = 1; } } $rsIBlocks = CIBlock::GetList(array("SORT" => "asc", "NAME" => "ASC"), array("MIN_PERMISSION" => "U")); while ($arIBlock = $rsIBlocks->Fetch()) { if (array_key_exists($arIBlock["ID"], $arCatalogs)) { $arItems = array(array("text" => GetMessage("CAT_MENU_PRODUCT_LIST"), "url" => "cat_product_admin.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arIBlock["ID"] . "&type=" . urlencode($arIBlock["IBLOCK_TYPE_ID"]), "more_url" => array("cat_product_admin.php?IBLOCK_ID=" . $arIBlock["ID"], "cat_product_edit.php?IBLOCK_ID=" . $arIBlock["ID"]), "title" => "", "page_icon" => "iblock_page_icon_elements", "items_id" => "menu_catalog_goods_" . $arIBlock["ID"], "module_id" => "catalog"), array("text" => htmlspecialcharsex(CIBlock::GetArrayByID($arIBlock["ID"], "SECTIONS_NAME")), "url" => "cat_section_admin.php?lang=" . LANGUAGE_ID . "&type=" . $arIBlock["IBLOCK_TYPE_ID"] . "&IBLOCK_ID=" . $arIBlock["ID"] . "&find_section_section=0", "more_url" => array("cat_section_admin.php?IBLOCK_ID=" . $arIBlock["ID"] . "&find_section_section=0", "cat_section_edit.php?IBLOCK_ID=" . $arIBlock["ID"] . "&find_section_section=0"), "title" => "", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_category_" . $arIBlock["ID"], "module_id" => "catalog", "items" => CCatalogAdmin::get_sections_menu($arIBlock["IBLOCK_TYPE_ID"], $arIBlock["ID"], 1, 0))); if (CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) { $arItems[] = array("text" => GetMessage("CAT_MENU_PRODUCT_PROPERTIES"), "url" => "iblock_property_admin.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arIBlock["ID"] . "&admin=N", "more_url" => array("iblock_property_admin.php?IBLOCK_ID=" . $arIBlock["ID"] . "&admin=N", "iblock_edit_property.php?IBLOCK_ID=" . $arIBlock["ID"] . "&admin=N"), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_attributes_" . $arIBlock["ID"], "module_id" => "catalog"); } $arCatalog = false; if (CModule::IncludeModule("catalog")) { $arCatalog = CCatalog::GetSkuInfoByProductID($arIBlock["ID"]); } if (is_array($arCatalog) && CIBlockRights::UserHasRightTo($arCatalog["IBLOCK_ID"], $arCatalog["IBLOCK_ID"], "iblock_edit")) { $arItems[] = array("text" => GetMessage("CAT_MENU_SKU_PROPERTIES"), "url" => "iblock_property_admin.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arCatalog["IBLOCK_ID"] . "&admin=N", "more_url" => array("iblock_property_admin.php?IBLOCK_ID=" . $arCatalog["IBLOCK_ID"] . "&admin=N", "iblock_edit_property.php?IBLOCK_ID=" . $arCatalog["IBLOCK_ID"] . "&admin=N"), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_attributes_" . $arCatalog["IBLOCK_ID"], "module_id" => "catalog"); } if (CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) { $arItems[] = array("text" => GetMessage("CAT_MENU_CATALOG_SETTINGS"), "url" => "cat_catalog_edit.php?lang=" . LANGUAGE_ID . "&IBLOCK_ID=" . $arIBlock["ID"], "more_url" => array("cat_catalog_edit.php?IBLOCK_ID=" . $arIBlock["ID"]), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_edit_" . $arIBlock["ID"], "module_id" => "catalog"); } $aMenu["items"][] = array("text" => htmlspecialcharsEx($arIBlock["NAME"]), "title" => "", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_" . $arIBlock["ID"], "module_id" => "catalog", "items" => $arItems); } } if (!empty($aMenu["items"])) { if (count($aMenu["items"]) == 1) { $aMenu = $aMenu["items"][0]; } $aMenu["parent_menu"] = "global_menu_store"; $aMenu["section"] = "catalog_list"; $aMenu["sort"] = 200; $aMenu["icon"] = "iblock_menu_icon_sections"; $aMenu["page_icon"] = "iblock_page_icon_types"; $aModuleMenu[] = $aMenu; } }
} $urlCurrent = CHTTP::urlDeleteParams($urlCurrent, array($tmp[0])); $arUrlAdd[$tmp[0]] = $tmp[1]; } } $url = CHTTP::urlAddParams($urlCurrent, $arUrlAdd, array("encode", "skip_empty")); $arCatalog[$key]["url"] = $url; if (isset($submenu["items"]) && count($submenu["items"]) > 0) { $subCatal = fReplaceUrl($submenu["items"], $urlCurrentDefault); $arCatalog[$key]["items"] = $subCatal; } } return $arCatalog; } $urlCurrent = $APPLICATION->GetCurPageParam(); $arCatalog = CCatalogAdmin::get_sections_menu('', $iblockId, 2, 0); $arCatalog = fReplaceUrl($arCatalog, $urlCurrent); foreach ($arCatalog as $submenu) { $adminMenu->_SetActiveItems($submenu, array()); $adminMenu->Show($submenu, 0, $urlCurrent); } ?> </div> </td> <td valign="top" align="left" style="border-left: 1px solid rgb(164, 185, 204);padding-left:15px;"> <form name="find_form" method="GET" onsubmit="checkParameters(this); return false;" action="<?php echo $APPLICATION->GetCurPage(); ?> ?" accept-charset="<?php echo LANG_CHARSET; ?>
function OnBuildGlobalMenu(&$aGlobalMenu, &$aModuleMenu) { if (defined("BX_CATALOG_UNINSTALLED")) return; if (!Loader::includeModule("iblock")) return; $aMenu = array( "text" => Loc::getMessage("CAT_MENU_ROOT"), "title" => "", "items_id" => "menu_catalog_list", "items" => array(), ); $arCatalogs = array(); $arCatalogSku = array(); $rsCatalog = CCatalog::GetList( array(), array(), false, false, array('IBLOCK_ID', 'PRODUCT_IBLOCK_ID') ); while ($ar = $rsCatalog->Fetch()) { $ar["PRODUCT_IBLOCK_ID"] = (int)$ar["PRODUCT_IBLOCK_ID"]; $ar["IBLOCK_ID"] = (int)$ar["IBLOCK_ID"]; if ($ar["PRODUCT_IBLOCK_ID"] > 0) { $arCatalogs[$ar["PRODUCT_IBLOCK_ID"]] = 1; $arCatalogSku[$ar["PRODUCT_IBLOCK_ID"]] = $ar["IBLOCK_ID"]; } else { $arCatalogs[$ar["IBLOCK_ID"]] = 1; } } if (empty($arCatalogs)) { return; } $rsIBlocks = CIBlock::GetList( array("SORT" => "ASC", "NAME" => "ASC"), array('ID' => array_keys($arCatalogs), "MIN_PERMISSION" => "S") ); while ($arIBlock = $rsIBlocks->Fetch()) { if (CIBlock::GetAdminListMode($arIBlock["ID"]) == 'C') $url = "cat_product_list.php"; else $url = "cat_product_admin.php"; $arItems = array( array( "text" => Loc::getMessage("CAT_MENU_PRODUCT_LIST"), "url" => $url."?lang=".LANGUAGE_ID."&IBLOCK_ID=".$arIBlock["ID"]."&type=".urlencode($arIBlock["IBLOCK_TYPE_ID"]).'&find_section_section=-1', "more_url" => array( "cat_product_admin.php?IBLOCK_ID=".$arIBlock["ID"], "cat_product_list.php?IBLOCK_ID=".$arIBlock["ID"].'&find_section_section=-1', "cat_product_edit.php?IBLOCK_ID=".$arIBlock["ID"], ), "title" => "", "page_icon" => "iblock_page_icon_elements", "items_id" => "menu_catalog_goods_".$arIBlock["ID"], "module_id" => "catalog", ), array( "text" => htmlspecialcharsex(CIBlock::GetArrayByID($arIBlock["ID"], "SECTIONS_NAME")), "url" => "cat_section_admin.php?lang=".LANGUAGE_ID."&type=".$arIBlock["IBLOCK_TYPE_ID"]."&IBLOCK_ID=".$arIBlock["ID"]."&find_section_section=0", "more_url" => array( "cat_section_admin.php?IBLOCK_ID=".$arIBlock["ID"]."&find_section_section=0", "cat_section_edit.php?IBLOCK_ID=".$arIBlock["ID"]."&find_section_section=0", ), "title" => "", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_category_".$arIBlock["ID"], "module_id" => "catalog", "items" => CCatalogAdmin::get_sections_menu($arIBlock["IBLOCK_TYPE_ID"], $arIBlock["ID"], 1, 0), ), ); if(CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) { $arItems[] = array( "text" => Loc::getMessage("CAT_MENU_PRODUCT_PROPERTIES"), "url" => "iblock_property_admin.php?lang=".LANGUAGE_ID."&IBLOCK_ID=".$arIBlock["ID"]."&admin=N", "more_url" => array( "iblock_property_admin.php?IBLOCK_ID=".$arIBlock["ID"]."&admin=N", "iblock_edit_property.php?IBLOCK_ID=".$arIBlock["ID"]."&admin=N", ), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_attributes_".$arIBlock["ID"], "module_id" => "catalog", ); } if (isset($arCatalogSku[$arIBlock["ID"]])) { $intOffersIBlockID = $arCatalogSku[$arIBlock["ID"]]; if (CIBlockRights::UserHasRightTo($intOffersIBlockID, $intOffersIBlockID, "iblock_edit")) { $arItems[] = array( "text" => Loc::getMessage("CAT_MENU_SKU_PROPERTIES"), "url" => "iblock_property_admin.php?lang=".LANGUAGE_ID."&IBLOCK_ID=".$intOffersIBlockID."&admin=N", "more_url" => array( "iblock_property_admin.php?IBLOCK_ID=".$intOffersIBlockID."&admin=N", "iblock_edit_property.php?IBLOCK_ID=".$intOffersIBlockID."&admin=N", ), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_attributes_".$intOffersIBlockID, "module_id" => "catalog", ); } } if(CIBlockRights::UserHasRightTo($arIBlock["ID"], $arIBlock["ID"], "iblock_edit")) { $arItems[] = array( "text" => Loc::getMessage("CAT_MENU_CATALOG_SETTINGS"), "url" => "cat_catalog_edit.php?lang=".LANGUAGE_ID."&IBLOCK_ID=".$arIBlock["ID"], "more_url" => array( "cat_catalog_edit.php?IBLOCK_ID=".$arIBlock["ID"], ), "title" => "", "page_icon" => "iblock_page_icon_settings", "items_id" => "menu_catalog_edit_".$arIBlock["ID"], "module_id" => "catalog", ); } $aMenu["items"][] = array( "text" => htmlspecialcharsEx($arIBlock["NAME"]), "title" => "", "page_icon" => "iblock_page_icon_sections", "items_id" => "menu_catalog_".$arIBlock["ID"], "module_id" => "catalog", "items" => $arItems, ); } if (!empty($aMenu["items"])) { if (count($aMenu["items"]) == 1) $aMenu = $aMenu["items"][0]; $aMenu["parent_menu"] = "global_menu_store"; $aMenu["section"] = "catalog_list"; $aMenu["sort"] = 200; $aMenu["icon"] = "iblock_menu_icon_sections"; $aMenu["page_icon"] = "iblock_page_icon_types"; $aModuleMenu[] = $aMenu; } }