<? $APPLICATION->IncludeComponent("bitrix:menu", "lmenu_prod", Array( "ROOT_MENU_TYPE" => "mleft", "MAX_LEVEL" => "1", "CHILD_MENU_TYPE" => "msleft", "USE_EXT" => "Y" ) );?>
<? if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?> <? if (!empty($arResult)):?> <? $parentsMap = array(); ?> <div class="leftmenu"> <? $previousLevel = 0; foreach($arResult as $arItem): $tmp = split('SECTION_ID=',$arItem["LINK"]); $thisID = $tmp[1]; if ($previousLevel < $arItem["DEPTH_LEVEL"]) {$parentsMap[$thisID]=$previousID;} elseif ($previousLevel == $arItem["DEPTH_LEVEL"]) { $parentsMap[$thisID]=$parentsMap[$previousID];} else { $diff = $previousLevel - $arItem["DEPTH_LEVEL"]; $i=0; $prevParent = $parentsMap[$previousID]; while ($i<$diff) { $prevParent = $parentsMap[$prevParent]; $i++;} $parentsMap[$thisID] = $prevParent; }?> <? if ($arItem["IS_PARENT"]) $parentID = $thisID;?> <? if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel):?> <?=str_repeat("<br>", ($previousLevel - $arItem["DEPTH_LEVEL"]));?> <? endif?> <? if ($arItem["IS_PARENT"]): if (!($arItem["SELECTED"])):?> <? else:?> <? endif?> <img src="/upload/0999.gif" width="10" height="9" border="0"> <a class="leftmenu" href="<?=$arItem["LINK"];?>"><?=$arItem["TEXT"]?></a> <? endif?> <? if ($GLOBALS["SECTION_ID"]==$thisID):?> <? $cPar = $thisID; $que = array();?> <? while ($parentsMap[$cPar]) { $cPar=$parentsMap[$cPar]; $que[]=$cPar; } $que = array_reverse($que); foreach ($que as $elm) {?> <script>OpenMenuNode(document.getElementById("FLD<?=$elm;?>"));</script> <?}?> <? endif?> <? $previousLevel = $arItem["DEPTH_LEVEL"];?> <? $previousID = $thisID;?> <? endforeach?> <? if ($previousLevel > 1):?> <?=str_repeat("</ul></li>", ($previousLevel-1) );?> </div> <span style="padding-left:10;"><? endif?> <? endif?></span>