getLesPompiers($_SESSION['cis']); include("vues/v_choixPompier.php"); // Formulaire de choix des pompiers $lesInfosPompier = $pdo->getInfosPompier("*", $choix); $lesTranches = $pdo->getParametre("tranche"); $lesGardes = $pdo->getInfosGardes($choix); if (!isset($_REQUEST['zSemaine'])) { $_REQUEST['zSemaine'] = date('W'); } $semaine = $_REQUEST['zSemaine']; if (!isset($_REQUEST['zAnnee'])) { $_REQUEST['zAnnee'] = date('Y'); } $annee = $_REQUEST['zAnnee']; $lesDispos = $pdo->getDisposHebdo($choix, $semaine, $annee); //echo "annee:".$annee."pompier: ".$choix."semaine : ".$semaine; $premierJour = strtotime("+$semaine weeks", mktime(0, 0, 0, 1, 1, $annee)); if (date('w', $premierJour) != 1) { $premierJour = strtotime("last monday", $premierJour); } $lesTypesDispos = $pdo->getParametre("dispo"); include("vues/v_fichePompier.php"); break; } //----------------------------------------- FORMULAIRE DE SAISIE case 'ajouter': case 'modifier': case 'supprimer': { $formulaire = "frmA"; $champ = "ztNom"; include("vues/v_entete.php"); $choix = $_REQUEST['lstPompiers']; $lesInfosPompier = $pdo->getInfosPompier("*", $choix); $lesTypes = $pdo->getParametre("typePer"); $lesGrades = $pdo->getParametre("grade"); $lesStatuts = $pdo->getParametre("statAgt"); include("vues/v_unPompier.php"); break; } //----------------------------------------- VALIDATION case 'validerSupprimer': $valeur = $_REQUEST['pId']; $pdo->supprimePompier($valeur); break; case 'validerAjouter': case 'validerModifier': { if (!isset($pdo)) { require_once ("../include/class.pdo.php"); $pdo = PdoBD::getPdoBD(); } $pId = isset($_REQUEST['pId']) ? $_REQUEST['pId'] : $pdo->getLastId($_REQUEST['zCis']); $nom = addslashes($_REQUEST['ztNom']); $prenom = addslashes($_REQUEST['ztPrenom']); $type = $_REQUEST['lstType']; $grade = $_REQUEST['lstGrade']; $statut = $_REQUEST['lstStatut']; $cis = $_REQUEST['zCis']; $mail = $_REQUEST['ztMail']; // $login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']); $login = $_REQUEST['ztLogin']; $mdp = md5($login); //$mdp = md5($_REQUEST['ztMdp']); // if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") { // $mdp = "*"; // } $adresse = addslashes($_REQUEST['ztAdresse']); if (strlen($_REQUEST['ztCodePostal']) > 1) { $cp = $_REQUEST['ztCodePostal']; } else { $cp = "Null"; } $ville = addslashes($_REQUEST['ztVille']); if (strlen($_REQUEST['ztTel']) > 0) { $tel = str_replace(" ", "", $_REQUEST['ztTel']); $tel = str_replace(".", "", $tel); $tel = str_replace("/", "", $tel); } else { $tel = "Null"; } $commentaire = addslashes($_REQUEST['ztObservation']); if ( $action === "validerAjouter" && $pdo->verifDataAjoutPompier($nom, $prenom, $tel, $mail, $login) === true ) { //$pdo->ajoutPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire); echo(json_encode(array("success"=> "Ajout effectuée"))); } elseif ($action === "validerModifier") { $pdo->majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire); echo(json_encode(array("success"=> "Modification effectuée"))); } else { echo(json_encode(array("error"=> "Merci de remplir tous les champs"))); } //header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur); break; } //----------------------------------------- case 'majActivite': { $pdo->majActivite($_REQUEST["ztLaDate"], $_REQUEST["ztLaTranche"], $_REQUEST["ztExDispo"], $_REQUEST["brDispo"]); header('location: index.php?choixTraitement=pompiers&action=voir&zSemaine=' . $_REQUEST["zSemaine"] . '&zAnnee=' . $_REQUEST["zAnnee"]); break; } //----------------------------------------- default: { echo 'erreur d\'aiguillage !' . $action; break; } } ?>