Modification du pompier
This commit is contained in:
parent
ea3ea7cb5f
commit
5fdb28c44e
@ -65,8 +65,14 @@ switch ($action) {
|
|||||||
break;
|
break;
|
||||||
case 'validerAjouter':
|
case 'validerAjouter':
|
||||||
case 'validerModifier': {
|
case 'validerModifier': {
|
||||||
var_dump($_REQUEST);
|
var_dump($_REQUEST);
|
||||||
$valeur = $_REQUEST['pId'];
|
|
||||||
|
if (!isset($pdo)) {
|
||||||
|
require_once ("../include/class.pdo.php");
|
||||||
|
$pdo = PdoBD::getPdoBD();
|
||||||
|
}
|
||||||
|
|
||||||
|
$pId = $_REQUEST['pId'];
|
||||||
$nom = addslashes($_REQUEST['ztNom']);
|
$nom = addslashes($_REQUEST['ztNom']);
|
||||||
$prenom = addslashes($_REQUEST['ztPrenom']);
|
$prenom = addslashes($_REQUEST['ztPrenom']);
|
||||||
$type = $_REQUEST['lstType'];
|
$type = $_REQUEST['lstType'];
|
||||||
@ -74,11 +80,12 @@ switch ($action) {
|
|||||||
$statut = $_REQUEST['lstStatut'];
|
$statut = $_REQUEST['lstStatut'];
|
||||||
$cis = $_REQUEST['zCis'];
|
$cis = $_REQUEST['zCis'];
|
||||||
$mail = $_REQUEST['ztMail'];
|
$mail = $_REQUEST['ztMail'];
|
||||||
$login = $_REQUEST['ztLogin'];
|
$login = strtolower($_REQUEST['ztPrenom'][0]) . strtoupper($_REQUEST['ztNom']);
|
||||||
$mdp = md5($_REQUEST['ztMdp']);
|
$mdp = md5($login);
|
||||||
if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") {
|
//$mdp = md5($_REQUEST['ztMdp']);
|
||||||
$mdp = "*";
|
// if ($_REQUEST['brMdp'] == 0 and $action === "validerModifier") {
|
||||||
}
|
// $mdp = "*";
|
||||||
|
// }
|
||||||
$adresse = addslashes($_REQUEST['ztAdresse']);
|
$adresse = addslashes($_REQUEST['ztAdresse']);
|
||||||
|
|
||||||
if (strlen($_REQUEST['ztCodePostal']) > 1) {
|
if (strlen($_REQUEST['ztCodePostal']) > 1) {
|
||||||
@ -88,7 +95,7 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
$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);
|
||||||
@ -98,9 +105,9 @@ switch ($action) {
|
|||||||
$commentaire = addslashes($_REQUEST['ztObservation']);
|
$commentaire = addslashes($_REQUEST['ztObservation']);
|
||||||
|
|
||||||
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, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
|
||||||
} elseif ($action === "validerModifier") {
|
} elseif ($action === "validerModifier") {
|
||||||
$pdo->majPompier($cis, $valeur, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
|
$pdo->majPompier($cis, $pId, $nom, $prenom, $statut, $mail, $login, $mdp, $grade, $type, $adresse, $cp, $ville, $tel, $commentaire);
|
||||||
}
|
}
|
||||||
//header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur);
|
//header('location: index.php?choixTraitement=pompiers&action=voir&lstPompiers=' . $valeur);
|
||||||
break;
|
break;
|
||||||
|
@ -79,10 +79,10 @@ 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
|
$req = "SELECT
|
||||||
pCis,
|
pCis,
|
||||||
pId as id,
|
pId as id,
|
||||||
@ -122,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);
|
||||||
@ -174,14 +174,29 @@ 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'
|
||||||
;";
|
;";
|
||||||
|
var_dump($req);
|
||||||
|
die;
|
||||||
$rs = PdoBD::$monPdo->exec($req);
|
$rs = PdoBD::$monPdo->exec($req);
|
||||||
if ($rs === false) {
|
if ($rs === false) {
|
||||||
afficherErreurSQL("Probleme lors de la mise à jour du pompier dans la base de données.", $req, PdoBD::$monPdo->errorInfo());
|
afficherErreurSQL("Probleme lors de la mise à jour du pompier dans la base de données.", $req, PdoBD::$monPdo->errorInfo());
|
||||||
@ -340,8 +355,8 @@ class PdoBD
|
|||||||
$lesDispos[$pompier][$laDate][$couleur] = $uneLigne['dCouleur'];
|
$lesDispos[$pompier][$laDate][$couleur] = $uneLigne['dCouleur'];
|
||||||
}
|
}
|
||||||
/* echo "<PRE>";
|
/* echo "<PRE>";
|
||||||
print_r($lesDispos);
|
print_r($lesDispos);
|
||||||
echo "</PRE>";*/
|
echo "</PRE>";*/
|
||||||
return $lesDispos;
|
return $lesDispos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
||||||
@ -358,14 +358,22 @@ $(document).on('click', '.click-garde', function () {
|
|||||||
$(document).on('click', '.btn-modif', function (e) {
|
$(document).on('click', '.btn-modif', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
$('.infoPompier').attr('disabled', false);
|
if ($('.infoPompier').attr('disabled') == 'disabled') {
|
||||||
$('.btn-valid-modif').css('display', 'block');
|
$('.infoPompier').attr('disabled', false);
|
||||||
|
$('.btn-valid-modif').css('display', 'block');
|
||||||
|
} else {
|
||||||
|
$('.infoPompier').attr('disabled', true);
|
||||||
|
$('.btn-valid-modif').css('display', 'none');
|
||||||
|
}
|
||||||
})
|
})
|
||||||
$(document).on('click', '.btn-valid-modif', function (e) {
|
$(document).on('click', '.btn-valid-modif', function (e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
||||||
|
$('.infoPompier-chef').attr('disabled', false);
|
||||||
data = $('.dataPompier').serialize()
|
data = $('.dataPompier').serialize()
|
||||||
|
$('.infoPompier-chef').attr('disabled', true);
|
||||||
|
$('.infoPompier').attr('disabled', true);
|
||||||
|
$('.btn-valid-modif').css('display', 'none');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/controleurs/c_pompiers.php?action=validerModifier", // URL de l'API ou de la ressource
|
url: "/controleurs/c_pompiers.php?action=validerModifier", // URL de l'API ou de la ressource
|
||||||
|
@ -20,7 +20,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" />
|
||||||
|
@ -232,7 +232,7 @@ echo ("
|
|||||||
<table>
|
<table>
|
||||||
<tr><th style='width:130px;'>Nom</th> <td style='width:130px;'><input name='ztNom' type='text' class='infoPompier' value='".$lesInfosPompier['nom']."' disabled></td> </tr>
|
<tr><th style='width:130px;'>Nom</th> <td style='width:130px;'><input name='ztNom' type='text' class='infoPompier' value='".$lesInfosPompier['nom']."' disabled></td> </tr>
|
||||||
<tr><th>Prénom</th> <td> <input name='ztPrenom' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['prenom']."' disabled></td> </tr>
|
<tr><th>Prénom</th> <td> <input name='ztPrenom' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['prenom']."' disabled></td> </tr>
|
||||||
<tr><th>Adresse</th> <td> <input name='adress' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pAdresse']."' disabled></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> <input name='ztCodePostal' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pCp']."' disabled></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> <input name='ztVille' type='text' class='infoPompier infoPompier-chef' value='" . $lesInfosPompier['pVille']."' disabled></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éléphone</th> <td> <input name='ztTel' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pBip']."' disabled></td> </tr>
|
<tr><th>Téléphone</th> <td> <input name='ztTel' type='text' class='infoPompier-chef' value='" . $lesInfosPompier['pBip']."' disabled></td> </tr>
|
||||||
@ -267,7 +267,7 @@ echo ("
|
|||||||
<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' value='" . $lesInfosPompier['pCommentaire'] . "' disabled></td></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user