diff --git a/canapEPFL/cible.php b/canapEPFL/cible.php index fe20630767479412a252a2571815505111191023..be2b3a2e0ab61fdbc983da9ba07602e2fea0f106 100644 --- a/canapEPFL/cible.php +++ b/canapEPFL/cible.php @@ -16,13 +16,10 @@ include('templates/header.php'); //Init personnalData with postedData $candidateData = new PersonnalData($_POST); - debuglog("personnalData initiallised"); //Init dataValidator $validator = new PersonnalDataValidator($candidateData); - debuglog("PersonnalDataValitor initiallised"); if($validator->isValid()){ - debuglog("validator->isValid"); //Create folders createCandidateFolders($candidateData); //Upload files @@ -31,7 +28,8 @@ $encodedJson = (json_encode($candidateData,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT)); file_put_contents($candidateData->getPaths()["pathInfos"].'/informations.json', $encodedJson); //Send mails - mailToResp($candidateData->prenomApprenti, $candidateData->nomApprenti, $candidateData->formation); + + // mailToResp($candidateData->prenomApprenti, $candidateData->nomApprenti, $candidateData->formation); mailToApprenti($candidateData->mailApprenti, $candidateData->formation); // kill session $_SESSION['formError'] = false; @@ -41,7 +39,6 @@ $_SESSION['formError'] = true; $_SESSION['postedForm'] = $_POST; $_SESSION['files'] = $_FILES; - debuglog("!validator->isValid"); include("templates/errorText.php"); } ?> diff --git a/canapEPFL/configs/config.php b/canapEPFL/configs/config.php index 102d2ca619eb82a8ae70b7feaed2861e31b18a1e..0a145ae003bff11ab533de8db84cba375371ee83 100644 --- a/canapEPFL/configs/config.php +++ b/canapEPFL/configs/config.php @@ -4,7 +4,7 @@ // by default, labo can't apply by this formular, in case, add some of these these values in the array: /* - -- PLEASE DO NOT DELETE -- + -- DO NOT DELETE -- "laborantinBiologie" => "Laborantin-e CFC; option biologie", "laborantinChimie" => "Laborantin-e CFC; option chimie", diff --git a/canapEPFL/form.php b/canapEPFL/form.php index 709c9622856862c732dc5c7d3d6f96949a85b8e0..9d4d61b93220f9992118d7461bfb2ebac36390db 100644 --- a/canapEPFL/form.php +++ b/canapEPFL/form.php @@ -258,7 +258,7 @@ <div class="form-group mt-3"> <label for="anneeFin">Année de fin de scolarité*</label> <input type="text" name="anneeFin" id="anneeFin" class="form-control" placeholder="Année de fin de scolarité" value="<?php echo $_SESSION['postedForm']['anneeFin'] != '' ? $_SESSION['postedForm']['anneeFin'] : ''; ?>" maxlength="4" data-required/> - <small id="anneeFinError" class="form-text text-muted"></small> + <small id="anneeFinError" class="error form-text text-muted"></small> </div> <h5>3.2 Activités professionnelles</h5> <small>Formations / apprentissages après la scolarité.</small> @@ -337,7 +337,7 @@ <div class="form-group" id="dejaCandAnnee" style="display: none;"> <label for="dejaCandAnneeInput">Année de candidature *</label> <input type="text" name="dejaCandAnnee" id="dejaCandAnneeInput" class="form-control" placeholder="Année de candidature" value="<?php echo $_SESSION['postedForm']['dejaCandAnnee'] != '' ? $_SESSION['postedForm']['dejaCandAnnee'] : ''; ?>" maxlength="4"/> - <small id="dejaCandError" class="form-text text-muted"></small> + <small id="dejaCandError" class="form-text text-muted error"></small> </div> <!-- / Activités pro --> <hr> diff --git a/canapEPFL/helpers.php b/canapEPFL/helpers.php index a62fb3f848f248a49057457b0b35450ba8cf9959..a22c93ade7a502cb292378d23ed8ad394357b10d 100644 --- a/canapEPFL/helpers.php +++ b/canapEPFL/helpers.php @@ -22,12 +22,11 @@ function uploadFile(&$candidateData, $pathAnnexes, $file, $name){ $extension = strtolower(strrchr($file['name'], '.')); $validExt = ['.pdf', '.jpeg', '.png', '.jpg']; $filename = $name . $extension; - - //-> dataValidator + if(!in_array($extension, $validExt)){ $erreur = "uploadError"; } - + if(!isset($erreur)){ $filename = checkChars($filename); move_uploaded_file($file['tmp_name'], $pathAnnexes . $filename); @@ -68,8 +67,4 @@ function uploadAllFiles($pathAnnexes, $postedFiles, $candidateData){ } return $candidateData; } - -function debuglog($message){ - //echo $message; -} ?> \ No newline at end of file diff --git a/canapEPFL/models/PersonnalData.php b/canapEPFL/models/PersonnalData.php index a0cd16b735228a87b44d95a44b4b4324453fea9b..6e0872fb874f94e77090f82a23addaf7f6fa8863 100644 --- a/canapEPFL/models/PersonnalData.php +++ b/canapEPFL/models/PersonnalData.php @@ -17,7 +17,7 @@ class PersonnalData { "interactiveMediaDesigner" => "InteractiveMediaDesigners" ); private $dateNow; - private $rootpath = '\\\\scxdata\\apprentis$\\candidatures\\nouvelles\\'; + private $rootpath = 'D:/Formdata/'; // \\\\scxdata\\apprentis$\\candidatures\\nouvelles\\ public $formation = ""; public $lieu = ""; public $filiere = ""; diff --git a/canapEPFL/models/PersonnalDataValidator.php b/canapEPFL/models/PersonnalDataValidator.php index 89ef8c243054cfdaf33d4927aff91cbab5e70c89..e41648bdb56609048d685c76cd15e1bca5ec5733 100644 --- a/canapEPFL/models/PersonnalDataValidator.php +++ b/canapEPFL/models/PersonnalDataValidator.php @@ -15,7 +15,6 @@ class PersonnalDataValidator { } public function isValid(){ - $this->filiereValid(); $this->dataRequiredIsValid(); $this->representantValid(); @@ -57,8 +56,8 @@ class PersonnalDataValidator { $this->isBirthDateValid(date($this->personnalData->dateNaissanceApprenti)); - foreach ($toValid as $valid) { - $this->isRequired($valid); + foreach ($toValid as $key => $valid) { + $this->isRequired($key, $valid); } } @@ -73,9 +72,9 @@ class PersonnalDataValidator { } } - private function isRequired ($dataToCheck) { - if (is_null($dataToCheck) || $dataToCheck=="") { - $this->errors[$dataNameToCheck] = $dataNameToCheck . " manquant(e)"; + private function isRequired ($key, $dataToCheck) { + if (is_null($dataToCheck) || $dataToCheck == "") { + $this->errors[$key] = $key . " manquant(e)"; } } diff --git a/canapEPFL/templates/confirmationText.php b/canapEPFL/templates/confirmationText.php index 7af7da22304d6cf202ff63bdff5e372875f1fabc..20ce404f7ba4097cf1f0393a3c51b68e43204561 100644 --- a/canapEPFL/templates/confirmationText.php +++ b/canapEPFL/templates/confirmationText.php @@ -1,7 +1,7 @@ -<h1><?php echo $candidateData->prenomApprenti," ", $candidateData->nomApprenti,"," ?></h1> -<h4>Votre demande à bien été enregistrée, vous allez bientôt recevoir un e-mail confirmant votre postulation.</h4> -<footer> - <button type="button" id="retourHome" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent"> - Retour à l'accueil - </button> -</footer> \ No newline at end of file + + + +<main id="main" role="main" class="content container-grid"> + <p>Votre demande à bien été enregistrée, vous allez bientôt recevoir un e-mail confirmant votre postulation.</p> + <button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="retourHome">Retour à l'acceuil</button> +</main> \ No newline at end of file diff --git a/canapEPFL/templates/head.php b/canapEPFL/templates/head.php index 5214b950e492c0ccd0d93c29ddaca583e5a93a98..29a7aabd77262b15292094a34371d489acb749f9 100644 --- a/canapEPFL/templates/head.php +++ b/canapEPFL/templates/head.php @@ -8,6 +8,7 @@ <script src="./style/epfl2018/js/vendors.min.js"></script> <script src="./style/epfl2018/js/vendors.bundle.js"></script> <script src="./script.js"></script> +<style>.error { color: red!important; }</style> <noscript>Veuillez Activer JavaScript pour utiliser le service de postulation</noscript> <?php ini_set("display_errors",0);