'."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo 'ADMINISTRATEUR de la base '.NOMAPPLICATION.''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; //Affichage des bandeaux et début du formulaire framanav(); logo(); bandeau_tete(); bandeau_titre(_("Polls administrator")); sous_bandeau_admin(); //print_r($_SESSION); $sondage=$connect->Execute("select * from sondage"); echo'
'."\n"; echo '
'."\n"; // Test et affichage du bouton de confirmation en cas de suppression de sondage $i=0; while($dsondage = $sondage->FetchNextObject(false)) { if (issetAndNoEmpty('supprimersondage'.$i) === true) { echo ''."\n"; echo ''."\n"; echo '
'. _("Confirm removal of the poll ") .'"'.$dsondage->id_sondage.'" : '."\n"; echo '
'."\n"; echo '
'."\n"; } // Traitement de la confirmation de suppression if (issetAndNoEmpty('confirmesuppression'.$i) === true) { // On inclut la routine de suppression $date=date('H:i:s d/m/Y'); $req = 'DELETE FROM sujet_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' . 'DELETE FROM user_studs WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' . 'DELETE FROM comments WHERE id_sondage = ' . $connect->Param('id_sondage') . '; ' . 'DELETE FROM sondage WHERE id_sondage = ' . $connect->Param('id_sondage') ; $sql = $connect->Prepare($req); $connect->Execute($sql, array($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'); } $i++; } $sondage=$connect->Execute("select * from sondage ORDER BY date_fin ASC"); $nbsondages=$sondage->RecordCount(); echo $nbsondages.' '. _("polls in the database at this time") .'

'."\n"; // tableau qui affiche tous les sondages de la base echo ''."\n"; echo ''."\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'"); $dsujets=$sujets->FetchObject(false); $user_studs=$connect->Execute( "select * from user_studs where id_sondage='$dsondage->id_sondage'"); $nbuser=$user_studs->RecordCount(); echo ''; if (strtotime($dsondage->date_fin) > time()) { echo ''; } else { echo ''; } echo''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; echo ''."\n"; $i++; } echo '
'. _("Poll ID") .''. _("Format") .''. _("Title") .''. _("Author") .''. _("Expiration's date") .''. _("Users") .''. _("Actions") .'
'.$dsondage->id_sondage.''.$dsondage->format.''. stripslashes($dsondage->titre).''.stripslashes($dsondage->nom_admin).''.date("d/m/y",strtotime($dsondage->date_fin)).''.date("d/m/y",strtotime($dsondage->date_fin)).''.$nbuser.''. _("See the poll") .''. _("Change the poll") .'
'."\n"; echo'
'."\n"; // fin du formulaire et de la page web echo ''."\n"; echo '
 
'; echo ''."\n"; echo ''."\n"; // si on annule la suppression, rafraichissement de la page if (issetAndNoEmpty('annulesuppression') === true) { }