<nav class="sidebar-nav sidebar-nav-fixed scroll">
  <div class="navbar brb " role="navigation">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".sidebar-navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="fa fa-reorder"></span>
      </button>
    </div>
    <div class="navbar-collapse collapse sidebar-navbar-collapse">
      <div class="navbar-header">
        <a class="hidden-xs navbar-brand" href="#">
          <img alt="Brand" src="img/example/user/dmitry_b.jpg" class='img-responsive img-circle center-block'>
        </a>
      </div>
      <ul class="nav nav-pills nav-stacked">
        <?php
        $menu = array();
        $menu[] = array('index.php?modulo=estoque', 'Estoque');
        $dirLists = array_filter(scandir('.'), function ($v) {
          return sgcws_endsWith($v, 'list.php');
        });
        foreach($dirLists as $item) {
          $menu[] = array($item, $item);
        }
        
        foreach($menu as $item) {
          $link = $item[0];
          $label = arquivoParaLabel($item[1]);
          ?>
          <li><a href="<?= $link; ?>"><?= $label; ?></a></li>
          <?php
        }
        
        function arquivoParaLabel($arquivo) {
          $label = str_replace('erpc_', '', $arquivo);
          $label = str_replace('_list.php', '', $label);
          $label = str_replace('_', ' ', $label);
          return $label;
        }
        ?>
        
        <!--
        <li class="active"><a href="index.php?modulo=estoque">Estoque</a></li>
        <li class="dropdown">
          <a class="dropdown-toggle" data-toggle="dropdown" href="#"><span class="fa fa-envelope"></span>Menu 1
          <i class="caret"></i></a>
          <ul class="dropdown-menu">
            <li><a href="#">Submenu 1-1</a></li>
            <li><a href="#">Submenu 1-2</a></li>
            <li><a href="#">Submenu 1-3</a></li>
          </ul>
        </li>
        <li><a href="#">Menu 2</a></li>
        <li><a href="#">Menu 3</a></li>
        -->
      </ul>
    </div><!--/.nav-collapse -->
  </div>
</nav>
