Exemple #1
0
            if (!is_numeric($_POST['nomEcole']) && is_numeric($_POST['cpEcole']) && is_numeric($_POST['telDir']) && !empty($_POST['nomEcole']) && !empty($_POST['adresseEcole']) && !empty($_POST['cpEcole']) && !empty($_POST['villeEcole']) && !empty($_POST['mailDir']) && !empty($_POST['telDir']) && !empty($_POST['nomDir'])) {
                $directeur = new Enseignant(1, $_POST['civDir'], $_POST['nomDir'], $_POST['prenomDir'], $_POST['mailDir'], $_POST['telDir'], 1);
                $ecole = new Ecole(1, $_POST['typeEcole'], $_POST['nomEcole'], $_POST['adresseEcole'], 1, $_POST['cpEcole'], $_POST['villeEcole'], $_POST['mailDir'], $directeur);
                $idEcole = MEcole::setEcole($ecole);
                $ecole->setId($idEcole);
                $directeur->setEcole($ecole);
                $idEnseignant = MEnseignant::addEnseignant($directeur);
                $directeur->setId($idEnseignant);
                $ecole->setDirecteur($directeur);
                MEcole::editEcole($ecole, $directeur);
                Main::setFlashMessage("L'école a bien été ajoutée", "valid");
                echo '<script>document.location.href ="?uc=ecole"</script>';
            } else {
                echo '<script>document.location.href ="?uc=ecole"</script>';
                throw new \Exception("Impossible d'ajouter l'école (mauvais formats entrés)");
            }
        } catch (\Exception $e) {
            Main::setFlashMessage($e->getMessage(), "error");
        }
        break;
    case 'SupprimerEcole':
        try {
            $ecole = MEcole::getEcoleById($_GET['schools']);
            MEcole::rmEcole($ecole);
            Main::setFlashMessage("L'école : " . $ecole->getNom() . " a bien été supprimée", "valid");
            echo '<script>document.location.href ="?uc=ecole"</script>';
        } catch (\Exception $e) {
            Main::setFlashMessage($e->getMessage(), "error");
        }
        break;
}
             echo '<script>document.location.href ="?uc=cl&action=choisirTypeEcole"</script>';
         }
         if ($_POST['typeEcole'] == '3') {
             $listEcole = MEcole::getColleges();
         } else {
             $listEcole = MEcole::getLycees();
         }
         require_once ROOT . 'views/inscriptionCollegeLycee/v_EcoleChoix.php';
     } catch (\Exception $e) {
         Main::setFlashMessage($e->getMessage(), "error");
     }
     break;
 case 'etape1':
     try {
         if (isset($_POST['choix'])) {
             $ecole = MEcole::getEcoleById($_POST['choix']);
             $_SESSION['ecole'] = $ecole;
         } else {
             echo '<script>document.location.href ="?uc=cl&action=choisirTypeEcole"</script>';
         }
         require_once ROOT . 'views/inscriptionCollegeLycee/v_Etape1.php';
     } catch (\Exception $e) {
         Main::setFlashMessage($e->getMessage(), "error");
     }
     break;
 case 'etape2':
     try {
         if (isset($_SESSION['ecole']) && isset($_POST['facture'])) {
             $_SESSION['facture'] = $_POST['facture'];
         }
         $_SESSION['directeur'] = MEnseignant::getDirecteur($_SESSION['ecole']);
         $listSpectacle = MSpectacle::getSpectacles();
         require_once ROOT . 'views/kiosqueadmin/CollegeLycee/v_JaugePDF.php';
     } catch (\Exception $e) {
         Main::setFlashMessage($e->getMessage(), "error");
     }
     break;
 case 'CourrierPDF':
     try {
         if (isset($_GET['ecole'])) {
             $ecole = MEcole::getEcoleById($_GET['ecole']);
             $listInsEcole = MPlanning::getPlanningsbyEcole($ecole);
             $_SESSION['idEcole'] = $_GET['ecole'];
             $_SESSION['ecole'] = $listInsEcole;
         }
         if (isset($_POST['valider'])) {
             $ecole = MEcole::getEcoleById($_SESSION['idEcole']);
             $listInsEcole = MPlanning::getPlanningsbyEcole($ecole);
             // get the HTML
             ob_start();
             ?>
             <style type="text/css">
                 table{
                     text-align: center;
                     vertical-align: middle;
                     line-height: 6px;
                     font-family: helvetica;
                     font-size: 12pt;
                     width: 100%;
                     border-collapse: collapse;
                     margin:auto;
                 }