Пример #1
0
 /**
  * Récupère tous les choix
  * @return Collection
  * @throws \Exception
  */
 public static function getChoixs()
 {
     try {
         $conn = Main::bdd();
         $reqPrepare = $conn->query("SELECT * FROM choix");
         $tabs = $reqPrepare->fetchAll();
         $coll = new Collection();
         foreach ($tabs as $tab) {
             $inscription = MInscription::getInscriptionByIdInscription($tab['idInscription']);
             $inscription->setLesChoix(MChoix::getChoixBySub($inscription));
             $spectacle = MSpectacle::getSpectacleById($tab['idSpectacle']);
             $choix = new Choix($inscription, $spectacle, $tab['prioriteChoix']);
             $coll->ajouter($choix);
         }
         return $coll;
     } catch (\PDOException $e) {
         throw new \Exception("Il n'y a aucun choix");
     } catch (KeyHasUseException $ex) {
         throw new \Exception($ex->getMessage());
     }
 }
Пример #2
0
 public static function getSeanceByIns($idInscription)
 {
     $conn = Main::bdd();
     $lesSeances = new Collection();
     try {
         $reqPrepare = $conn->prepare("SELECT choix.idInscription, spectacle.idSpectacle, seance.idSeance, seance.idLieu, seance.date_heure, choix.prioriteChoix\n            FROM choix\n            INNER JOIN spectacle ON choix.idSpectacle = spectacle.idSpectacle\n            INNER JOIN seance ON seance.idSeance = spectacle.idSpectacle\n\n            WHERE choix.idInscription = ?\n            ORDER BY choix.prioriteChoix");
         $reqPrepare->execute(array($idInscription));
         $tabs = $reqPrepare->fetchAll();
         foreach ($tabs as $tab) {
             $spectacle = MSpectacle::getSpectacleById($tab['idSpectacle']);
             $inscription = MInscription::getInscriptionByIdInscription($idInscription);
             $lieu = MLieu::getLieuById($tab['idLieu']);
             $seance = new Seance($tab['idSeance'], $spectacle, new \DateTime($tab['date_heure']), $lieu);
             $choix = MChoix::getChoixBySub($inscription);
             $lesSeances->ajouter($seance);
         }
     } catch (\PDOException $e) {
         throw new \Exception($e->getMessage());
     }
     return $lesSeances;
 }
Пример #3
0
 /**
  * Récupère l'inscription dont le numéro est passé en paramètre
  * @param int $id idInscription
  * @return Inscription
  * @throws \Exception
  */
 public static function getInscriptionByIdInscription($id)
 {
     try {
         $conn = Main::bdd();
         $reqPrepare = $conn->prepare("SELECT * FROM inscription WHERE idInscription = ?");
         $reqPrepare->execute(array($id));
         $tab = $reqPrepare->fetch();
         $enseignant = MEnseignant::getEnseignantById($tab['idEns']);
         $inscription = new Inscription($tab['idInscription'], $enseignant, new \DateTime($tab['dateInscription']), $tab['diversInscription'], $tab['impoInscription'], $tab['nbEnfantsInscription'], $tab['nbAdultesInscription'], $tab['classe']);
         $lesChoix = MChoix::getChoixBySub($inscription);
         $inscription->setLesChoix($lesChoix);
         return $inscription;
     } catch (\PDOException $e) {
         throw new \Exception("L'inscription {$id} n'existe pas.");
     }
 }