5 Commits

Author SHA1 Message Date
443c0225ae ajout pompier 2023-10-19 11:53:17 +02:00
aa0701334e modification complète d'un pompier 2023-10-19 09:07:06 +02:00
5fdb28c44e Modification du pompier 2023-10-12 09:01:55 +02:00
ea3ea7cb5f modif pompiers pas finis 2023-10-05 11:53:36 +02:00
438ab2f077 sauvegarde 05/10/2023 2023-10-05 08:54:15 +02:00
12 changed files with 715 additions and 392 deletions

View File

@ -0,0 +1,3 @@
<?php
$pdo

View File

@ -9,9 +9,8 @@
// Auteur : pascal.blain@ac-dijon.fr ' // Auteur : pascal.blain@ac-dijon.fr '
//*****************************************' //*****************************************'
$action = $_REQUEST['action']; $action = $_REQUEST['action'];
switch($action) { switch ($action) {
case 'voir': case 'voir': {
{
$formulaire = "choixP"; //Donne le focus dans le form $formulaire = "choixP"; //Donne le focus dans le form
$champ = "lstPompiers"; $champ = "lstPompiers";
include("vues/v_entete.php"); include("vues/v_entete.php");
@ -19,24 +18,24 @@ case 'voir':
$lesLignes = $pdo->getLesPompiers($_SESSION['cis']); $lesLignes = $pdo->getLesPompiers($_SESSION['cis']);
include("vues/v_choixPompier.php"); // Formulaire de choix des pompiers include("vues/v_choixPompier.php"); // Formulaire de choix des pompiers
$lesInfosPompier = $pdo->getInfosPompier("*",$choix); $lesInfosPompier = $pdo->getInfosPompier("*", $choix);
$lesTranches = $pdo->getParametre("tranche"); $lesTranches = $pdo->getParametre("tranche");
$lesGardes = $pdo->getInfosGardes($choix); $lesGardes = $pdo->getInfosGardes($choix);
if(!isset($_REQUEST['zSemaine'])) { if (!isset($_REQUEST['zSemaine'])) {
$_REQUEST['zSemaine'] = date('W'); $_REQUEST['zSemaine'] = date('W');
} }
$semaine = $_REQUEST['zSemaine']; $semaine = $_REQUEST['zSemaine'];
if(!isset($_REQUEST['zAnnee'])) { if (!isset($_REQUEST['zAnnee'])) {
$_REQUEST['zAnnee'] = date('Y'); $_REQUEST['zAnnee'] = date('Y');
} }
$annee = $_REQUEST['zAnnee']; $annee = $_REQUEST['zAnnee'];
$lesDispos = $pdo->getDisposHebdo($choix, $semaine, $annee); $lesDispos = $pdo->getDisposHebdo($choix, $semaine, $annee);
//echo "annee:".$annee."pompier: ".$choix."semaine : ".$semaine; //echo "annee:".$annee."pompier: ".$choix."semaine : ".$semaine;
$premierJour = strtotime("+$semaine weeks", mktime(0,0,0,1,1,$annee)); $premierJour = strtotime("+$semaine weeks", mktime(0, 0, 0, 1, 1, $annee));
if (date('w',$premierJour) != 1){ if (date('w', $premierJour) != 1) {
$premierJour = strtotime("last monday", $premierJour); $premierJour = strtotime("last monday", $premierJour);
} }
$lesTypesDispos = $pdo->getParametre("dispo"); $lesTypesDispos = $pdo->getParametre("dispo");
@ -44,92 +43,96 @@ case 'voir':
break; break;
} }
//----------------------------------------- FORMULAIRE DE SAISIE //----------------------------------------- FORMULAIRE DE SAISIE
case 'ajouter': 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;
} }
//----------------------------------------- VALIDATION //----------------------------------------- VALIDATION
case 'validerAjouter': case 'validerSupprimer':
case 'validerModifier': $valeur = $_REQUEST['pId'];
case 'validerSupprimer': $pdo->supprimePompier($valeur);
{ break;
$valeur = $_REQUEST['agent']; case 'validerAjouter':
if ($_REQUEST['zOk']=="OK") case 'validerModifier': {
{ //var_dump($_REQUEST);
if ($action==="validerSupprimer") {$pdo->supprimePompier($valeur);}
else if (!isset($pdo)) {
{ require_once ("../include/class.pdo.php");
$nom = addslashes ($_REQUEST['ztNom']); $pdo = PdoBD::getPdoBD();
$prenom = addslashes ($_REQUEST['ztPrenom']); }
$pId = isset($_REQUEST['pId']) ? $_REQUEST['pId'] : $pdo->getLastId($_REQUEST['zCis']);
$nom = addslashes($_REQUEST['ztNom']);
$prenom = addslashes($_REQUEST['ztPrenom']);
$type = $_REQUEST['lstType']; $type = $_REQUEST['lstType'];
$grade = $_REQUEST['lstGrade']; $grade = $_REQUEST['lstGrade'];
$statut = $_REQUEST['lstStatut']; $statut = $_REQUEST['lstStatut'];
$cis = $_REQUEST['zCis']; $cis = $_REQUEST['zCis'];
$mail = $_REQUEST['ztMail']; $mail = $_REQUEST['ztMail'];
// $login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']);
$login = $_REQUEST['ztLogin']; $login = $_REQUEST['ztLogin'];
$mdp = md5($_REQUEST['ztMdp']); if($_REQUEST['brMdp']==0 AND $action==="validerModifier") {$mdp="*";} $mdp = md5($login);
$adresse = addslashes ($_REQUEST['ztAdresse']); //$mdp = md5($_REQUEST['ztMdp']);
// if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") {
// $mdp = "*";
// }
$adresse = addslashes($_REQUEST['ztAdresse']);
if (strlen($_REQUEST['ztCP'])>1){ if (strlen($_REQUEST['ztCodePostal']) > 1) {
$cp = $_REQUEST['ztCP'];} else {$cp = "Null"; $cp = $_REQUEST['ztCodePostal'];
} else {
$cp = "Null";
} }
$ville = addslashes($_REQUEST['ztVille']); $ville = addslashes($_REQUEST['ztVille']);
if (strlen($_REQUEST['ztTel'])>1) { if (strlen($_REQUEST['ztTel']) > 0) {
$tel = str_replace(" ", "", $_REQUEST['ztTel']); $tel = str_replace(" ", "", $_REQUEST['ztTel']);
$tel=str_replace(".", "", $tel); $tel = str_replace(".", "", $tel);
$tel=str_replace("/", "", $tel); $tel = str_replace("/", "", $tel);
} else { } else {
$tel="Null"; $tel = "Null";
} }
$commentaire = addslashes ($_REQUEST['ztObs']); $commentaire = addslashes($_REQUEST['ztObservation']);
if ($action === "validerAjouter") {
$pdo->ajoutPompier($cis, $valeur,$nom,$prenom,$statut,$mail,$login,$mdp,$grade,$type,$adresse,$cp,$ville,$tel,$commentaire); if (
$sujet = "nouveau compte"; $action === "validerAjouter"
$msg = "Bonjour " . $prenom . " " . $nom . ", \r\nLe Castel vient de créer un compte pour vous ...\r\n"; && $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 { } else {
$pdo->majPompier($cis, $valeur,$nom,$prenom,$statut,$mail,$login,$mdp,$grade,$type,$adresse,$cp,$ville,$tel,$commentaire); echo(json_encode(array("error"=> "Merci de remplir tous les champs")));
$sujet = "nouveau mot de passe";
$msg = "Bonjour " . $prenom . " " . $nom . ", \r\nLe Castel vient de modifier votre mot de passe ...\r\n";
} }
$entete = "From: Pascal Blain <pascal-blain@wanadoo.fr>\r\n"; //header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur);
$entete .= "Mime-Version: 1.0\r\n";
$entete .= "Content-type: text/html; charset=utf-8\r\n";
$entete .= "\r\n";
$msg .= "Statut : " . $statut."\r\n";
$msg .= "Identifiant : " . $login."\r\n";
$msg .= "Mot de passe : " . $_REQUEST['ztMdp'] . "\r\n";
//$pdo->envoyerMail($mail, $sujet, $msg, $entete);
}
}
header ('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur);
break; break;
} }
//----------------------------------------- //-----------------------------------------
case 'majActivite': case 'majActivite': {
{ $pdo->majActivite($_REQUEST["ztLaDate"], $_REQUEST["ztLaTranche"], $_REQUEST["ztExDispo"], $_REQUEST["brDispo"]);
$pdo->majActivite($_REQUEST["ztLaDate"], $_REQUEST["ztLaTranche"], $_REQUEST["ztExDispo"],$_REQUEST["brDispo"] ); header('location: index.php?choixTraitement=pompiers&action=voir&zSemaine=' . $_REQUEST["zSemaine"] . '&zAnnee=' . $_REQUEST["zAnnee"]);
header ('location: index.php?choixTraitement=pompiers&action=voir&zSemaine='.$_REQUEST["zSemaine"].'&zAnnee='.$_REQUEST["zAnnee"]);
break; break;
} }
//----------------------------------------- //-----------------------------------------
default : default: {
{ echo 'erreur d\'aiguillage !' . $action;
echo 'erreur d\'aiguillage !'.$action;
break; break;
} }
} }

