echo '<div class=corps>' . "\n"; echo '<form action="index.php" method="POST">' . "\n"; // Test et affichage du bouton de confirmation en cas de suppression de sondage while ($dsondage = $sondage->FetchNextObject(false)) { if (issetAndNoEmpty('supprimersondage' . $dsondage->id_sondage) === true) { echo '<table>' . "\n"; echo '<tr><td bgcolor="#EE0000" colspan="11">' . _("Confirm removal of the poll ") . '"' . $dsondage->id_sondage . '" : <input type="submit" name="confirmesuppression' . $dsondage->id_sondage . '" value="' . _("Remove this poll!") . '">' . "\n"; echo '<input type="submit" name="annullesuppression" value="' . _("Keep this poll!") . '"></td></tr>' . "\n"; echo '</table>' . "\n"; echo '<br>' . "\n"; } // Traitement de la confirmation de suppression if (issetAndNoEmpty('confirmesuppression' . $dsondage->id_sondage) === true) { // On inclut la routine de suppression $date = date('H:i:s d/m/Y'); if (remove_sondage($connect, $dsondage->id_sondage)) { // ecriture des traces dans le fichier de logs error_log($date . " SUPPRESSION: {$dsondage->id_sondage}\t{$dsondage->format}\t{$dsondage->nom_admin}\t{$dsondage->mail_admin}\n", 3, 'logs_studs.txt'); } } } $sondage = $connect->Execute("select * from sondage WHERE date_fin > DATE_SUB(now(), INTERVAL 3 MONTH) ORDER BY date_fin ASC"); $nbsondages = $sondage->RecordCount(); echo $nbsondages . ' ' . _("polls in the database at this time") . '<br><br>' . "\n"; // tableau qui affiche tous les sondages de la base echo '<table border=1>' . "\n"; echo '<tr align=center><td>' . _("Poll ID") . '</td><td>' . _("Format") . '</td><td>' . _("Title") . '</td><td>' . _("Author") . '</td><td>' . _("Expiration's date") . '</td><td>' . _("Users") . '</td><td colspan=3>' . _("Actions") . '</td>' . "\n"; $i = 0; while ($dsondage = $sondage->FetchNextObject(false)) { /* possible en 1 bonne requête dans $sondage */ $sujets = $connect->Execute("select * from sujet_studs where id_sondage='{$dsondage->id_sondage}'");
echo '<button type="submit" name="confirmesuppression" value="' . _("Remove this poll!") . '" class="button green poursuivre" alt="' . _("Remove this poll!") . '"><strong>' . _("Remove this poll!") . '</strong></button>' . "\n"; echo '</form>' . "\n"; echo '<br><br><br><br>' . "\n"; echo '</div>' . "\n"; echo '</div>' . "\n"; echo '<div class="separateur"> </div>'; bandeau_pied(); echo '</body>' . "\n"; echo '</html>' . "\n"; die; } //action si bouton confirmation de suppression est activé if (isset($_POST["confirmesuppression"]) || isset($_POST["confirmesuppression_x"])) { $nbuser = $user_studs->RecordCount(); $date = date('H:i:s d/m/Y:'); if (remove_sondage($connect, $numsondage)) { // on ecrit dans le fichier de logs la suppression du sondage error_log($date . " SUPPRESSION: {$dsondage->id_sondage}\t{$dsondage->format}\t{$dsondage->nom_admin}\t{$dsondage->mail_admin}\n", 3, 'admin/logs_studs.txt'); //envoi du mail a l'administrateur du sondage sendEmail($adresseadmin, _("[ADMINISTRATOR] Removing of your poll") . ' ' . NOMAPPLICATION, _("You have removed your poll. \nYou can make new polls with this link") . " :\n\n" . get_server_name() . "index.php \n\n" . _("Thanks for your confidence.") . "\n" . NOMAPPLICATION); //affichage de l'ecran de confirmation de suppression de sondage print_header(); echo '<body>' . "\n"; framanav(); logo(); bandeau_tete(); bandeau_titre(_("Make your polls")); echo '<div class="corps corpscentre">' . "\n"; print "<H2>" . _("Your poll has been removed!") . "</H2><br><br>"; print _("Back to the homepage of ") . ' <a href="/"> ' . NOMAPPLICATION . '</a>.' . "\n"; echo '<br><br><br>' . "\n";