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
try {
    if (MEnseignant::isEnseignantExistant($_SESSION['enseignant']) == 0) {
        $_SESSION['enseignant']->setTypeEnseignant(2);
        MEnseignant::addEnseignant($_SESSION['enseignant']);
        $unEnseignant = MEnseignant::getEnseignantByName($_SESSION['enseignant']->getNom(), $_SESSION['enseignant']->getPrenom());
        $_SESSION['enseignant']->setId($unEnseignant->getId());
    }
    $divers = $_SESSION['divers'];
    if (empty($_SESSION['impo1']) && empty($_SESSION['impo2']) && empty($_SESSION['impo3'])) {
        $impo = '<strong><em>Vide</em></strong>';
        $impo = '1 : ' . $_SESSION['impo1'] . '<br> 2 : ' . $_SESSION['impo2'] . '<br> 3 : ' . $_SESSION['impo3'];
    }
    $date = new DateTime();
    $classe = implode(", ", $_SESSION['classe']);
    $UneInscription = new Inscription(1, $_SESSION['enseignant'], $date, $divers, $impo, $_SESSION['nbrEleve'], $_SESSION['nbrAccom'], $classe);
    $IdInscription = MInscription::addInscription($UneInscription);
    $_SESSION['Spectacle1'] = MSpectacle::getSpectacleByName($_SESSION['choix1']);
    $UneInscription->setId($IdInscription);
    $unChoix = new Choix($UneInscription, $_SESSION['Spectacle1'], 1);
    MChoix::addChoix($unChoix);
    if ($_SESSION['choix2'] != 'non') {
        $_SESSION['Spectacle2'] = MSpectacle::getSpectacleByName($_SESSION['choix2']);
        $unChoix2 = new Choix($UneInscription, $_SESSION['Spectacle2'], 2);
        MChoix::addChoix($unChoix2);
        if ($_SESSION['choix3'] != 'non') {
            $_SESSION['Spectacle3'] = MSpectacle::getSpectacleByName($_SESSION['choix3']);
            $unChoix3 = new Choix($UneInscription, $_SESSION['Spectacle3'], 3);
            MChoix::addChoix($unChoix3);
        }
    }
    $mail = $_SESSION['ecole']->getMailDirecteur();
Example #4
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 #5
0
             $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']);
             $seance = new Seance(1, $spectacle, $date, $lieu);
             MSeance::addSeance($seance);
             Main::setFlashMessage("L'ajout de la séance a été faite", "valid");
Example #6
0
 /**
  * Récupère l'enseignant dont le nom et prénom sont passés en paramètres
  * @param string $name
  * @param string $prenom
  * @return Enseignant
  * @throws \Exception
  */
 public static function getEnseignantByName($name, $prenom)
 {
     try {
         $conn = Main::bdd();
         $reqPrepare = $conn->prepare("SELECT *\n                FROM enseignant ens\n                INNER JOIN ecole e ON e.idEcole = ens.idEcole\n                WHERE ens.nomEns = ? AND ens.prenomEns = ?");
         $reqPrepare->execute(array($name, $prenom));
         $tab = $reqPrepare->fetch();
         $directeur = new Enseignant($tab['idEns'], $tab['civEns'], $tab['nomEns'], $tab['prenomEns'], $tab['mailEns'], $tab['telEns'], $tab['TypeEnseignant']);
         $ecole = new Ecole($tab['idEcole'], $tab['typeEcole'], $tab['nomEcole'], $tab['adresseEcole'], $tab['adresse2Ecole'], $tab['cpEcole'], $tab['villeEcole'], $tab['mail_dir'], $directeur);
         $lesInscriptions = MInscription::getInscriptionByEnseignant($directeur);
         $directeur->setEcole($ecole);
         $directeur->setLesInscriptions($lesInscriptions);
         return $directeur;
     } catch (\PDOException $e) {
         throw new \Exception("L'enseignant '{$name} {$prenom}' n'existe pas");
     }
 }