/** * Fonction permettant d'afficher les demandes de groupe que j'ai reçue de la part d'autres membres. * * * */ function afficherInvitation() { $gim = new Groupe_InvitationManager(connexionDb()); $invit = $gim->getInvitationByDemande($_SESSION['User']); $um = new UserManager(connexionDb()); $gm = new GroupeManager(connexionDb()); $existe = true; ?> <div class="table-responsive"> <table class="table table-striped"> <caption> <h2> Invitations de groupe </h2></caption> <tr> <th> Utilisateur envoyant l'invitation</th> <th> Description du groupe </th> <th> Validation </th> </tr> <?php foreach ($invit as $elem) { $user = $um->getUserById($elem['id_user_envoi']); $groupe = $gm->getGroupeByIdGroupe($elem['id_groupe']); $id = $groupe->getIdGroupe(); echo "<tr> <td>" . $user->getUserName() . " </td><td>" . substr($groupe->getDescription(), 0, 80) . "..." . " </td><td>"; echo "<form class='form-horizontal col-sm-12' name='accepter{$id}' action='groupe.page.php?to=invitation&action=gerer' method='post'>"; echo "<button class='btn btn-success col-sm-6' type='submit' id='formulaire' name='AccepterGroupe{$id}'>Accepter</button>"; echo "<button class='btn btn-warning col-sm-6' type='submit' id='formulaire' name='RefuserGroupe{$id}'>Refuser</button>"; echo "<input type='hidden' name='groupe{$id}' value='" . $id . "''>"; echo "</form>"; echo "</td></tr>"; $existe = false; } if ($invit == NULL || $existe) { echo "<tr> <td> Aucune invitation reçue !</td></tr>"; } ?> </table> </div> <?php }