/** * Récupère toutes les inscriptions * @return Collection * @throws \Exception */ public static function getInscriptionsCollegeLycee() { try { $conn = Main::bdd(); $reqPrepare = $conn->query("SELECT * FROM inscription i\n INNER JOIN enseignant en ON en.idEns = i.idEns\n INNER JOIN ecole e ON e.idEcole = en.idEcole\n WHERE typeEcole = 3 OR typeEcole = 4"); $tabs = $reqPrepare->fetchAll(); $coll = new Collection(); foreach ($tabs as $tab) { $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']); if ($tab['validationInscription'] == '1') { $inscription->setValidated(true); } else { $inscription->setValidated(false); } $lesChoix = MChoix::getChoixBySub($inscription); $inscription->setLesChoix($lesChoix); $coll->ajouter($inscription); } return $coll; } catch (\PDOException $e) { throw new \Exception("Il n'y a aucune inscription validée"); } catch (KeyHasUseException $ex) { throw new \Exception($ex->getMessage()); } }