<?if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED!==true)die();?>
<script>
$(document).ready(function(){
$("#vertical-multilevel-menu li div").click(function () {
var e = $(this).attr('class'); t = document.getElementById(e);
$(t).toggle();
if (($(this).find('span').attr('class')== 'root-item') || ($(this).find('span').attr('class')== 'parent')) {
$(this).find('span').removeClass('root-item').addClass('open-root');
$(this).find('span').removeClass('parent');
}
else {
$(this).find('span').removeClass('open-root').addClass('root-item');
}
});
var elem = document.getElementById('item-selected'); r = elem.className;
document.getElementById(r).style.display='block';
});
</script>
<?if (!empty($arResult)):?>
<ul id="vertical-multilevel-menu">
<?
$previousLevel = 0;
$i=0;
foreach($arResult as $arItem):;?>
<?if ($previousLevel && $arItem["DEPTH_LEVEL"] < $previousLevel):?>
<?=str_repeat("</ul></li>", ($previousLevel - $arItem["DEPTH_LEVEL"]));?>
<?endif?>
<?if ($arItem["IS_PARENT"]):?>
<?if ($arItem["DEPTH_LEVEL"] == 1):$i=$i+1?>
<li><div class="li-<?=$i;?>"><span class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>"><?=$arItem["TEXT"]?></span></div>
<ul class="root-item" id="li-<?=$i;?>" <?if ($arItem["SELECTED"]){?> style="display:block;"<?}?>>
<?else:$i=$i+1?>
<li><div class="li-in-<?=$i;?>"><span class="parent<?if ($arItem["SELECTED"]):?> item-selected<?endif?>"><?=$arItem["TEXT"]?></span></div>
<ul id="li-in-<?=$i;?>">
<?endif?>
<?else:?>
<?if ($arItem["PERMISSION"] > "D"):?>
<?if ($arItem["DEPTH_LEVEL"] == 1):?>
<li><a href="<?=$arItem["LINK"]?>" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>"><?=$arItem["TEXT"]?></a></li>
<?else:?>
<li><a class="li-<?=$i;?>" href="<?=$arItem["LINK"]?>" <?if ($arItem["SELECTED"]):
?> id="item-selected"<?endif?>><span class="last"><?=$arItem["TEXT"]?></span></a></li>
<?endif?>
<?else:?>
<?if ($arItem["DEPTH_LEVEL"] == 1):?>
<li><a href="" class="<?if ($arItem["SELECTED"]):?>root-item-selected<?else:?>root-item<?endif?>" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li>
<?else:?>
<li><a href="" class="denied" title="<?=GetMessage("MENU_ITEM_ACCESS_DENIED")?>"><?=$arItem["TEXT"]?></a></li>
<?endif?>
<?endif?>
<?endif?>
<?$previousLevel = $arItem["DEPTH_LEVEL"];?>
<?endforeach?>
<?if ($previousLevel > 1)://close last item tags?>
<?=str_repeat("</ul></li>", ($previousLevel-1) );?>
<?endif?>
</ul>
<?endif?> |