<?php
/**
 * Generate Menu By Using $menu Array From labels files
 *
 * PHP version 7.3
 *
 * @package        SMS
 * @version        Release 1.0.0
 * @create_by      Mohammad aljaouni
 * @create_date    10-08-2020
 * @edited_by      Mohammad aljaouni
 * @last_edit_date 10-08-2020
 * @todo           Nothing
 */
ob_start();
if(empty($chain) || $chain != "AWdrh78y892Djk*^523*%$#ghgHGHia&%$*)AsfdsLJnLaad") {
    header("location: index.php");
    exit;
}
if(!empty($menuList) && (!isset($menu) || $menu==true)){
?>
<!-- start vertical-menu -->
<div class="vertical-menu">
    <div data-simplebar class="h-100">
        <div id="sidebar-menu">
            <ul class="metismenu list-unstyled" id="side-menu">
                <?php
                    foreach ($menuList as $menu){
                        ?>
                        <li>
                            <a href="<?php echo !empty($menu["link"])?$menu["link"]:"javascript: void(0);"?>" class="<?php echo !empty($menu["multi"])?"has-arrow":""?> waves-effect">
                                <?php if(!empty($menu["icon"])){?><div class="d-inline-block icons-sm mr-1"><i class="<?php echo $menu["icon"];?>"></i></div><?php }?>
                                <?php if(!empty($menu["counter"])){ ?><span class="badge badge-pill badge-success float-right"><?php echo $menu["counter"]?></span> <?php } ?>
                                <?php echo !empty($menu["title"])?"<span>".$menu["title"]."</span>":""?>
                            </a>
                            <?php
                            if(!empty($menu["multi"]) && is_array($menu["multi"])) {
                                ?>
                                <ul class="sub-menu" aria-expanded="true">
                                    <?php
                                    foreach ($menu["multi"] as $menu2){
                                        ?>
                                        <li>
                                            <a href="<?php echo !empty($menu2["link"])?$menu2["link"]:"javascript: void(0);"?>" class="<?php echo !empty($menu2["multi"])?"has-arrow":""?> waves-effect">
                                                <?php echo !empty($menu2["icon"])?'<div class="d-inline-block icons-sm mr-1"><i class="'.$menu2["icon"].'"></i></div>':'' ?>
                                                <?php
                                                if(!empty($menu2["counter"])){
                                                    ?>
                                                    <span class="badge badge-pill badge-success float-right"><?php echo $menu2["counter"]?></span>
                                                <?php } ?>
                                                <span><?php echo !empty($menu2["title"])?$menu2["title"]:""?></span>
                                            </a>
                                            <?php
                                            if(!empty($menu2["multi"]) && is_array($menu2["multi"])) {
                                                ?>
                                                <ul class="sub-menu" aria-expanded="true">
                                                    <?php
                                                    foreach ($menu2["multi"] as $menu3){
                                                        ?>
                                                        <li>
                                                            <a href="<?php echo !empty($menu3["link"])?$menu3["link"]:"javascript: void(0);"?>" class="<?php echo !empty($menu3["multi"])?"has-arrow":""?> waves-effect">
                                                                <?php echo !empty($menu3["icon"])?'<div class="d-inline-block icons-sm mr-1"><i class="'.$menu3["icon"].'"></i></div>':'' ?>
                                                                <?php
                                                                if(!empty($menu3["counter"])){
                                                                    ?>
                                                                    <span class="badge badge-pill badge-success float-right"><?php echo $menu3["counter"]?></span>
                                                                <?php } ?>
                                                                <span><?php echo !empty($menu3["title"])?$menu3["title"]:""?></span>
                                                            </a>
                                                        </li>
                                                        <?php
                                                    }
                                                    ?>
                                                </ul>
                                            <?php } ?>
                                        </li>
                                        <?php
                                    }
                                    ?>
                                </ul>
                                <?php
                            }
                            ?>
                        </li>
                        <?php
                    }
                ?>
            </ul>
        </div>
    </div>
</div>
<!-- end vertical-menu -->
<?php
}
ob_end_flush();
