<?php

include ("config.php");

$highlight_menu = 2;

include ("header.php");

if (!empty($error))
{
	if (is_int($error))
		echo "<p class=\"center error\">" . $error_list[$error] . "</p>\n";
	else
		echo "<p class=\"center error\">" . $error . "</p>\n";
}

echo "<div id=\"list-utilisateur\">\n";
echo "<table>\n";

echo "<tr>\n";
echo "<th class=\"center\" colspan=\"4\">Liste des utilisateurs</th>\n";
echo "</tr>\n";

$list_util = $util->list_utilisateur();

if ($c = count($list_util))
{
	echo "<tr class=\"titre\">\n";
	echo "<td>Nom</td>\n";
	echo "<td>Pr&eacute;nom</td>\n";
	echo "<td>Action</td>\n";
	echo "</tr>\n";

	for ($i = 0; $i < $c; $i++)
	{
	   echo "<tr" . ($i % 2 == 0 ? "" : " class=\"inter\"") . ">\n";
		echo "<td>" . $list_util[$i]["user_nom"] . "</td>\n";
		echo "<td>" . $list_util[$i]["user_prenom"] . "</td>\n";
		echo "<td class=\"action\">";
		if ($list_util[$i]["id_user"] != ADMIN_USER)
			echo "<a class=\"slink\" href=\"utilisateur_switch.php?id_user=" . $list_util[$i]["id_user"] . "\">Se connecter</a> ";
		echo "<a class=\"slink\" href=\"utilisateur_suivi.php?id_user=" . $list_util[$i]["id_user"] . "\">Patient</a> <a class=\"slink\" href=\"utilisateur_edition.php?id_user=" . $list_util[$i]["id_user"] . "\">Modifier</a> ";
		if ($list_util[$i]["id_user"] != ADMIN_USER)
			echo "<a class=\"sdel\" href=\"utilisateur_suppression.php?id_user=" . $list_util[$i]["id_user"] . "\">Supprimer</a></td>\n";
		echo "</tr>\n";
	}
}
else
{
	echo "<tr>\n";
	echo "<td class=\"center error\" colspan=\"4\">Aucun utilisateur enregistr&eacute;</td>\n";
	echo "</tr>\n";
}

echo "</table>\n";
echo "</div>\n";

echo "<p><a class=\"slink\" href=\"utilisateur_edition.php\">Ajouter un utilisateur</a></p>\n";

include ("footer.php");

?>