<?php
/**
 * Vue Accueil
 *
 * PHP Version 7
 *
 * @category  PPE
 * @package   GSB
 * @author    Réseau CERTA <contact@reseaucerta.org>
 * @author    José GIL <jgil@ac-nice.fr>
 * @copyright 2017 Réseau CERTA
 * @license   Réseau CERTA
 * @version   GIT: <0>
 * @link      http://www.reseaucerta.org Contexte « Laboratoire GSB »
 */

?>
<body style="background-image: /*url(images/fond.jpg)*/;
  background-repeat: no-repeat;
  width: 40px%;
  height: 100%;
  ">
<div id="accueil">
    <h2>
        Gestion des utilisateurs<small> - Admin :
            <?php
            echo $_SESSION['prenom'] . ' ' . $_SESSION['nom'];
            ?></small>
    </h2>
</div>
<table>

    <tr>
        <td>Nom</td>
        <td>Prenom</td>
        <td>login</td>
        <td>mdp</td>
        <td>Type</td>


    </tr>
    <?php
    $users = $pdo->getAllUsers();


    foreach ($users as $value) {

        ?>


        <tr>

            <td style=" border: 1px solid black;"><?php echo $value['nom'] ?></td>
            <td style=" border: 1px solid black;"><?php echo $value['prenom'] ?></td>
            <td style=" border: 1px solid black;"><?php echo $value['login'] ?></td>
            <td style=" border: 1px solid black;"><?php echo $value['mdp'] ?></td>
            <td style=" border: 1px solid black;"><?php echo $value['type'] ?></td>

            <?php
            $id = $value['id'];

             $nom = $value['nom'];
             $prenom = $value['prenom'];
             $login = $value['login'];
             $mdp = $value['mdp'];
             $type = $value['type'];


        ?>
            <td style=" border: 1px solid black;">
                <form method="post" action="index.php?uc=gestionusers&action=Supprimer&id=<?php echo $id?>">
                    <input type='hidden' name='id' value='<?php $id ?>'>
                    <button class="btn btn-danger" type="submit">Supprimer</button>


                </form>
            </td>
            <td style=" border: 1px solid black;">
                <form  action="vuesa/va_formulaire_modifier.php?uc=gestionusers&action=modifier&id=<?php echo $id?>" method="POST">

                    <input type='hidden' name='nom' value='<?php echo $nom ?>' >
                    <input type='hidden' name='prenom' value='<?php echo $prenom ?>' >
                    <input type='hidden' name='login' value='<?php echo $login ?>' >
                    <input type='hidden' name='mdp' value='<?php echo $mdp ?>' >
                    <input type='hidden' name='type' value='<?php echo $type ?>' >
                    <button class="btn btn-primary" type="submit">Modifier</button>
                </form>
            </td>
        </tr>

    <?php } ?>

</table>


<body>