Exemplo n.º 1
0
 public function createForm()
 {
     $dao = new Dao();
     $dao->connexion();
     $dao->supprimerFormation($this->IDent);
     $crenAmD = $this->crenOrigin;
     #debut matin
     $crenPmD = $this->nbCreneauxMatin + 1;
     #debut aprem
     $crenAmF = $this->nbCreneauxMatin;
     #fin matin
     $crenPmF = $this->nbCreneaux;
     #fin aprem et journee
     # # # # # # # # # # # # # # # # # # # #
     #   Am -> matin et Pm -> apres_midi   #
     #   D -> debut et F -> fin            #
     #                                     #
     #   $crenAmD, $crenAmF = matin        #
     #   $crenPmD, $crenPmF = apres_midi   #
     #   $crenAmD, $crenPmF = journee      #
     # # # # # # # # # # # # # # # # # # # #
     # ajoutFormation(formation, IDentreprise, creneauDebut, creneauFin)
     #############################
     #          JOURNEE          #
     #############################
     // une personne pour une formation
     if ($this->nbForm == 1 && $this->nbSessions == 1) {
         $this->ArrayForm[] = array($this->form[0], $this->IDent, "", $crenAmD, $crenPmF);
     } else {
         if ($this->nbForm == $this->nbSessions) {
             foreach ($this->form as $value) {
                 $this->ArrayForm[] = array($value, $this->IDent, "", $crenAmD, $crenPmF);
             }
         } else {
             if ($this->nbForm / $this->nbSessions == 2) {
                 $this->autreCas();
             } else {
                 if ($this->nbForm > $this->nbSessions) {
                     $this->casSpecial();
                 } else {
                     if ($this->nbSessions > $this->nbForm) {
                         $cpt = $this->nbSessions;
                         for ($i = 0; $i < ceil($this->nbSessions / $this->nbForm); $i++) {
                             foreach ($this->form as $value) {
                                 if ($cpt > 0) {
                                     $this->ArrayForm[] = array($value, $this->IDent, "", $crenAmD, $crenPmF);
                                 }
                                 $cpt--;
                             }
                         }
                     } else {
                         $this->autreCas();
                     }
                 }
             }
         }
     }
     # ajout a la bdd
     foreach ($this->ArrayForm as $formTest) {
         $dao->ajoutFormation($formTest[0], $formTest[1], $formTest[3], $formTest[4]);
     }
     $dao->deconnexion();
 }
Exemplo n.º 2
0
<?php

header("Content-type: text/html; charset=utf-8");
// vous ne devez rien modifier dans ce script qui vous permet de tester votre classe Dao
require "Dao.php";
try {
    $dao = new Dao();
    $dao->connexion();
    echo "============================ getMotDePasse / verifieMotDePasse ============================<br/><br/>";
    echo $dao->getMotDePasse('etudiant') . "<br/>";
    echo $dao->verifieMotDePasse('etudiant', 'etudiant');
    echo "<br/><br/> ============================ getTypeUtilisateur ============================<br/><br/>";
    echo $dao->getTypeUtilisateur('etudiant') . "<br/>";
    echo $dao->getTypeUtilisateur('entreprise') . "<br/>";
} catch (ConnexionException $e) {
    echo "problème de connexion";
} catch (AccesTableException $e) {
    echo "problème de d'acces à une table";
}
?>