View File

@ -78,9 +78,31 @@ class PdoBD
*/ */
public function getInfosPompier($login, $mdp) public function getInfosPompier($login, $mdp)
{ {
/*
$req = "SELECT pCis, pId as id, pNom as nom, pPrenom as prenom, pStatut, pMail, pLogin, pMdp, pGrade, pAdresse, pCp, pVille, pBip, pCommentaire, $req = "SELECT pCis, pId as id, pNom as nom, pPrenom as prenom, pStatut, pMail, pLogin, pMdp, pGrade, pAdresse, pCp, pVille, pBip, pCommentaire,
'la caserne' as cNom, 'adresse' as cAdresse, 'telephone' as cTel, 'le groupement' as cGroupement, 'le grade' as wGrade, 'le statut' as wStatut, 'le type' as wType 'la caserne' as cNom, 'adresse' as cAdresse, 'telephone' as cTel, 'le groupement' as cGroupement, 'le grade' as wGrade, 'le statut' as wStatut, 'le type' as wType
FROM pompier"; FROM pompier";
*/
$req = "SELECT
pCis,
pId as id,
pNom as nom,
pPrenom as prenom,
pStatut, pMail,
pLogin, pMdp,
pAdresse,
pCp, pVille,
pBip, pCommentaire,
a.pLibelle AS wType,
b.pLibelle AS wGrade,
c.pLibelle AS wStatut,
cNom, cAdresse,
cTel, cGroupement
FROM pompier
INNER JOIN caserne ON pompier.pCis = caserne.cId
INNER JOIN parametre AS a ON a.pType = 'typePer' AND pompier.pType = a.pIndice
INNER JOIN parametre AS b ON b.pType = 'grade' AND pompier.pGrade = b.pIndice
INNER JOIN parametre AS c ON c.pType = 'statAgt' AND pompier.pStatut = c.pIndice";
if ($login === "*") { if ($login === "*") {
$req .= " WHERE pCis=" . $_SESSION['cis'] . " AND pId = $mdp"; $req .= " WHERE pCis=" . $_SESSION['cis'] . " AND pId = $mdp";
} else { } else {
@ -100,7 +122,7 @@ class PdoBD
*/ */
public function majActivite($cis, $idUser, $jour, $tranche, $newDispo) public function majActivite($cis, $idUser, $jour, $tranche, $newDispo)
{ {
$existedTranche = 'SELECT aDisponibilite FROM `activite` $existedTranche = 'SELECT aDisponibilite FROM activite
WHERE aCis = ' . $cis . ' AND aDateGarde = "' . $jour . '" AND aTranche = ' . $tranche . ' AND aPompier = ' . $idUser . ';'; WHERE aCis = ' . $cis . ' AND aDateGarde = "' . $jour . '" AND aTranche = ' . $tranche . ' AND aPompier = ' . $idUser . ';';
$rs = PdoBD::$monPdo->query($existedTranche); $rs = PdoBD::$monPdo->query($existedTranche);
var_dump($rs); var_dump($rs);
@ -152,13 +174,26 @@ class PdoBD
/** /**
* Met à jour une ligne de la table pompier * Met à jour une ligne de la table pompier
*/ */
public function majPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire) public function majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire)
{ {
$grade = 7;
$type = 2;
$statut = 2;
date_default_timezone_set('Europe/Paris');
$dateUpdate = date('y-m-d h:i:s');
$req = " $req = "
UPDATE pompier
SET pCis ='$cis', pId ='$pId',
pNom ='$nom', pPrenom ='$prenom',
pStatut ='$statut', pType ='$type',
pMail ='$mail', pLogin ='$login',
pMdp ='$mdp', pAdresse ='$adresse',
pCp ='$cp', pVille ='$ville',
pBip ='$tel', pGrade ='$grade',
pCommentaire ='$commentaire', pDateModif ='$dateUpdate'
WHERE pCis='$cis' AND pId = '$pId'
;"; ;";
$rs = PdoBD::$monPdo->exec($req); $rs = PdoBD::$monPdo->exec($req);
if ($rs === false) { if ($rs === false) {
@ -183,12 +218,19 @@ class PdoBD
/** /**
* ajoute une ligne dans la table pompier * ajoute une ligne dans la table pompier
*/ */
public function ajoutPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire) public function ajoutPompier($cis, $id, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire)
{ {
$req = "INSERT INTO pompier $req = "INSERT INTO pompier
(pCis,pId,pNom,pPrenom,pStatut,pMail,pLogin,pMdp,pGrade,pType, pAdresse,pCp,pVille,pBip,pCommentaire,pDateEnreg,pDateModif) (pCis,pId,pNom,pPrenom,pStatut,pMail,pLogin,pMdp,pGrade,pType, pAdresse,pCp,pVille,pBip,pCommentaire, pNbGardes, pDateEnreg, pDateModif)
VALUES VALUES
( (" . $cis . ", " . $id . ",
'" . $nom . "', '" . $prenom . "',
" . $statut . ", '" . $mail . "',
'" . $login . "', '" . $mdp . "',
" . $grade . ", " . $type . ",
'" . $adresse . "', " . $cp . ",
'" . $ville . "', '" . $tel . "',
'" . $commentaire . "',0 ,CURRENT_DATE, CURRENT_DATE
);"; );";
$rs = PdoBD::$monPdo->exec($req); $rs = PdoBD::$monPdo->exec($req);
if ($rs === false) { if ($rs === false) {
@ -202,7 +244,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 +274,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 <> "*") {
@ -501,6 +545,32 @@ class PdoBD
return $lesLignes; return $lesLignes;
} }
public function getLastId($pCis) : int
{
$req = "SELECT MAX(pId) + 1 as id FROM pompier WHERE pCis =" . $pCis . ";";
$rs = PdoBD::$monPdo->query($req);
if ($rs === false) {
afficherErreurSQL("Erreur de lma requete pour l'id ajouter", $req, PdoBD::$monPdo->errorInfo());
}
$id = $rs->fetch();
return $id["id"];
}
public function verifDataAjoutPompier(
string $nom,
string $prenom,
string $tel,
string $mail,
string $login
) : bool {
if (empty($nom) || empty($prenom) || empty($tel) || empty($mail) || empty($login)) {
return false;
} else {
return true;
}
}
} }
?> ?>

View File

@ -125,7 +125,9 @@ function estTableauEntiers($tabEntiers)
$ok = true; $ok = true;
foreach($tabEntiers as $unEntier) foreach($tabEntiers as $unEntier)
{ {
if(!estEntierPositif($unEntier)){$ok=false;} if(!estEntierPositif($unEntier)){
$ok=false;
}
} }
return $ok; return $ok;
} }

View File

@ -195,7 +195,7 @@ function format_euro(valeur) {
// ========================= affiche l'onglet choisi // ========================= affiche l'onglet choisi
function Affiche(ongletChoisi, nb) function Affiche(ongletChoisi, nb)
{ {
for(i=1;i<nb+1;i++) for(i = 1; i < nb+1; i++)
{ {
document.getElementById('onglet'+i).className = 'inactif onglet'; document.getElementById('onglet'+i).className = 'inactif onglet';
document.getElementById('contenuOnglet'+i).style.display = 'none'; document.getElementById('contenuOnglet'+i).style.display = 'none';
@ -203,9 +203,9 @@ function format_euro(valeur) {
document.getElementById('onglet'+ongletChoisi).className = 'actif onglet'; document.getElementById('onglet'+ongletChoisi).className = 'actif onglet';
document.getElementById('contenuOnglet'+ongletChoisi).style.display = 'block'; document.getElementById('contenuOnglet'+ongletChoisi).style.display = 'block';
document.getElementById('zOnglet').value=ongletChoisi; document.getElementById('zOnglet').value = ongletChoisi;
document.getElementById('zNbOnglets').value=nb; document.getElementById('zNbOnglets').value=nb;
ongletActif=ongletChoisi; ongletActif = ongletChoisi;
} }
// ========================= transfert des données d'une liste à une autre // ========================= transfert des données d'une liste à une autre
function deplacer_elements(frm, origine, destination) { function deplacer_elements(frm, origine, destination) {
@ -321,6 +321,7 @@ $(document).on('click', '.click-garde', function () {
idPompier = $(this).attr('id').split('/')[2] idPompier = $(this).attr('id').split('/')[2]
garde = 0; garde = 0;
if ($(this).css('background-color') != "rgb(255, 0, 0)") {
if ($(this).text() == 'X') { if ($(this).text() == 'X') {
$(this).text(''); $(this).text('');
garde = 0; garde = 0;
@ -348,4 +349,90 @@ $(document).on('click', '.click-garde', function () {
console.error("Erreur lors de la requête AJAX :", status, error); console.error("Erreur lors de la requête AJAX :", status, error);
} }
}); });
}
}) })
/**
* Modifier
*/
$(document).on('click', '.btn-modif', function (e) {
e.preventDefault();
if ($(this).attr('id') == 'zModifChef'){ //si le bouton modifier est celui du chef ou nom
element = $('.infoPompier-chef')
} else {
element = $('.infoPompier')
}
if (element.attr('disabled') == 'disabled') {
element.attr('disabled', false);
$('.btn-valid-modif').css('display', 'block');
} else {
element.attr('disabled', true);
$('.btn-valid-modif').css('display', 'none');
}
})
$(document).on('click', '.btn-valid-modif', function (e) {
e.preventDefault();
$('.infoPompier-chef').attr('disabled', false);
data = $('.dataPompier').serialize()
$('.infoPompier-chef').attr('disabled', true);
$('.infoPompier').attr('disabled', true);
$('.btn-valid-modif').css('display', 'none');
$.ajax({
url: "/controleurs/c_pompiers.php?action=validerModifier", // URL de l'API ou de la ressource
method: "POST", // Méthode HTTP (GET, POST, etc.)
dataType: "json", // Type de données attendu
data : data,
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);
}
});
})
/**
* Ajout d'un pompier
*/
$(document).on('submit', '.dataPompierAjout', function (e) {
e.preventDefault();
$('#inputDisabled').attr('disabled', false);
data = $('.dataPompierAjout').serialize()
$('#inputDisabled').attr('disabled', true);
$.ajax({
url: "/controleurs/c_pompiers.php?action=validerAjouter",
method: "POST", // Méthode HTTP (GET, POST, etc.)
dataType: "json", // Type de données attendu
data : data,
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);
},
success: function(result) {
$('.dataPompierAjout').trigger("reset"); ;
$('.notif-ajout').html(result['success'])
}
});
});
$(document).on('click', '.btAnnulerAjout', function (e) {
e.preventDefault();
window.location.href = "http://sdis29-1/index.php?choixTraitement=pompiers&action=voir&type=a";
})
$(document).ready(function(){
$('#newName, #newUsername').change(function() {
newUserName = $('#newUsername').val()[0].toLowerCase();
if (newUserName == undefined) {
newUserName = '';
}
newName = $('#newName').val().toUpperCase();
$('#newLogin').val(newUserName+newName)
});
});

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

@ -12,7 +12,7 @@ if ($_SESSION['statut'] == 1) {
$choix = $_SESSION['idUtilisateur']; $choix = $_SESSION['idUtilisateur'];
} else { } else {
echo ' echo '
<select name="lstPompiers" STYLE="width:350px;" onchange="submit();">'; <select name="lstPompiers" STYLE="width:auto;" onchange="submit();">';
if (!isset($_REQUEST['lstPompiers'])) { if (!isset($_REQUEST['lstPompiers'])) {
$choix = $_SESSION['idUtilisateur']; $choix = $_SESSION['idUtilisateur'];
@ -44,7 +44,7 @@ echo ('
if ($_SESSION['statut'] == 2) {?> if ($_SESSION['statut'] == 2) {?>
<input type="image" id="zNouveau" title="Ajouter" src="images/ajout.gif" onclick="faire('choixP', 'ajouter')"> <input type="image" id="zNouveau" title="Ajouter" src="images/ajout.gif" onclick="faire('choixP', 'ajouter')">
<input type="image" id="zModif" title="Modifier" src="images/modif.gif" onclick="faire('choixP', 'modifier')"> <input type="image" class="btn-modif" id="zModifChef" title="Modifier" src="images/modif.gif">
<input type="image" id="zSupprime" title="Supprimer" src="images/supprimer.gif" onclick="faire('choixP', 'supprimer')">&nbsp;&nbsp; <input type="image" id="zSupprime" title="Supprimer" src="images/supprimer.gif" onclick="faire('choixP', 'supprimer')">&nbsp;&nbsp;
<input type="image" id="zPremier" title="premier" src="images/goPremier.gif" onclick="premier('choixP','lstPompiers')"> <input type="image" id="zPremier" title="premier" src="images/goPremier.gif" onclick="premier('choixP','lstPompiers')">
<input type="image" id="zPrecedent" title="précédent" src="images/goPrecedent.gif" onclick="precedent('choixP','lstPompiers')"> <input type="image" id="zPrecedent" title="précédent" src="images/goPrecedent.gif" onclick="precedent('choixP','lstPompiers')">
@ -54,13 +54,18 @@ if ($_SESSION['statut'] == 2) {?>
<input type="image" id="zSuivant" title="suivant" src="images/goSuivant.gif" onclick="suivant('choixP','lstPompiers')"> <input type="image" id="zSuivant" title="suivant" src="images/goSuivant.gif" onclick="suivant('choixP','lstPompiers')">
<input type="image" id="zDernier" title="dernier" src="images/goDernier.gif" onclick="dernier('choixP','lstPompiers')"> <input type="image" id="zDernier" title="dernier" src="images/goDernier.gif" onclick="dernier('choixP','lstPompiers')">
<?php <?php
} else { } else {
echo ' echo '
<input type="image" id="zModif" title="Modifier" src="images/modif.gif" onclick="faire(\'choixP\', \'modifier\')">'; <input type="image" class="btn-modif" id="zModif" title="Modifier" src="images/modif.gif">';
}?> }?>
</div> </div>
<input type="hidden" name="action" value="<?php if($_REQUEST['action']=="liste") {echo "voir";} else {echo $_REQUEST['action'];}?>"> <input type="hidden" name="action" value="<?php
if($_REQUEST['action'] == "liste") {
echo "voir";
} else {
echo $_REQUEST['action'];
}?>">
<input type="hidden" name="type" value="<?= isset($_REQUEST['type']) ? $_REQUEST['type'] : '';?>"> <input type="hidden" name="type" value="<?= isset($_REQUEST['type']) ? $_REQUEST['type'] : '';?>">
<input type="hidden" name="zType" value="*"> <input type="hidden" name="zType" value="*">
<input type="hidden" name="zIndice" value="*"> <input type="hidden" name="zIndice" value="*">

View File

@ -4,6 +4,7 @@
<head> <head>
<title>SDIS29</title> <title>SDIS29</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link href="./styles/styles.css" rel="stylesheet" type="text/css" /> <link href="./styles/styles.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico" /> <link rel="shortcut icon" type="image/x-icon" href="./images/favicon.ico" />
@ -20,7 +21,7 @@
$champ = $_REQUEST['zChamp']; $champ = $_REQUEST['zChamp'];
} }
?> ?>
<body onload="donner_focus('<?= $formulaire . ',' . $champ;?>');"> <body >
<div id="page"> <div id="page">
<div id="entete"> <div id="entete">
<img src="./images/logo.png" id="logo" alt="SDIS29" title="SDIS 29" /> <img src="./images/logo.png" id="logo" alt="SDIS29" title="SDIS 29" />

View File

@ -1,62 +1,63 @@
<!-- affichage du detail de la fiche pompier / Derniere modification le 18 septembre 2023 par Pascal Blain --> <!-- affichage du detail de la fiche pompier / Derniere modification le 18 septembre 2023 par Pascal Blain -->
<!-- ------------------------------------------------ fenetre modale en CSS --> <!-- ------------------------------------------------ fenetre modale en CSS -->
<style> <style>
.fModale { .fModale {
position : fixed; position: fixed;
font-family : Arial, Helvetica, sans-serif; font-family: Arial, Helvetica, sans-serif;
top : 0; top: 0;
right : 0; right: 0;
bottom : 0; bottom: 0;
left : 0; left: 0;
background : rgba(0,0,0,0.8); background: rgba(0, 0, 0, 0.8);
z-index : 99999; z-index: 99999;
//display : none; //display : none;
opacity : 0; opacity: 0;
-webkit-transition: opacity 400ms ease-in; -webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in; -moz-transition: opacity 400ms ease-in;
transition : opacity 400ms ease-in; transition: opacity 400ms ease-in;
pointer-events: none; pointer-events: none;
} }
.fModale:target { .fModale:target {
//display : block; //display : block;
opacity : 1; opacity: 1;
pointer-events: auto; pointer-events: auto;
} }
.fModale > div { .fModale>div {
width : 200px; width: 200px;
position : relative; position: relative;
margin : 10% auto; margin: 10% auto;
padding : 5px 20px 13px 20px; padding: 5px 20px 13px 20px;
border-radius: 10px; border-radius: 10px;
background : #fff; background: #fff;
background : -moz-linear-gradient(#fff, #999); background: -moz-linear-gradient(#fff, #999);
background : -webkit-linear-gradient(#fff, #999); background: -webkit-linear-gradient(#fff, #999);
background : -o-linear-gradient(#fff, #999); background: -o-linear-gradient(#fff, #999);
} }
.fermer { .fermer {
background : #606061; background: #606061;
color : #FFFFFF; color: #FFFFFF;
line-height : 25px; line-height: 25px;
position : absolute; position: absolute;
right : -12px; right: -12px;
text-align : center; text-align: center;
top : -10px; top: -10px;
width : 24px; width: 24px;
text-decoration: none; text-decoration: none;
font-weight : bold; font-weight: bold;
-webkit-border-radius: 12px; -webkit-border-radius: 12px;
-moz-border-radius: 12px; -moz-border-radius: 12px;
border-radius: 12px; border-radius: 12px;
-moz-box-shadow: 1px 1px 3px #000; -moz-box-shadow: 1px 1px 3px #000;
-webkit-box-shadow: 1px 1px 3px #000; -webkit-box-shadow: 1px 1px 3px #000;
box-shadow : 1px 1px 3px #000; box-shadow: 1px 1px 3px #000;
} }
.fermer:hover { background: #00d9ff; } .fermer:hover {
background: #00d9ff;
}
</style> </style>
<?php <?php
/*----------------------------------------------------------------- /*-----------------------------------------------------------------
@ -78,36 +79,43 @@ $titre3 = ($_SESSION['statut'] == 1) ? "Mon profil" : "Profil";
echo (' echo ('
<div id="fiche"> <div id="fiche">
<ul class="lesOnglets"> <ul class="lesOnglets">
<li class="actif onglet" id="onglet1" onclick="javascript:Affiche(\'1\',3);">'.$titre1.'</li> <li class="actif onglet" id="onglet1" onclick="javascript:Affiche(\'1\',3);">' . $titre1 . '</li>
<li class="inactif onglet" id="onglet2" onclick="javascript:Affiche(\'2\',3);">'.$titre2.'</li> <li class="inactif onglet" id="onglet2" onclick="javascript:Affiche(\'2\',3);">' . $titre2 . '</li>
<li class="inactif onglet" id="onglet3" onclick="javascript:Affiche(\'3\',3);">'.$titre3.'</li> <li class="inactif onglet" id="onglet3" onclick="javascript:Affiche(\'3\',3);">' . $titre3 . '</li>
</ul>'); </ul>');
/*================================================================================================== DISPONIBILITEES (1) */ /*================================================================================================== DISPONIBILITEES (1) */
echo (" echo ("
<div style='display: block;' class='unOnglet' id='contenuOnglet1'> <div style='display: block;' class='unOnglet' id='contenuOnglet1'>
<fieldset><legend>X indique une garde</legend>"); ?> <fieldset><legend>X indique une garde</legend>"); ?>
<!-- div class="boite" style="margin: 0px 10px;" --> <!-- div class="boite" style="margin: 0px 10px;" -->
<form name="frmDispos" action="index.php?choixTraitement=pompiers&action=voir" method="post"> <form name="frmDispos" action="index.php?choixTraitement=pompiers&action=voir" method="post">
<input type="hidden" maxlength="2" name="zSemaine" value='<?php echo $semaine;?>'> <input type="hidden" maxlength="2" name="zSemaine" value='<?php echo $semaine; ?>'>
<input type="hidden" maxlength="2" name="zAnnee" value='<?php echo $annee;?>'> <input type="hidden" maxlength="2" name="zAnnee" value='<?php echo $annee; ?>'>
</form> </form>
<table id="tableau" class="tableau"> <table id="tableau" class="tableau">
<tbody> <tbody>
<!-- PARTIE SELCTION SEMAINE --> <!-- PARTIE SELCTION SEMAINE -->
<tr> <tr>
<th><input id="sPrecedente" name="gauche" title="semaine précédente" src="images/gauche.gif" onclick="autreSemaine('<?php echo date('W',strtotime("-7 days",$premierJour))."', '".date('Y',strtotime("-7 days",$premierJour))?>')" onmouseover="document.gauche.src='images/gauche_.gif'" onmouseout="document.gauche.src='images/gauche.gif'"type="image"></th> <th><input id="sPrecedente" name="gauche" title="semaine précédente" src="images/gauche.gif"
onclick="autreSemaine('<?php echo date('W', strtotime("-7 days", $premierJour)) . "', '" . date('Y', strtotime("-7 days", $premierJour)) ?>')"
onmouseover="document.gauche.src='images/gauche_.gif'"
onmouseout="document.gauche.src='images/gauche.gif'" type="image"></th>
<th colspan="26"><b><big>Semaine <?php echo $semaine." : du lundi ".date('d/m/Y',$premierJour)." au dimanche ".date('d/m/Y',strtotime("6 days",$premierJour))."</big></b></th>";?> <th colspan="26"><b><big>Semaine
<?php echo $semaine . " : du lundi " . date('d/m/Y', $premierJour) . " au dimanche " . date('d/m/Y', strtotime("6 days", $premierJour)) . "</big></b></th>"; ?>
<th><input id="sSuivante" name="droite" title="semaine suivante" src="images/droite.gif" onclick="autreSemaine('<?php echo date('W',strtotime("+7 day",$premierJour))."', '".date('Y',strtotime("+7 day",$premierJour));?>')" onmouseover="document.droite.src='images/droite_.gif'" onmouseout="document.droite.src='images/droite.gif'"type="image"></th> <th><input id="sSuivante" name="droite" title="semaine suivante" src="images/droite.gif"
onclick="autreSemaine('<?php echo date('W', strtotime("+7 day", $premierJour)) . "', '" . date('Y', strtotime("+7 day", $premierJour)); ?>')"
onmouseover="document.droite.src='images/droite_.gif'"
onmouseout="document.droite.src='images/droite.gif'" type="image"></th>
</tr> </tr>
<!-- PARTIE AFFICHAGE DES JOURS --> <!-- PARTIE AFFICHAGE DES JOURS -->
<tr> <tr>
<?php <?php
$nomJour = array('Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche'); $nomJour = array('Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi', 'Dimanche');
for($jour = 0; $jour <= 6; $jour++) { for ($jour = 0; $jour <= 6; $jour++) {
echo ('<th colspan="4">' echo ('<th colspan="4">'
. $nomJour[$jour] . ' ' . $nomJour[$jour] . ' '
. date('d/m', strtotime('+' . $jour . ' day', $premierJour)) . '</th>' . date('d/m', strtotime('+' . $jour . ' day', $premierJour)) . '</th>'
@ -119,8 +127,8 @@ echo ("
<!-- PARTIE AFFICHAGE DES TRANCHES DANS CHAQUE JOURS --> <!-- PARTIE AFFICHAGE DES TRANCHES DANS CHAQUE JOURS -->
<tr> <tr>
<?php <?php
for($jour = 0; $jour <= 6; $jour++) { for ($jour = 0; $jour <= 6; $jour++) {
for($tranche = 1; $tranche <= 4; $tranche++) { for ($tranche = 1; $tranche <= 4; $tranche++) {
echo '<th class="semaine" style="text-align : center;">' . $tranche . '</th>'; echo '<th class="semaine" style="text-align : center;">' . $tranche . '</th>';
} }
} }
@ -131,14 +139,14 @@ echo ("
<tr> <tr>
<?php <?php
foreach ($lesDispos as $uneLigne) { // $pdo->getDisposHebdo() return les dispo foreach ($lesDispos as $uneLigne) { // $pdo->getDisposHebdo() return les dispo
for($jour = 0; $jour <= 6; $jour++) { for ($jour = 0; $jour <= 6; $jour++) {
$leJour = date('Y-m-d', strtotime('+' . $jour . ' day', $premierJour)); $leJour = date('Y-m-d', strtotime('+' . $jour . ' day', $premierJour));
$dateTab = date('d/m/Y', strtotime('+' . $jour . ' day', $premierJour)); $dateTab = date('d/m/Y', strtotime('+' . $jour . ' day', $premierJour));
for($tranche = 1; $tranche <= 4; $tranche++){ for ($tranche = 1; $tranche <= 4; $tranche++) {
$couleur = 'c' . $tranche; $couleur = 'c' . $tranche;
$garde = 'g' . $tranche; $garde = 'g' . $tranche;
$dispo = 'd' . $tranche; $dispo = 'd' . $tranche;
echo(' echo ('
<td style="height: 20px; background-color: ' . $uneLigne[$dateTab][$couleur] . ';" class="select-dispo" id="' . $leJour . '/' . $tranche . '">' . (($uneLigne[$dateTab][$garde] == 1) ? 'X' : '') . '</td> <td style="height: 20px; background-color: ' . $uneLigne[$dateTab][$couleur] . ';" class="select-dispo" id="' . $leJour . '/' . $tranche . '">' . (($uneLigne[$dateTab][$garde] == 1) ? 'X' : '') . '</td>
'); ');
} }
@ -147,24 +155,24 @@ echo ("
?> ?>
</tr> </tr>
</tbody> </tbody>
</table> </table>
<div id="fenetreDispo" class="fModale"> <div id="fenetreDispo" class="fModale">
<div> <div>
<a href="#" title="Fermer" class="fermer">X</a> <a href="#" title="Fermer" class="fermer">X</a>
<h2>ma disponibilit&eacute;<br>pour le <label id="ztJour">&nbsp;</label></h2> <h2>ma disponibilit&eacute;<br>pour le <label id="ztJour">&nbsp;</label></h2>
<form name="frmActivites" action="index.php?choixTraitement=pompiers&action=majActivite" method="post"> <form name="frmActivites" action="index.php?choixTraitement=pompiers&action=majActivite" method="post">
<input type="hidden" name="zSemaine" value='<?php echo $semaine;?>'> <input type="hidden" name="zSemaine" value='<?php echo $semaine; ?>'>
<input type="hidden" name="zAnnee" value='<?php echo $annee;?>'> <input type="hidden" name="zAnnee" value='<?php echo $annee; ?>'>
<input type="hidden" name="ztLaDate" value=''> <input type="hidden" name="ztLaDate" value=''>
<input type="hidden" name="ztLaTranche" value=''> <input type="hidden" name="ztLaTranche" value=''>
<input type="hidden" name="ztExDispo" value=''> <input type="hidden" name="ztExDispo" value=''>
<br> <br>
<?php <?php
$i=0; $i = 0;
foreach ($lesTypesDispos as $uneLigne) foreach ($lesTypesDispos as $uneLigne) {
{ if ($uneLigne["pIndice"] <> 3) {
if ($uneLigne["pIndice"]<>3) { echo '<input type="radio" name="brDispo" id="brDispo' . $i . '" value="' . $uneLigne["pIndice"] . '"/><label for="brDispo' . $i . '">' . $uneLigne["pLibelle"] . '</label><br>';
echo '<input type="radio" name="brDispo" id="brDispo'.$i.'" value="'.$uneLigne["pIndice"].'"/><label for="brDispo'.$i.'">'.$uneLigne["pLibelle"].'</label><br>';} }
$i++; $i++;
} }
?> ?>
@ -173,8 +181,8 @@ echo ("
<button href="#contenuOnglet1">Annuler</button> <button href="#contenuOnglet1">Annuler</button>
</form> </form>
</div> </div>
</div> </div>
<!-- /div --> <!-- /div -->
<?php <?php
echo (" echo ("
</fieldset> </fieldset>
@ -183,34 +191,44 @@ echo ("
echo (" echo ("
<div style='display: none;' class='unOnglet' id='contenuOnglet2'> <div style='display: none;' class='unOnglet' id='contenuOnglet2'>
<fieldset><legend>Gardes r&eacute;alis&eacute;es "); <fieldset><legend>Gardes r&eacute;alis&eacute;es ");
if (count($lesGardes)==0) {echo "<i>(aucune garde enregistrée)</i></legend>";} else if (count($lesGardes) == 0) {
{ echo "<i>(aucune garde enregistrée)</i></legend>";
echo ("<i>(".count($lesGardes)." gardes)</i></legend> } else {
echo ("<i>(" . count($lesGardes) . " gardes)</i></legend>
<table style='border: 0px solid white;'> <table style='border: 0px solid white;'>
<tr><th class='controleLong'>Date de la garde</th>"); <tr><th class='controleLong'>Date de la garde</th>");
foreach ($lesTranches as $uneLigne) { echo ("<th>".$uneLigne['pLibelle']."</th>");} foreach ($lesTranches as $uneLigne) {
$dateGarde="premiere"; echo ("<th>" . $uneLigne['pLibelle'] . "</th>");
$colonne=1; }
$dateGarde = "premiere";
$colonne = 1;
echo "</tr>"; echo "</tr>";
foreach ($lesGardes as $uneLigne)
{ foreach ($lesGardes as $uneLigne) {
if ($dateGarde != $uneLigne['wDate']) if ($dateGarde != $uneLigne['wDate']) {
{ if ($dateGarde != "premiere") {
if ($dateGarde != "premiere") while ($colonne <= count($lesTranches)) {
{ echo "<td class='controle' style='text-align : center;'>&nbsp;</td>";
while ($colonne<=count($lesTranches)) {echo "<td class='controle' style='text-align : center;'>&nbsp;</td>"; $colonne++;} $colonne++;
}
echo "</tr> echo "</tr>
"; ";
} }
echo "<tr><td class='controle' style='text-align : center;'>".$uneLigne['wDate']."</td>"; echo "<tr><td class='controle' style='text-align : center;'>" . $uneLigne['wDate'] . "</td>";
$dateGarde = $uneLigne['wDate']; $dateGarde = $uneLigne['wDate'];
$colonne=1; $colonne = 1;
}
while ($colonne < $uneLigne['aTranche']) {
echo "<td class='controle' style='text-align : center;'>&nbsp;</td>";
$colonne++;
} }
while ($colonne<$uneLigne['aTranche']) {echo "<td class='controle' style='text-align : center;'>&nbsp;</td>"; $colonne++;}
echo ("<td class='controle' style='text-align : center;background-color : lime;'>&nbsp;</td>"); echo ("<td class='controle' style='text-align : center;background-color : lime;'>&nbsp;</td>");
$colonne=$uneLigne['aTranche']+1; $colonne = $uneLigne['aTranche'] + 1;
}
while ($colonne <= count($lesTranches)) {
echo "<td class='controle' style='text-align : center;'>&nbsp;</td>";
$colonne++;
} }
while ($colonne<=count($lesTranches)) {echo "<td class='controle' style='text-align : center;'>&nbsp;</td>"; $colonne++;}
echo "</tr>"; echo "</tr>";
echo ("</table>"); echo ("</table>");
} }
@ -218,41 +236,80 @@ echo ("
</fieldset> </fieldset>
</div>"); </div>");
/*================================================================================================== COORDONNEES (3) */ /*================================================================================================== COORDONNEES (3) */
echo (" echo ("
<div style='display: none;' class='unOnglet' id='contenuOnglet3'> <div style='display: none;' class='unOnglet' id='contenuOnglet3'>
<form class='dataPompier' method='post'>
<table style='border: 0px solid white;'> <table style='border: 0px solid white;'>
<tr> <tr>
<td style='border :0px;'> <td style='border :0px;'>
<fieldset><legend>Coordonn&eacute;es</legend> <fieldset><legend>Coordonn&eacute;es</legend>
<table> <table>
<tr><th style='width:130px;'>Nom</th> <td style='width:130px;'>".$lesInfosPompier['nom']."</td> </tr> <tr><th style='width:130px;'>Nom</th> <td style='width:130px;'><input name='ztNom' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['nom'] . "' disabled></td> </tr>
<tr><th>Pr&eacute;nom</th> <td>".$lesInfosPompier['prenom']."</td> </tr> <tr><th>Pr&eacute;nom</th> <td> <input name='ztPrenom' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['prenom'] . "' disabled></td> </tr>
<tr><th>Adresse</th> <td>".$lesInfosPompier['pAdresse']."</td> </tr> <tr><th>Adresse</th> <td> <input name='ztAdresse' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pAdresse'] . "' disabled></td> </tr>
<tr><th>Code postal</th> <td>".$lesInfosPompier['pCp']."</td> </tr> <tr><th>Code postal</th> <td> <input name='ztCodePostal' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pCp'] . "' disabled></td> </tr>
<tr><th>Ville</th> <td>".$lesInfosPompier['pVille']."</td> </tr> <tr><th>Ville</th> <td> <input name='ztVille' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pVille'] . "' disabled></td> </tr>
<tr><th>T&eacute;l&eacute;phone</th> <td>".$lesInfosPompier['pBip']."</td> </tr> <tr><th>T&eacute;l&eacute;phone</th> <td> <input name='ztTel' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pBip'] . "' disabled></td> </tr>
<tr><th>Adresse &eacute;lectronique</th> <td>".$lesInfosPompier['pMail']."</td> </tr> <tr><th>Adresse &eacute;lectronique</th> <td> <input name='ztMail' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pMail'] . "' disabled></td> </tr>
<tr><th>Nom de compte</th> <td>".$lesInfosPompier['pLogin']."</td></tr> <tr><th>Nom de compte</th> <td>" . $lesInfosPompier['pLogin'] . "</td></tr>
<tr><th>&nbsp;</th> <td>&nbsp;</td> </tr> <input name='pId' type='hidden' class='infoPompier' value='" . $lesInfosPompier['id'] . "' disabled>
<br />"); <br />");
echo (" </table> echo ("
</table>
</fieldset> </fieldset>
</td> </td>
<td style='border :0px;'> <td style='border :0px;'>
<fieldset><legend>Centre d'Incendie et de Secours</legend> <fieldset><legend>Centre d'Incendie et de Secours</legend>
<table> <table>
<tr><th style='width:130px;'>Code</th> <td>".$lesInfosPompier['pCis']."</td> </tr> <tr><th style='width:130px;'>Code</th> <td><input name='zCis' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pCis'] . "' disabled></td> </tr>
<tr><th>Nom</th> <td>".$lesInfosPompier['cNom']."</td> </tr> <tr><th>Nom</th> <td>" . $lesInfosPompier['cNom'] . "</td> </tr>
<tr><th>Adresse</th> <td>".$lesInfosPompier['cAdresse']."</td> </tr> <tr><th>Adresse</th> <td>" . $lesInfosPompier['cAdresse'] . "</td> </tr>
<tr><th>T&eacute;l&eacute;phone</th> <td>".$lesInfosPompier['cTel']."</td> </tr> <tr><th>T&eacute;l&eacute;phone</th> <td>" . $lesInfosPompier['cTel'] . "</td> </tr>
<tr><th>Groupement</th> <td>".$lesInfosPompier['cGroupement']."</td> </tr> <tr><th>Groupement</th> <td>" . $lesInfosPompier['cGroupement'] . "</td> </tr>
</table> </table>
</fieldset> </fieldset>
<fieldset><legend>Fonction</legend> <fieldset><legend>Fonction</legend>
<table> <table>
<tr><th>Type</th> <td>".$lesInfosPompier['wType']."</td> </tr> <tr><th>Type</th> <td>
<tr><th>Grade</th> <td>".$lesInfosPompier['wGrade']."</td> </tr> <select name='lstType' class='infoPompier-chef' disabled>");
<tr><th>Statut</th> <td>".$lesInfosPompier['wStatut']."</td> </tr> </table> foreach ($pdo->getParametre('typePer') as $key => $value) {
if ($lesInfosPompier['wType'] == $value['pLibelle']) {
echo ("<option value=" . $value['pIndice'] . " selected> " . $value['pLibelle'] . "</option>");
} else {
echo ("<option value=" . $value['pIndice'] . "> " . $value['pLibelle'] . "</option>");
}
}
echo ("</td> </tr>
<tr><th>Grade</th> <td>
<select name='lstGrade' class='infoPompier-chef' disabled>");
foreach ($pdo->getParametre('grade') as $key => $value) {
if ($lesInfosPompier['wGrade'] == $value['pLibelle']) {
echo ("<option value=" . $value['pIndice'] . " selected> " . $value['pLibelle'] . "</option>");
} else {
echo ("<option value=" . $value['pIndice'] . "> " . $value['pLibelle'] . "</option>");
}
}
echo ("</td> </tr>
<tr><th>Statut</th> <td>
<select name='lstStatut' class='infoPompier-chef' disabled>");
foreach ($pdo->getParametre('statAgt') as $key => $value) {
if ($lesInfosPompier['wStatut'] == $value['pLibelle']) {
echo ("<option value=" . $value['pIndice'] . " selected> " . $value['pLibelle'] . "</option>");
} else {
echo ("<option value=" . $value['pIndice'] . "> " . $value['pLibelle'] . "</option>");
}
}
echo ("</td> </tr>
</td> </tr>
</table>
</fieldset></td> </fieldset></td>
</tr> </tr>
</table> </table>
@ -260,12 +317,15 @@ echo (" </table>
<fieldset><legend>Observations</legend> <fieldset><legend>Observations</legend>
<table style='border: 0px solid white;'> <table style='border: 0px solid white;'>
<tr> <tr>
<td>.".$lesInfosPompier['pCommentaire']."</td> <td> <input name='ztObservation' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pCommentaire'] . "' disabled></td></td>
</tr> </tr>
</table> </table>
</fieldset> </fieldset>
</div>"); </form>
<input type='image' class='btn-valid-modif' id='validModif' title='Modifier' src='images/valider.jpg' style='display:none; margin: 0 auto;'>
</div>
");
/*================================================================================================== Onglet X */ /*================================================================================================== Onglet X */
echo (" echo ("
<div style='display: none;' class='unOnglet' id='contenuOngletX'> <div style='display: none;' class='unOnglet' id='contenuOngletX'>

View File

@ -19,13 +19,23 @@
<?php <?php
echo (" <table> echo (" <table>
<tr> <th>Indice</th> <td>"); <tr> <th>Indice</th> <td>");
if ($action==="ajouter") {echo "<input class='controle' type='text' name='valeur' value='".$infosParam['pIndice']."'>";} if ($action === "ajouter") {
else {echo $infosParam['pIndice'];} echo "<input class='controle' type='text' name='valeur' value='" . $infosParam['pIndice'] . "'>";
} else {
echo $infosParam['pIndice'];
}
echo (" </td> </tr> echo (" </td> </tr>
<tr> <th>Valeur</th> <td>"); <tr> <th>Valeur</th> <td>");
if ($action==="ajouter") {echo "<input class='controle' type='text' name='zLibelle'>";$actif=null;} if ($action === "ajouter") {
if ($action==="modifier") {echo "<input class='controleLong' type='text' name='zLibelle' value='".$infosParam['pLibelle']."'>";$actif=null;} echo "<input class='controle' type='text' name='zLibelle'>";
if ($action==="supprimer") {echo $infosParam['pLibelle'];$actif="disabled='disabled'";} $actif = null;
} else if ($action === "modifier") {
echo "<input class='controleLong' type='text' name='zLibelle' value='" . $infosParam['pLibelle'] . "'>";
$actif = null;
} else if ($action === "supprimer") {
echo $infosParam['pLibelle'];
$actif = "disabled='disabled'";
}
echo (" </td> </tr>"); echo (" </td> </tr>");
echo (" echo ("
<tr> <th>Plancher</th> <td><input class='controle' type='text' name='zPlancher' value='".$infosParam['pPlancher']."'></td> </tr> <tr> <th>Plancher</th> <td><input class='controle' type='text' name='zPlancher' value='".$infosParam['pPlancher']."'></td> </tr>
@ -39,7 +49,7 @@ echo ("
</table> </table>
</div> </div>
<p align="right"> <p style='margin: 0 auto;'>
<input type="hidden" name="zOk" value="OK"> <input type="hidden" name="zOk" value="OK">
<input type="image" name="btValider" alt="Valider" src="images/valider.jpg" onclick="this.form.submit();"> <input type="image" name="btValider" alt="Valider" src="images/valider.jpg" onclick="this.form.submit();">
<input type="image" name="btAnnuler" alt="Annuler" src="images/annuler.jpg" onclick="annuler('frmParam');"> <input type="image" name="btAnnuler" alt="Annuler" src="images/annuler.jpg" onclick="annuler('frmParam');">

View File

@ -1,19 +1,43 @@
<!-- 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") { /**
echo '<h2>SUPPRESSION DU POMPIER '.$lesInfosPompier['nom'].' '.$lesInfosPompier['prenom'].'</h2>'; * Boutons d'action a coté du nom
echo '<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerSupprimer&type='.$lesInfosPompier['pType'].'&agent='.$lesInfosPompier['id'].'&caserne='.$lesInfosPompier['pCis'].'" method="post">'; * *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">');
} }
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['wType'] . '&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 '
<form name="frmA" action="index.php?choixTraitement=pompiers&action=validerAjouter&type='.$lesInfosPompier['pType'].'" method="post" onsubmit="return valider(this)">'; //action = index.php?choixTraitement=pompiers&action=validerAjouter&type=''
} //onsubmit="return valider(this)">
echo('
<form class="dataPompierAjout" name="frmA" action="index.php?choixTraitement=pompiers&action=validerAjouter&type="
method="post"
');
echo (" echo ("
<table style='border: 0px solid white;'> <table style='border: 0px solid white;'>
<tr> <tr>
@ -21,8 +45,7 @@
<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;'>
@ -31,34 +54,90 @@
</tr> </tr>
</table> </table>
"); ");
} }
//------------------------------------------------------------------------------------ cas ajout ou modification //------------------------------------------------------------------------------------ cas ajout ou modification
if ($_REQUEST['action'] == "modifier") { if ($_REQUEST['action'] == "modifier") {
echo (" <tr> echo (" <tr>
</tr> </tr>
</table> </table>
"); ");
} }
if ($_REQUEST['action'] == "ajouter") { if ($_REQUEST['action'] == "ajouter") {
echo (" <tr><th style='width:130px;'>Nom</th> <td style='width:130px;'><input id='ztNom' type='text' name='ztNom'></td> </tr> // <input name='pId' class='infoPompier' value='" . $lesInfosPompier['id'] . "' >
echo ("
<tr><th style='width:130px;'>Nom*</th> <td style='width:130px;'><input name='ztNom' id='newName' type='text' class='infoPompier' required></td> </tr>
<tr><th>Pr&eacute;nom*</th> <td> <input name='ztPrenom' id='newUsername' type='text' class='infoPompier infoPompier-chef' required></td> </tr>
<tr><th>Adresse</th> <td> <input name='ztAdresse' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
<tr><th>Code postal</th> <td> <input name='ztCodePostal' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
<tr><th>Ville</th> <td> <input name='ztVille' type='text' class='infoPompier infoPompier-chef' ></td> </tr>
<tr><th>T&eacute;l&eacute;phone*</th> <td> <input name='ztTel' type='text' class='infoPompier-chef' required></td> </tr>
<tr><th>Adresse &eacute;lectronique*</th> <td> <input name='ztMail' type='text' class='infoPompier infoPompier-chef' required></td> </tr>
<tr><th>Nom de compte*</th> <td><input name='ztLogin' id='newLogin' type='text' class='infoPompier infoPompier-chef' required></td></tr>
<tr><th style='width:130px;'>Code</th> <td><input name='zCis' id='inputDisabled' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pCis'] . "' disabled></td> </tr>
<tr><th>Nom</th> <td>" . $lesInfosPompier['cNom'] . "</td> </tr>
<tr><th>Adresse</th> <td>" . $lesInfosPompier['cAdresse'] . "</td> </tr>
<tr><th>T&eacute;l&eacute;phone</th> <td>" . $lesInfosPompier['cTel'] . "</td> </tr>
<tr><th>Groupement</th> <td>" . $lesInfosPompier['cGroupement'] . "</td> </tr>
<tr><th>Type</th> <td>
<select name='lstType' class='infoPompier-chef'>");
foreach ($pdo->getParametre('typePer') as $key => $value) {
echo ("<option value=" . $value['pIndice'] . "> " . $value['pLibelle'] . "</option>");
}
echo ("</td> </tr>
<tr><th>Grade</th> <td>
<select name='lstGrade' class='infoPompier-chef'>");
foreach ($pdo->getParametre('grade') as $key => $value) {
echo ("<option value=" . $value['pIndice'] . "> " . $value['pLibelle'] . "</option>");
}
echo ("</td> </tr>
<tr><th>Statut</th> <td>
<select name='lstStatut' class='infoPompier-chef'>");
foreach ($pdo->getParametre('statAgt') as $key => $value) {
echo ("<option value=" . $value['pIndice'] . "> " . $value['pLibelle'] . "</option>");
}
echo ("</td> </tr>
<br />"); <br />");
}
?> echo ("
</td> </tr>
</table>
</fieldset></td>
</tr>
</table>
<fieldset><legend>Observations</legend>
<table style='border: 0px solid white;'>
<tr>
<td> <input name='ztObservation' type='text' class='infoPompier' value='" . $lesInfosPompier['pCommentaire'] . "' ></td></td>
</tr>
</table>
</fieldset>
<div style='text-align:center; '>
<p class='notif-ajout' style:'margin: 10px'></p>
<input type= 'image' class='btAnnulerAjout' alt='Annuler' src= 'images/Annuler.jpg'>
<input type= 'image' class='validerAjout' alt='Valider' src= 'images/Valider.jpg'>
</div>
</form>
</div>
<input type='image' class='btn-valid-modif' id='validModif' title='Modifier' src='images/valider.jpg' style='display:none; margin: 0 auto;'>
");
}
}
?>
<table style='border: 0px solid white; '> <table style='border: 0px solid white; '>
<tr> <tr>
<td style='border: 0px solid white;'>
<fieldset><legend>Observations</legend>
<textarea name='ztObs' cols='70' rows='1'></textarea>
</fieldset>
</td>
<td>
<input type="image" name="btValider" alt="Valider" src="images/valider.jpg" value="OK" >
<input type="image" name="btAnnuler" alt="Annuler" src="images/annuler.jpg" value="nonOK" onclick="annuler('frmA');">
</td>
<td style='border: 0px solid white; witdh:130px; text-align:right;'> <td style='border: 0px solid white; witdh:130px; text-align:right;'>
<input type="hidden" name="zTypeAdm" value="<?php// if ($type=="adm") {echo ("true");} else {echo ("false");} ?>"> <input type="hidden" name="zTypeAdm"
value="">
<? // if ($type=="adm") {echo ("true");} else {echo ("false");} ?>
<input type="hidden" name="zOk" value="OK"> <input type="hidden" name="zOk" value="OK">
</td> </td>