<?php
function is_active($page) {
  $uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
  $current = trim(basename($uri), "/");
  return $current === $page ? 'active' : '';
}
?>

<ul class="nav nav-sidebar">
  <li class="<?php is_active('dasbor'); ?>">
    <a href="../dasbor"><i class="glyphicon glyphicon-home"></i> Dasboard</a>
  </li>
</ul>

<ul class="nav nav-sidebar">
  <li class="<?php is_active('warga'); ?>">
    <a href="../warga"><i class="glyphicon glyphicon-book"></i> Data Warga</a>
  </li>
</ul>

<ul class="nav nav-sidebar">
  <li class="<?php is_active('pelatih'); ?>">
    <a href="../pelatih"><i class="glyphicon glyphicon-book"></i> Data Pelatih</a>
  </li>
</ul>

<?php if ($_SESSION['user']['status_user'] != 'Petugas'): ?>
<ul class="nav nav-sidebar">
  <li class="<?php is_active('user'); ?>">
    <a href="../user"><i class="glyphicon glyphicon-user"></i> User </a>
  </li>
</ul>
<?php endif; ?>
