Example #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());
     }
 }
Example #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;
 }
Example #3
0
 /**
  * Récupère le planning où la séance est passée en paramètre
  * @param Seance $seance
  * @return Collection
  * @throws \Exception
  */
 public static function getPlanningBySeance(Seance $seance)
 {
     try {
         $conn = Main::bdd();
         $reqPrepare = $conn->prepare("SELECT * FROM planning WHERE idSeance = ?");
         $reqPrepare->execute(array($seance->getId()));
         $tabs = $reqPrepare->fetchAll();
         $coll = new Collection();
         foreach ($tabs as $tab) {
             $inscription = MInscription::getInscriptionByIdInscription($tab['idInscription']);
             $seance = MSeance::getSeance($tab['idSeance']);
             $planning = new Planning($seance, $inscription);
             $coll->ajouter($planning);
         }
         return $coll;
     } catch (\PDOException $e) {
         throw new \Exception("La séance " . $seance->getId() . " n'est pas dans le planning");
     }
 }
Example #4
0
             Main::setFlashMessage("La modification de l'inscription a réussi", "valid");
             echo '<script>document.location.href ="?uc=admin&action=voirInscriptionCL")</script>';
         } else {
             $listIns = MInscription::getInscriptionByIdInscription($_GET['ins']);
             $listSpec = MSpectacle::getSpectacles();
             $listSpec2 = MSpectacle::getSpectacles();
             $listSpec3 = MSpectacle::getSpectacles();
             require_once ROOT . 'views/kiosqueadmin/CollegeLycee/v_InscriptionEdit.php';
         }
     } catch (\Exception $e) {
         Main::setFlashMessage($e->getMessage(), "error");
     }
     break;
 case 'SupprimerunPlanningCL':
     try {
         $inscription = MInscription::getInscriptionByIdInscription($_GET['i']);
         MPlanning::rmPlanningByInscription($inscription);
         $inscription->setValidated(0);
         MInscription::editInscription($inscription);
         Main::setFlashMessage("La suppression du planning a été faite", "valid");
         echo '<script>document.location.href ="?uc=admin&action=voirInscriptionCL"</script>';
     } catch (\Exception $e) {
         Main::setFlashMessage($e->getMessage(), "error");
     }
     break;
 case 'AjouterSeanceCL':
     try {
         if (isset($_POST['idSpectacle']) && isset($_POST['dateHeure']) && isset($_POST['idLieu'])) {
             $spectacle = MSpectacle::getSpectacleById($_POST['idSpectacle']);
             $lieu = MLieu::getLieuById($_POST['idLieu']);
             $date = DateTime::createFromFormat('d/m/Y H:i:s', $_POST['dateHeure']);