Example #1
0
 function __construct()
 {
     $this->id = $_POST['id'];
     $this->cnx = parent::getCnx();
     $this->mesQuestions = Sondage::getQuestions($this->cnx, $this->id);
     $this->nomFichier = "statistiques_sondage_" . $this->id . ".csv";
 }
Example #2
0
 public function verificationInscription()
 {
     //NOUVEL UTILISATEUR AVEC IP
     $cnx = parent::getCnx();
     $user = new User($cnx, true, $_SERVER["REMOTE_ADDR"]);
     //INSCRIPTION DANS LA TABLE USER
     $user->ajouterUser();
     //INSCRIPTION DANS LA TABLE MEMBRE
     $mail = $_POST['mail'];
     $mdp = $_POST['mdp1'];
     $id = $user->getId();
     $ip = $user->getIp();
     $nom = $_POST['nom'];
     $prenom = $_POST['prenom'];
     $adresse = $_POST['adresse'];
     $cp = $_POST['cp'];
     $ville = $_POST['ville'];
     $qualite = "FO";
     //NOUVEAU MEMBRE
     $membre = new Membres($mail, $mdp, $id, $ip, $nom, $prenom, $adresse, $cp, $ville, $qualite);
     if ($membre->authentification($cnx) == FALSE) {
         if ($membre->ajouterMembre($cnx)) {
             return 1;
         } else {
             return -1;
         }
     } else {
         return 0;
     }
 }
Example #3
0
 function __construct()
 {
     $this->mesQuestions = Sondage::getQuestions(parent::getCnx(), $_SESSION['id']);
     if (isset($_REQUEST['action'])) {
         if ($_REQUEST['action'] == 'suppr') {
             $this->mesQuestions[$_REQUEST['id']]->supprimerQuestion(parent::getCnx());
         }
     }
 }
 public function verificationLogin()
 {
     $membres = new Membres($_POST['mail'], $_POST['mdp']);
     $resultat = $membres->authentification(parent::getCnx());
     if ($resultat != false) {
         //SI LE MEMBRE AUTHENTIFIE EST UN ADMIN
         if ($resultat['QUALITE'] == 'BO') {
             //INSTANCIATION D'UN ADMINN UNIQUE
             $object_membre = new Admin($resultat['MAIL_USER'], $resultat['MDP_USER'], $resultat['ID_USER'], $resultat['IP'], $resultat['NOM_USER'], $resultat['PRENOM_USER'], $resultat['ADRESSE_USER'], $resultat['CP_USER'], $resultat['VILLE_USER'], $resultat['QUALITE']);
         } else {
             //INSTANCIATION D'UN MEMBRE
             $object_membre = new Membres($resultat['MAIL_USER'], $resultat['MDP_USER'], $resultat['ID_USER'], $resultat['IP'], $resultat['NOM_USER'], $resultat['PRENOM_USER'], $resultat['ADRESSE_USER'], $resultat['CP_USER'], $resultat['VILLE_USER'], $resultat['QUALITE']);
         }
         //SERIALISATION DE L'ADMIN OU DU MEMBRE
         $obj_serialise = serialize($object_membre);
         //ON STOCKE L'OBJET SERIALISE EN SESSION
         $_SESSION['membre'] = $obj_serialise;
         $_SESSION['idMembre'] = $resultat['ID_USER'];
         //Redirection vers la page Index
         header('Location: index.php?page=Default');
     }
 }
Example #5
0
 public function getSujet()
 {
     $sujet = new Sujet();
     return $sujet->getSujet(parent::getCnx());
 }
