
<nav id="navbar">
  <ul class="navbar-items flexbox-col">
  <?php
  $admin=false;
  if ($_SESSION['id_utilisateur']==1){
      $admin = true;
  }
    if(isset($_SESSION['id_utilisateur'])){
        echo '<li class="navbar-item-inner-bonjour flexbox-left">';
        if (file_exists('img/img'.$_SESSION['id_utilisateur'].'.png')){
          echo '<img class="pp-nav" src="img/img'.$_SESSION['id_utilisateur'].'.png" alt="">';
      } 
      elseif( file_exists('img/img'.$_SESSION['id_utilisateur'].'.jpg')){
          echo '<img class="pp-nav" src="img/img'.$_SESSION['id_utilisateur'].'.jpg" alt="">';
      }
      else{
        echo '<img class="pp-nav" src="img/img0.png" alt="">';
      }
        echo '<span class="link-text-bonjour"> Bonjour '.$_SESSION['prenom'].'</span>
      </li>';
    }
    ?>
    <li class="navbar-item flexbox-left">
      <a class="navbar-item-inner flexbox-left" href="index.php">
        <div class="navbar-item-inner-icon-wrapper flexbox">
          <ion-icon name="home-outline"></ion-icon>
        </div>
        <span class="link-text">Accueil</span>
      </a>
    </li>
    <li class="navbar-item flexbox-left">
      <a class="navbar-item-inner flexbox-left" href="index.php?action=archives">
        <div class="navbar-item-inner-icon-wrapper flexbox">
          <ion-icon name="folder-open-outline"></ion-icon>
        </div>
        <span class="link-text">Archives</span>
      </a>
    </li>
    <?php
    if ($admin==true){
      echo '<li class="navbar-item flexbox-left">
        <a class="navbar-item-inner flexbox-left" href="index.php?action=add-billet">
          <div class="navbar-item-inner-icon-wrapper flexbox">
          <ion-icon name="add-circle-outline"></ion-icon>
          </div>
          <span class="link-text">Nouveau Billet</span>
        </a>
      </li>';
      echo '<li class="navbar-item flexbox-left">
        <a class="navbar-item-inner flexbox-left" href="index.php?action=utilisateurs">
          <div class="navbar-item-inner-icon-wrapper flexbox">
          <ion-icon name="people-outline"></ion-icon>
          </div>
          <span class="link-text">Utilisateurs</span>
        </a>
        </li>';
    }
    if (!isset($_SESSION['id_utilisateur'])){
    echo '<li class="navbar-item flexbox-left">
      <a class="navbar-item-inner flexbox-left" href="index.php?action=connexion">
        <div class="navbar-item-inner-icon-wrapper flexbox">
        <ion-icon name="enter-outline"></ion-icon>
        </div>
        <span class="link-text">Connexion</span>
      </a>
    </li>';
        echo '<li class="navbar-item flexbox-left">
          <a class="navbar-item-inner flexbox-left" href="index.php?action=inscription">
            <div class="navbar-item-inner-icon-wrapper flexbox">
            <ion-icon name="person-add-outline"></ion-icon>
            </div>
            <span class="link-text">Inscription</span>
          </a>
        </li>';
    }
        if(isset($_SESSION['id_utilisateur'])){
      echo '<li class="navbar-item flexbox-left">
        <a class="navbar-item-inner flexbox-left" href="index.php?action=affiche-profil&id='. $_SESSION['id_utilisateur'].'">';
        
      echo '<div class="navbar-item-inner-icon-wrapper flexbox">
          <ion-icon name="person-circle-outline"></ion-icon>
          </div>
          <span class="link-text">Profil</span>
        </a>
      </li>';
      echo '<li class="navbar-item flexbox-left">
        <a class="navbar-item-inner flexbox-left" href="index.php?action=deconnexion">
          <div class="navbar-item-inner-icon-wrapper flexbox">
          <ion-icon name="exit-outline"></ion-icon>
          </div>
          <span class="link-text">Deconnexion</span>
        </a>
      </li>';
    }
    ?>
  </ul>
</nav>