<?php if ( count ( $menu_2nd ) > 0 ){ ?>
    <?php foreach ( $menu_2nd as $key => $value ){ ?>

        <?php if( !$value['MenuEstado'] ){ continue; } ?>

        <?php if( $value['Access'] ){ ?>
        <?php
        $s_IdElmLI = $value['TaskId'];
        $s_IdElmUL = "UL_".$key;
        ?>
        <li class="">
            <a href="#<?=$s_IdElmUL?>" data-toggle="collapse" aria-expanded="false" onclick="changeIcon( this, '<?=$s_IdElmUL?>' );"><!-- fa-angle-down / fa-angle-left -->
                <?php echo $value['ButtonText']?> <i class="fa fa-angle-right pull-right"></i>
            </a>
            <ul class="collapse list-unstyled treeview-menu" style="padding-left: 20px;" id="<?=$s_IdElmUL?>">
                <?php foreach ( $value['submenu'] as $key2 => $value2 ){ ?>
                    
                    <?php if( !$value2['MenuEstado'] ){ continue; } ?>

                    <?php if ($value2['Access'] && $value2['TaskType'] == 'proc'){ ?>
                <li>
                    <a href="javascript:void(0)" onclick="reqBody( '<?=$value2['tasks']['PathScriptId']?>','<?=$key?>'); $( '#dismiss' ).trigger( 'click' );">
                        <img src="<?php echo  $value2['tasks']['PathImageId']?>" width="22" height="22">
                        <!--<i class="fa fa-circle-o"></i>--> <?=$value2['ButtonText']?>
                    </a>
                </li>
                    <?php } ?>
                <?php } ?>
            </ul>
        </li>
        <?php } ?>
    <?php } ?>
<?php } ?>