<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">            
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        <a class="navbar-brand" href="../">Panneau d'administration</a>
    </div>
    <div class="collapse navbar-collapse navbar-ex1-collapse">
        <ul class="nav navbar-nav side-nav">
            <li <?php if($active=='administration'){ ?> class="active"<?php } ?>>
                <a href="administration.php"><i class="fa fa-home"></i> Accueil</a>
            </li>
            <?php
			$sql11='SELECT * FROM user_privilege, privilege WHERE privilege.id_privilege=user_privilege.id_privilege AND id_user="'.$_SESSION['celest'].'" AND position_privilege="droite" ORDER BY afficher_privilege ASC';
			$reponse11=$bdd-> query($sql11) or die('Erreur SQL !<br />'.$sql11.'<br />'.mysql_error());
			while($data11=$reponse11->fetch())
			{
				?>
				<li <?php if($active==$data11['lib_privilege']){ ?> class="active"<?php } ?>>
					<a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $data11['lib_privilege'] ?>">
						<table width="100%">
							<tr>
								<td id="mtd-1"><i class="fa <?php if(empty($data11['fa_privilege'])){ echo"fa fa-tasks";}else{ echo $data11['fa_privilege'];} ?>"></i></td>
								<td id="mtd-2"><?php echo $data11['afficher_privilege']; ?></td>
		                        <td id="mtd-3">
			                        <?php
									if($data11['lib_privilege']=='commande')
									{
										$sql12 = 'SELECT COUNT(*) FROM commande WHERE etat_commande="attente"';
										$reponse12=$bdd-> query($sql12) or die('Erreur SQL !<br />'.$sql12.'<br />'.mysql_error());
										$data12=$reponse12->fetch();
										echo '<span class="badge">'.$data12[0].' en attente</span>';
									}
									else
									{
										$sql12 = 'SELECT COUNT(*) FROM '.$data11['lib_privilege'].'';
										$reponse12=$bdd-> query($sql12) or die('Erreur SQL !<br />'.$sql12.'<br />'.mysql_error());
										$data12=$reponse12->fetch();
										echo '<span class="badge">'.$data12[0].'</span>';
									}
									?>
								</td>
							</tr>
						</table>
					</a>
				</li>
				<?php
			}
			
            $sql9='SELECT * FROM type, user_type WHERE type.id_type=user_type.id_type AND id_user="'.$_SESSION['celest'].'" ORDER BY lib_type ASC';
			$reponse9=$bdd-> query($sql9) or die('Erreur SQL !<br />'.$sql9.'<br />'.mysql_error());
			while($data9=$reponse9->fetch())
			{
				?>
				<li <?php if($active==$data9['lib_type']){ ?> class="active"<?php } ?>>
					<a href="gestionnaire-table.php?W9mvyDvFWE5=<?php echo stripslashes($data9['lib_type']) ?>">
                    	<table width="100%">
							<tr>
								<td id="mtd-1"><i class="fa <?php if(empty($data9['fa_type'])){ echo"fa fa-tasks";}else{ echo $data9['fa_type'];} ?>"></i></td>
								<td id="mtd-2"><?php echo $data9['lib_type']; ?></td>
		                        <td id="mtd-3">
			                        <?php
			                        if($developpeur==3)
									{
										$sql12='SELECT COUNT(*) FROM information WHERE id_type='.$data9[0].' AND id_user='.$_SESSION['celest'];
									}
									else
									{
										$sql12='SELECT COUNT(*) FROM information WHERE id_type='.$data9[0].'';
									}
									$reponse12=$bdd-> query($sql12) or die('Erreur SQL !<br />'.$sql12.'<br />'.mysql_error());
									$data12=$reponse12->fetch();
									echo ' <span class="badge">'.$data12[0].'</span>';
									?>
								</td>
							</tr>
						</table>
                    </a>
				</li>
				<?php
			}
			?>
        </ul>
        
        <ul class="nav navbar-nav navbar-right navbar-user">
        	<?php
			if($developpeur==3)
			{
				$sql9='SELECT * FROM categorie, user WHERE user.id_user=categorie.id_user AND user.id_user="'.$_SESSION['celest'].'" ORDER BY lib_categorie ASC';
				$reponse9=$bdd-> query($sql9) or die('Erreur SQL !<br />'.$sql9.'<br />'.mysql_error());
				while($data9=$reponse9->fetch())
				{
					$categorie=$data9[0];
					$lib_categorie=$data9['lib_categorie'];
					?>
                    <li class="dropdown user-dropdown <?php if($active=='user'){ ?> active<?php } ?>">
                       <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                       	<i class="fa fa-user"></i> <?php echo stripslashes($data9['lib_categorie']); ?><b class="caret"></b>
                       </a>
                       <ul class="dropdown-menu">
                           <li><a href="afficher-info.php?W9mvyDvFWE5=categorie&QYtgoGbhhd=<?php echo $data9[0]; ?>"><i class="fa fa-eye"></i> Afficher</a></li>
                           <li class="divider"></li>
                           <li><a href="modifier-info.php?W9mvyDvFWE5=categorie&QYtgoGbhhd=<?php echo $data9[0]; ?>"><i class="fa fa-edit"></i> Modifier</a></li>
                       </ul>
                    </li>
			<?php
				}
			}
			else
			{
				$categorie='NULL';
			}
            if(isset($_SESSION['langue']))
			{
				$sql11='SELECT * FROM langue WHERE id_langue="'.$_SESSION['langue'].'"';
				$reponse11=$bdd-> query($sql11) or die('Erreur SQL !<br />'.$sql11.'<br />'.mysql_error());
				$data11=$reponse11->fetch();
				?>
				<li class="dropdown user-dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown">
                    	<img src="../upload/<?php echo $data11['img_langue'] ?>" width="20"> <?php echo $data11['lib_langue'] ?>
                    	<b class="caret"></b>
                    </a>
					<ul class="dropdown-menu">
						<?php
						$sql11='SELECT * FROM langue WHERE id_langue<>"'.$_SESSION['langue'].'"';
						$reponse11=$bdd-> query($sql11) or die('Erreur SQL !<br />'.$sql11.'<br />'.mysql_error());
						while($data11=$reponse11->fetch())
						{
							?>
							<li><a href="administration.php?Cd5RED9hT8Hg=<?php echo $data11[0] ?>"><img src="../upload/<?php echo $data11['img_langue'] ?>" width="20"> <?php echo $data11['lib_langue'] ?></a></li>
							<?php
						}
						?>
					</ul>
				</li>
				<?php
			}
			if($developpeur!=3)
			{
				?>
				<li class="dropdown messages-dropdown<?php if($active=='visiteur'){ ?> active<?php } ?>">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-eye"></i> Visiteurs <!--<span class="badge">2</span>--> <b class="caret"></b></a>
					<ul class="dropdown-menu">
						<?php
						$sql11='SELECT * FROM user_privilege, privilege WHERE privilege.id_privilege=user_privilege.id_privilege AND id_user="'.$_SESSION['celest'].'" AND position_privilege="visiteur" ORDER BY privilege.id_privilege DESC';
						$reponse11=$bdd-> query($sql11) or die('Erreur SQL !<br />'.$sql11.'<br />'.mysql_error());
						while($data11=$reponse11->fetch())
						{
							?>
							<li class="message-preview">
								<a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $data11['lib_privilege'] ?>">
									<span class="avatar"><i class="fa fa-tasks"></i></span>
									<?php echo $data11['afficher_privilege']; ?></span>
                                    <?php
                                    if($data11['lib_privilege']=='visiteur')
									{
										echo ' <span class="badge">'.$visiteur.'</span>';
									}
									?>
								</a>
							</li>
							<?php
						}
						?>
					</ul>
				</li>
                <li class="dropdown user-dropdown<?php if($active=='parametre'){ ?> active<?php } ?>">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-cogs"></i> Parametres<b class="caret"></b></a>
                    <ul class="dropdown-menu">
                        <?php
                        $sql11='SELECT * FROM user_privilege, privilege WHERE privilege.id_privilege=user_privilege.id_privilege AND id_user="'.$_SESSION['celest'].'" AND position_privilege="parametre" ORDER BY afficher_privilege ASC';
                        $reponse11=$bdd-> query($sql11) or die('Erreur SQL !<br />'.$sql11.'<br />'.mysql_error());
                        while($data11=$reponse11->fetch())
                        {
                            ?>
                            <li>
                                <a href="gestionnaire-info.php?W9mvyDvFWE5=<?php echo $data11['lib_privilege'] ?>">
									<?php
                                    echo $data11['afficher_privilege'];
									$sql12 = 'SELECT COUNT(*) FROM '.$data11['lib_privilege'].'';
									$reponse12=$bdd-> query($sql12) or die('Erreur SQL !<br />'.$sql12.'<br />'.mysql_error());
									$data12=$reponse12->fetch();
									echo ' <span class="badge">'.$data12[0].'</span>';
									?>
                                </a>
                            </li>
                            <?php
                        }
                        ?>
                   </ul>
                </li>
            	<?php
			}
			?>
            <li class="dropdown user-dropdown <?php if($active=='user'){ ?> active<?php } ?>">
               <a href="#" class="dropdown-toggle" data-toggle="dropdown">
               	<i class="fa fa-user"></i> <?php echo $data10['lib_user'] ?><b class="caret"></b>
               </a>
               <ul class="dropdown-menu">
                   <li><a href="mon-profil.php"><i class="fa fa-user"></i> Mon profil</a></li>
                   <?php
				   $sql11='SELECT * FROM user_privilege, privilege WHERE privilege.id_privilege=user_privilege.id_privilege AND id_user="'.$_SESSION['celest'].'" ORDER BY privilege.id_privilege DESC';
					$reponse11=$bdd-> query($sql11) or die('Erreur SQL !<br />'.$sql11.'<br />'.mysql_error());
					while($data11=$reponse11->fetch())
					{
						if($data11['lib_privilege']=='user')
						{
							?>
                           <li><a href="gestionnaire-info.php?W9mvyDvFWE5=user"><i class="fa fa-users"></i> Utilisateurs</a></li>
                           <?php
						}
					}
				   ?>
                   <li class="divider"></li>
                   <li><a href="deconnexion.php"><i class="fa fa-power-off"></i> Déconnexion</a></li>
               </ul>
            </li>
        </ul>
    </div>
</nav>