sauvegarde 05/10/2023

This commit is contained in:
pierre renaudot 2023-10-05 08:54:15 +02:00
parent 9aa3a1dbf4
commit 438ab2f077
6 changed files with 90 additions and 59 deletions

View File

@ -49,14 +49,14 @@ case 'ajouter':
case 'modifier': case 'modifier':
case 'supprimer': case 'supprimer':
{ {
$formulaire ="frmA"; $formulaire = "frmA";
$champ ="ztNom"; $champ = "ztNom";
include("vues/v_entete.php"); include("vues/v_entete.php");
$choix= $_REQUEST['lstPompiers']; $choix = $_REQUEST['lstPompiers'];
$lesInfosPompier = $pdo->getInfosPompier("*",$choix); $lesInfosPompier = $pdo->getInfosPompier("*",$choix);
$lesTypes = $pdo->getParametre("typePer"); $lesTypes = $pdo->getParametre("typePer");
$lesGrades = $pdo->getParametre("grade"); $lesGrades = $pdo->getParametre("grade");
$lesStatuts = $pdo->getParametre("statAgt"); $lesStatuts = $pdo->getParametre("statAgt");
include("vues/v_unPompier.php"); include("vues/v_unPompier.php");
break; break;
} }
@ -66,11 +66,12 @@ case 'validerModifier':
case 'validerSupprimer': case 'validerSupprimer':
{ {
$valeur = $_REQUEST['agent']; $valeur = $_REQUEST['agent'];
if ($_REQUEST['zOk']=="OK") if ($_REQUEST['zOk'] == "OK")
{ {
if ($action==="validerSupprimer") {$pdo->supprimePompier($valeur);} if ($action === "validerSupprimer") {
else $pdo->supprimePompier($valeur);
{ }
else {
$nom = addslashes ($_REQUEST['ztNom']); $nom = addslashes ($_REQUEST['ztNom']);
$prenom = addslashes ($_REQUEST['ztPrenom']); $prenom = addslashes ($_REQUEST['ztPrenom']);
$type = $_REQUEST['lstType']; $type = $_REQUEST['lstType'];
@ -82,9 +83,11 @@ case 'validerSupprimer':
$mdp = md5($_REQUEST['ztMdp']); if($_REQUEST['brMdp']==0 AND $action==="validerModifier") {$mdp="*";} $mdp = md5($_REQUEST['ztMdp']); if($_REQUEST['brMdp']==0 AND $action==="validerModifier") {$mdp="*";}
$adresse = addslashes ($_REQUEST['ztAdresse']); $adresse = addslashes ($_REQUEST['ztAdresse']);
if (strlen($_REQUEST['ztCP'])>1){ if (strlen($_REQUEST['ztCP']) > 1) {
$cp = $_REQUEST['ztCP'];} else {$cp = "Null"; $cp = $_REQUEST['ztCP'];
} } else {
$cp = "Null";
}
$ville = addslashes($_REQUEST['ztVille']); $ville = addslashes($_REQUEST['ztVille']);
if (strlen($_REQUEST['ztTel'])>1) { if (strlen($_REQUEST['ztTel'])>1) {
@ -95,6 +98,7 @@ case 'validerSupprimer':
$tel="Null"; $tel="Null";
} }
$commentaire = addslashes ($_REQUEST['ztObs']); $commentaire = addslashes ($_REQUEST['ztObs']);
if ($action === "validerAjouter") { if ($action === "validerAjouter") {
$pdo->ajoutPompier($cis, $valeur,$nom,$prenom,$statut,$mail,$login,$mdp,$grade,$type,$adresse,$cp,$ville,$tel,$commentaire); $pdo->ajoutPompier($cis, $valeur,$nom,$prenom,$statut,$mail,$login,$mdp,$grade,$type,$adresse,$cp,$ville,$tel,$commentaire);
$sujet = "nouveau compte"; $sujet = "nouveau compte";

View File

@ -202,7 +202,7 @@ class PdoBD
public function getInfosGardes($pompier) public function getInfosGardes($pompier)
{ {
$req = "SELECT aPompier, DATE_FORMAT(aDateGarde,'%d/%m/%Y') as wDate, aTranche, pLibelle as tLibelle $req = "SELECT aPompier, DATE_FORMAT(aDateGarde,'%d/%m/%Y') as wDate, aTranche, pLibelle as tLibelle
FROM activite INNER JOIN parametre ON pType='tranche' AND aTranche=pIndice FROM activite INNER JOIN parametre ON pType = 'tranche' AND aTranche = pIndice
WHERE aCis=" . $_SESSION['cis']; WHERE aCis=" . $_SESSION['cis'];
if ($pompier <> "*") { if ($pompier <> "*") {
$req .= " AND aPompier=" . $pompier; $req .= " AND aPompier=" . $pompier;
@ -232,9 +232,11 @@ class PdoBD
$fin = date('Y/m/d', strtotime("6 days", $premierJour)); $fin = date('Y/m/d', strtotime("6 days", $premierJour));
$req = "SELECT pId, pNom, pPrenom, DATE_FORMAT(aDateGarde,'%d/%m/%Y') as wDate, aTranche, aDisponibilite, aGarde, d.pValeur as dCouleur $req = "SELECT pId, pNom, pPrenom, DATE_FORMAT(aDateGarde,'%d/%m/%Y') as wDate, aTranche, aDisponibilite, aGarde, d.pValeur as dCouleur
FROM (activite INNER JOIN parametre t ON t.pType='tranche'AND aTranche=t.pIndice FROM (activite
INNER JOIN parametre d ON d.pType='dispo' AND aDisponibilite=d.pIndice) INNER JOIN parametre t ON t.pType='tranche'AND aTranche=t.pIndice
RIGHT OUTER JOIN pompier ON aCis=pCis AND aPompier=pId INNER JOIN parametre d ON d.pType='dispo' AND aDisponibilite=d.pIndice
)
RIGHT OUTER JOIN pompier ON aCis = pCis AND aPompier=pId
WHERE aCis=" . $_SESSION['cis']; WHERE aCis=" . $_SESSION['cis'];
if ($pompier <> "*") { if ($pompier <> "*") {

View File

@ -321,31 +321,33 @@ $(document).on('click', '.click-garde', function () {
idPompier = $(this).attr('id').split('/')[2] idPompier = $(this).attr('id').split('/')[2]
garde = 0; garde = 0;
if ($(this).text() == 'X') { if ($(this).css('background-color') != "rgb(255, 0, 0)") {
$(this).text(''); if ($(this).text() == 'X') {
garde = 0; $(this).text('');
} else if ($(this).text() == ""){ garde = 0;
$(this).text('X'); } else if ($(this).text() == ""){
garde = 1; $(this).text('X');
} else { garde = 1;
$(this).text( "X"); } else {
garde = 0; $(this).text( "X");
} garde = 0;
var tableauDeDonnees = {
"date" : date,
"tranche" : tranche,
"pompier" : idPompier,
"garde" : garde
}
$.ajax({
url: "/controleurs/c_disponibilitée.php?option=garde", // URL de l'API ou de la ressource
method: "POST", // Méthode HTTP (GET, POST, etc.)
dataType: "json", // Type de données attendu
data : tableauDeDonnees,
error: function(xhr, status, error) {
// Gérer les erreurs de la requête AJAX
console.error("Erreur lors de la requête AJAX :", status, error);
} }
});
var tableauDeDonnees = {
"date" : date,
"tranche" : tranche,
"pompier" : idPompier,
"garde" : garde
}
$.ajax({
url: "/controleurs/c_disponibilitée.php?option=garde", // URL de l'API ou de la ressource
method: "POST", // Méthode HTTP (GET, POST, etc.)
dataType: "json", // Type de données attendu
data : tableauDeDonnees,
error: function(xhr, status, error) {
// Gérer les erreurs de la requête AJAX
console.error("Erreur lors de la requête AJAX :", status, error);
}
});
}
}) })

View File

@ -25,10 +25,13 @@ switch($choixTraitement)
{ {
case 'connexion': {include("controleurs/c_connexion.php");break;} //Connecte le pompier {DONE} case 'connexion': {include("controleurs/c_connexion.php");break;} //Connecte le pompier {DONE}
case 'parametres': {include("controleurs/c_param.php");break;} //Page paramètre {TODO} 3 case 'parametres': {include("controleurs/c_param.php");break;} //Page paramètre {TODO} 3
case 'gardes' : {include("controleurs/c_gardes.php");break;} //Page garde {TODO} 2 case 'gardes' : {include("controleurs/c_gardes.php");break;} //Page garde {DONE}
case 'interventions': {include("controleurs/c_interventions.php");break;} //Page intervention {NOT TODAY} case 'interventions': {include("controleurs/c_interventions.php");break;} //Page intervention {NOT TODAY}
case 'pompiers' : {include("controleurs/c_pompiers.php");break;} //Page pompiers {TODO} 1 case 'pompiers' : {include("controleurs/c_pompiers.php");break;} //Page pompiers {TODO}
default :{echo 'erreur d\'aiguillage !'.$uc;break;} default : {
echo 'erreur d\'aiguillage !'.$uc;
break;
}
} }
include("vues/v_pied.php") ; include("vues/v_pied.php") ;

View File

@ -1,6 +1,6 @@
<!-- choix d'une Caserne / Derniere modification le 23 mai 2019 par Pascal Blain --> <!-- choix d'une Caserne / Derniere modification le 23 mai 2019 par Pascal Blain -->
<?php <?php
$nbA=count($lesCasernes); $nbA = count($lesCasernes);
echo ' echo '
<div id="contenu"> <div id="contenu">
<form name="choixC" action="index.php" method="post"> <form name="choixC" action="index.php" method="post">

View File

@ -1,18 +1,39 @@
<!-- v_unPompier.php / Derniere modification le 18 septembre 2023 par Pascal Blain --> <!-- v_unPompier.php / Derniere modification le 18 septembre 2023 par Pascal Blain -->
<div id="contenu"> <div id="contenu">
<?php <?php
if ($_REQUEST['action']=="supprimer") { /**
* Boutons d'action a coté du nom
* *lesInfosPompiers = pdo->getInfosPompier());
*/
if ($_REQUEST['action'] == "supprimer") {
echo '<h2>SUPPRESSION DU POMPIER '.$lesInfosPompier['nom'].' '.$lesInfosPompier['prenom'].'</h2>'; echo '<h2>SUPPRESSION DU POMPIER '.$lesInfosPompier['nom'].' '.$lesInfosPompier['prenom'].'</h2>';
echo '<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerSupprimer&type='.$lesInfosPompier['pType'].'&agent='.$lesInfosPompier['id'].'&caserne='.$lesInfosPompier['pCis'].'" method="post">'; echo (
'<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerSupprimer&type='
. $lesInfosPompier['pType']
. '&agent=' . $lesInfosPompier['id']
. '&caserne=' . $lesInfosPompier['pCis']
. '" method="post">');
} }
if ($_REQUEST['action']=="modifier") { if ($_REQUEST['action'] == "modifier") {
echo '<h2>MODIFICATION DU POMPIER '.$lesInfosPompier['nom'].' '.$lesInfosPompier['prenom'].'</h2>'; var_dump($lesInfosPompier);
echo '<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerModifier&type='.$lesInfosPompier['pType'].'&agent='.$lesInfosPompier['id'].'&caserne='.$lesInfosPompier['pCis'].'" method="post">'; echo ('
<h2>MODIFICATION DU POMPIER '
. $lesInfosPompier['nom'] . ' '
. $lesInfosPompier['prenom'] . '</h2>'
);
echo ('
<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerModifier&type='
. $lesInfosPompier['pType'] . '&agent='
. $lesInfosPompier['id']
. '&caserne=' . $lesInfosPompier['pCis']
. '" method="post">'
);
} }
if ($_REQUEST['action']=="ajouter") { if ($_REQUEST['action'] == "ajouter") {
echo "<h2>AJOUT D'UN NOUVEAU POMPIER</h2>"; echo "<h2>AJOUT D'UN NOUVEAU POMPIER</h2>";
echo ' echo '
<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerAjouter&type='.$lesInfosPompier['pType'].'" method="post" onsubmit="return valider(this)">'; <form name="frmA" action="index.php?choixTraitement=pompiers&action=validerAjouter&type='
. $lesInfosPompier['pType'].'" method="post" onsubmit="return valider(this)">';
} }
echo (" echo ("
<table style='border: 0px solid white;'> <table style='border: 0px solid white;'>
@ -21,10 +42,9 @@
<fieldset><legend>Coordonn&eacute;es</legend> <fieldset><legend>Coordonn&eacute;es</legend>
<table> <table>
"); ");
if ($_REQUEST['action'] == "supprimer"){ //-------------------------------------------------------- cas suppression
if ($_REQUEST['action']=="supprimer"){ //-------------------------------------------------------- cas suppression echo ("
echo (" <div style='display: none;' class='unOnglet' id='contenuOnglet3'>
<div style='display: none;' class='unOnglet' id='contenuOnglet3'>
<table style='border: 0px solid white;'> <table style='border: 0px solid white;'>
<tr> <tr>