sauvegarde 05/10/2023
This commit is contained in:
parent
9aa3a1dbf4
commit
438ab2f077
@ -49,14 +49,14 @@ case 'ajouter':
|
||||
case 'modifier':
|
||||
case 'supprimer':
|
||||
{
|
||||
$formulaire ="frmA";
|
||||
$champ ="ztNom";
|
||||
$formulaire = "frmA";
|
||||
$champ = "ztNom";
|
||||
include("vues/v_entete.php");
|
||||
$choix= $_REQUEST['lstPompiers'];
|
||||
$choix = $_REQUEST['lstPompiers'];
|
||||
$lesInfosPompier = $pdo->getInfosPompier("*",$choix);
|
||||
$lesTypes = $pdo->getParametre("typePer");
|
||||
$lesGrades = $pdo->getParametre("grade");
|
||||
$lesStatuts = $pdo->getParametre("statAgt");
|
||||
$lesTypes = $pdo->getParametre("typePer");
|
||||
$lesGrades = $pdo->getParametre("grade");
|
||||
$lesStatuts = $pdo->getParametre("statAgt");
|
||||
include("vues/v_unPompier.php");
|
||||
break;
|
||||
}
|
||||
@ -66,11 +66,12 @@ case 'validerModifier':
|
||||
case 'validerSupprimer':
|
||||
{
|
||||
$valeur = $_REQUEST['agent'];
|
||||
if ($_REQUEST['zOk']=="OK")
|
||||
if ($_REQUEST['zOk'] == "OK")
|
||||
{
|
||||
if ($action==="validerSupprimer") {$pdo->supprimePompier($valeur);}
|
||||
else
|
||||
{
|
||||
if ($action === "validerSupprimer") {
|
||||
$pdo->supprimePompier($valeur);
|
||||
}
|
||||
else {
|
||||
$nom = addslashes ($_REQUEST['ztNom']);
|
||||
$prenom = addslashes ($_REQUEST['ztPrenom']);
|
||||
$type = $_REQUEST['lstType'];
|
||||
@ -82,9 +83,11 @@ case 'validerSupprimer':
|
||||
$mdp = md5($_REQUEST['ztMdp']); if($_REQUEST['brMdp']==0 AND $action==="validerModifier") {$mdp="*";}
|
||||
$adresse = addslashes ($_REQUEST['ztAdresse']);
|
||||
|
||||
if (strlen($_REQUEST['ztCP'])>1){
|
||||
$cp = $_REQUEST['ztCP'];} else {$cp = "Null";
|
||||
}
|
||||
if (strlen($_REQUEST['ztCP']) > 1) {
|
||||
$cp = $_REQUEST['ztCP'];
|
||||
} else {
|
||||
$cp = "Null";
|
||||
}
|
||||
$ville = addslashes($_REQUEST['ztVille']);
|
||||
|
||||
if (strlen($_REQUEST['ztTel'])>1) {
|
||||
@ -95,6 +98,7 @@ case 'validerSupprimer':
|
||||
$tel="Null";
|
||||
}
|
||||
$commentaire = addslashes ($_REQUEST['ztObs']);
|
||||
|
||||
if ($action === "validerAjouter") {
|
||||
$pdo->ajoutPompier($cis, $valeur,$nom,$prenom,$statut,$mail,$login,$mdp,$grade,$type,$adresse,$cp,$ville,$tel,$commentaire);
|
||||
$sujet = "nouveau compte";
|
||||
|
@ -202,7 +202,7 @@ class PdoBD
|
||||
public function getInfosGardes($pompier)
|
||||
{
|
||||
$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'];
|
||||
if ($pompier <> "*") {
|
||||
$req .= " AND aPompier=" . $pompier;
|
||||
@ -232,9 +232,11 @@ class PdoBD
|
||||
$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
|
||||
FROM (activite INNER JOIN parametre t ON t.pType='tranche'AND aTranche=t.pIndice
|
||||
INNER JOIN parametre d ON d.pType='dispo' AND aDisponibilite=d.pIndice)
|
||||
RIGHT OUTER JOIN pompier ON aCis=pCis AND aPompier=pId
|
||||
FROM (activite
|
||||
INNER JOIN parametre t ON t.pType='tranche'AND aTranche=t.pIndice
|
||||
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'];
|
||||
|
||||
if ($pompier <> "*") {
|
||||
|
@ -321,31 +321,33 @@ $(document).on('click', '.click-garde', function () {
|
||||
idPompier = $(this).attr('id').split('/')[2]
|
||||
garde = 0;
|
||||
|
||||
if ($(this).text() == 'X') {
|
||||
$(this).text('');
|
||||
garde = 0;
|
||||
} else if ($(this).text() == ""){
|
||||
$(this).text('X');
|
||||
garde = 1;
|
||||
} else {
|
||||
$(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);
|
||||
if ($(this).css('background-color') != "rgb(255, 0, 0)") {
|
||||
if ($(this).text() == 'X') {
|
||||
$(this).text('');
|
||||
garde = 0;
|
||||
} else if ($(this).text() == ""){
|
||||
$(this).text('X');
|
||||
garde = 1;
|
||||
} else {
|
||||
$(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);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
@ -25,10 +25,13 @@ switch($choixTraitement)
|
||||
{
|
||||
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 '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 'pompiers' : {include("controleurs/c_pompiers.php");break;} //Page pompiers {TODO} 1
|
||||
default :{echo 'erreur d\'aiguillage !'.$uc;break;}
|
||||
case 'pompiers' : {include("controleurs/c_pompiers.php");break;} //Page pompiers {TODO}
|
||||
default : {
|
||||
echo 'erreur d\'aiguillage !'.$uc;
|
||||
break;
|
||||
}
|
||||
}
|
||||
include("vues/v_pied.php") ;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
<!-- choix d'une Caserne / Derniere modification le 23 mai 2019 par Pascal Blain -->
|
||||
<?php
|
||||
$nbA=count($lesCasernes);
|
||||
$nbA = count($lesCasernes);
|
||||
echo '
|
||||
<div id="contenu">
|
||||
<form name="choixC" action="index.php" method="post">
|
||||
|
@ -1,18 +1,39 @@
|
||||
<!-- v_unPompier.php / Derniere modification le 18 septembre 2023 par Pascal Blain -->
|
||||
<div id="contenu">
|
||||
<?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 '<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") {
|
||||
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'] == "modifier") {
|
||||
var_dump($lesInfosPompier);
|
||||
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 '
|
||||
<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 ("
|
||||
<table style='border: 0px solid white;'>
|
||||
@ -21,10 +42,9 @@
|
||||
<fieldset><legend>Coordonnées</legend>
|
||||
<table>
|
||||
");
|
||||
|
||||
if ($_REQUEST['action']=="supprimer"){ //-------------------------------------------------------- cas suppression
|
||||
echo ("
|
||||
<div style='display: none;' class='unOnglet' id='contenuOnglet3'>
|
||||
if ($_REQUEST['action'] == "supprimer"){ //-------------------------------------------------------- cas suppression
|
||||
echo ("
|
||||
<div style='display: none;' class='unOnglet' id='contenuOnglet3'>
|
||||
<table style='border: 0px solid white;'>
|
||||
<tr>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user