Example #6
0
 public function getMesSondages()
 {
     $membre = unserialize($_SESSION['membre']);
     $tab = $membre->recupererMesSondages(parent::getCnx());
     $str = "";
     $str .= "<center>";
     $str .= "<table border = '1' id = 'hor-minimalist-b'><thead><tr><th scope='col'>Libelle</th><th scope='col' width ='150'>Type</th><th scope='col' width ='150'>Date cloture</th><th scope='col' width ='150'>Publication</th><th scope='col' width ='150'>URL</th><th scope='col' width ='150'>Etat</th><th scope='col' width ='150'>Actions</th></tr></thead>";
     for ($i = 0; $i < COUNT($tab); $i++) {
         $str .= "<tr>";
         $str .= "<td>" . $tab[$i]->getNom() . "</td>";
         if ($tab[$i]->getType() == 0) {
             $str .= "<td>PUBLIC</td>";
         } else {
             $str .= "<td>PRIVE</td>";
         }
         if ($tab[$i]->getDateCloture() != "") {
             $str .= "<td>" . $this->formaterDate($tab[$i]->getDateCloture()) . "</td>";
         } else {
             $str .= "<td></td>";
         }
         if ($tab[$i]->getEtat() == 0) {
             $str .= "<td>PAS PUBLIE</td>";
         } else {
             $str .= "<td>PUBLIE</td>";
         }
         $str .= "<td><a href = " . $tab[$i]->getUrl() . ">" . $tab[$i]->getUrl() . "</a></td>";
         switch ($tab[$i]->getStatut()) {
             case 0:
                 $disabled = "";
                 $str .= "<td></td>";
                 break;
             case 1:
                 $disabled = "disabled";
                 $str .= "<td>Demande de modification envoyee a l'administrateur</td>";
                 break;
             case 2:
                 $disabled = "";
                 $str .= "<td>Modification autorisee par l'administrateur</td>";
                 break;
             case 3:
                 $disabled = "disabled";
                 $str .= "<td>Modification refusee par l'administrateur</td>";
                 break;
             case 4:
                 $disabled = "disabled";
                 $str .= "<td>Cloturee</td>";
                 break;
         }
         if ($tab[$i]->getDateCloture() != "") {
             $str .= "<td><form method='POST' action = 'index.php?page=Statistiques'><input type = 'hidden' name = 'id' value = '" . $tab[$i]->getId() . "'><input type='submit' value='STATISTIQUES' name='stats' class ='rounded gkbutton'/></td></form>";
         } else {
             if ($tab[$i]->getEtat() == 0) {
                 $str .= "<td><form method='POST'><input type = 'hidden' name = 'id' value = '" . $i . "'><input type='submit' value='SUPPRIMER' name='supprimer' class ='rounded gkbutton'/><input type='submit' value='PUBLIER' name='publier' class ='rounded gkbutton'/><input type='submit' value='MODIFIER' name='modifier' class ='rounded gkbutton'/></td></form>";
             } else {
                 $str .= "<td><form method='POST'><input type = 'hidden' name = 'id' value = '" . $i . "'><input type='submit' value='SUPPRIMER' name='supprimer' class ='rounded gkbutton'/><input type='submit' value='MODIFIER' name='modifier' class ='rounded gkbutton' " . $disabled . "></td></form>";
             }
         }
         $str .= "</tr>";
     }
     $str .= "</center>";
     $str .= "</table>";
     if (isset($_POST['supprimer'])) {
         if ($tab[$_POST['id']]->getNombreQuestions(parent::getCnx()) == 0) {
             if ($tab[$_POST['id']]->supprimerSondage(parent::getCnx())) {
                 header('Location: index.php?page=MesSondages');
             }
         } else {
             $str .= "Ce sondage ne peut pas etre supprime";
         }
     }
     //ACTION DE L'UTILISATEUR SUR LE SONDAGE
     if (isset($_POST['publier'])) {
         if ($tab[$_POST['id']]->getNombreQuestions(parent::getCnx()) <= 4) {
             $str .= "Vous devez ajouter au moins 5 questions";
         } else {
             if ($tab[$_POST['id']]->publierSondage(parent::getCnx())) {
                 header('Location: index.php?page=MesSondages');
             }
         }
     }
     if (isset($_POST['modifier'])) {
         switch ($tab[$_POST['id']]->getStatut()) {
             case 0:
                 if ($tab[$_POST['id']]->getEtat() == 0) {
                     $_SESSION['id'] = $tab[$_POST['id']]->getId();
                     header('Location: index.php?page=Questions');
                 } else {
                     $tab[$_POST['id']]->demanderModification(parent::getCnx());
                     header('Location: index.php?page=MesSondages');
                 }
                 break;
             case 1:
                 break;
             case 2:
                 $_SESSION['id'] = $tab[$_POST['id']]->getId();
                 $tab[$_POST['id']]->modifierSondage(parent::getCnx());
                 header('Location: index.php?page=Questions');
                 break;
             case 3:
                 break;
         }
     }
     return $str;
 }
 public function getSondages()
 {
     $membre = unserialize($_SESSION['membre']);
     $tab = $membre->administrationSondages(parent::getCnx());
     $str = "";
     $str .= "<center>";
     $str .= "<table border = '1' id = 'hor-minimalist-b'><thead><tr><th scope='col'>Libelle</th><th scope='col' width ='150'>Type</th><th scope='col'>Date cloture</th><th scope='col' width ='150'>Publication</th><th scope='col' width ='150'>URL</th><th scope='col' width ='150'>Actions</th>";
     for ($i = 0; $i < COUNT($tab); $i++) {
         $bgcolor = "";
         //SI MEMBRE DEMANDE UNE MODIFICATION
         if ($tab[$i]->getStatut() == 1) {
             $bgcolor = "bgcolor = 'red'";
         } else {
             if ($tab[$i]->getStatut() == 2) {
                 $bgcolor = "bgcolor = 'green'";
             }
         }
         $str .= "<tr " . $bgcolor . ">";
         $str .= "<td>" . $tab[$i]->getNom() . "</td>";
         if ($tab[$i]->getType() == 0) {
             $str .= "<td>PUBLIC</td>";
         } else {
             $str .= "<td>PRIVE</td>";
         }
         if ($tab[$i]->getDateCloture()) {
             $str .= "<td>" . $this->formaterDate($tab[$i]->getDateCloture()) . "</td>";
         } else {
             $str .= "<td></td>";
         }
         if ($tab[$i]->getEtat() == 0) {
             $str .= "<td>PAS PUBLIE</td>";
         } else {
             $str .= "<td>PUBLIE</td>";
         }
         $str .= "<td><a href = " . $tab[$i]->getUrl() . ">" . $tab[$i]->getUrl() . "</a></td>";
         if ($tab[$i]->getStatut() == 1) {
             $str .= "<td><form method='POST'><input type = 'hidden' name = 'id' value = '" . $i . "'><input type='submit' value='SUPPRIMER' name='supprimer' class = 'rounded gkbutton'/><input type='submit' value='ACCEPTER' name='accepter' class = 'rounded gkbutton'/><input type='submit' value='REFUSER' name='refuser' class = 'rounded gkbutton'/></td></form>";
         } else {
             if ($tab[$i]->getDateCloture() != "" || $tab[$i]->getEtat() == 0) {
                 $str .= "<td><form method='POST'><input type = 'hidden' name = 'id' value = '" . $i . "'><input type='submit' value='SUPPRIMER' name='supprimer' class = 'rounded gkbutton'/></td></form>";
             } else {
                 $str .= "<td><form method='POST'><input type = 'hidden' name = 'id' value = '" . $i . "'><input type='submit' value='SUPPRIMER' name='supprimer' class = 'rounded gkbutton'/><input type='submit' value='CLOTURER' name='cloturer' class = 'rounded gkbutton'/></td></form>";
             }
         }
         $str .= "</tr>";
     }
     $str .= "</center>";
     $str .= "</table>";
     //SELON L'ACTION EXECUTEE PAR L'ADMINISTRATEUR
     if (isset($_POST['cloturer'])) {
         $membre->cloturerSondage(parent::getCnx(), $tab[$_POST['id']]->getId());
         header('Location: index.php?page=Administration');
     }
     if (isset($_POST['supprimer'])) {
         $membre->supprimerSondage(parent::getCnx(), $tab[$_POST['id']]->getId());
         header('Location: index.php?page=Administration');
     }
     if (isset($_POST['accepter'])) {
         $membre->autoriserModificationSondage(parent::getCnx(), $tab[$_POST['id']]->getId());
         header('Location: index.php?page=Administration');
     }
     if (isset($_POST['refuser'])) {
         $membre->refuserModificationSondage(parent::getCnx(), $tab[$_POST['id']]->getId());
         header('Location: index.php?page=Administration');
     }
     return $str;
 }