2025-03-22 16:53:35 +01:00
|
|
|
<?php
|
2023-04-11 19:11:26 +02:00
|
|
|
|
|
|
|
$titrePartUn = '???';
|
|
|
|
$titrePartDeux = '???';
|
|
|
|
|
|
|
|
$pageExiste = false;
|
|
|
|
|
|
|
|
$type = NULL;
|
|
|
|
$table = NULL;
|
2025-03-22 16:53:35 +01:00
|
|
|
$idElement = NULL;
|
2023-04-11 19:11:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
if (isset($_GET['type'])){
|
|
|
|
$typeElement = $_GET['type'];
|
|
|
|
switch ($typeElement){
|
|
|
|
case 'ingredient':
|
|
|
|
$type = 'ingredient';
|
|
|
|
$titrePartUn = 'Ingredient';
|
|
|
|
$table = 'Ingredient';
|
|
|
|
$tableliaison = 'RecetteIngredient';
|
|
|
|
$determinant = "l'";
|
|
|
|
break;
|
|
|
|
case 'ustensile':
|
|
|
|
$type = 'ustensile';
|
|
|
|
$titrePartUn = 'Ustensile';
|
|
|
|
$table = 'Ustensile';
|
|
|
|
$tableliaison = 'RecetteUstensile';
|
|
|
|
$determinant = "l'";
|
|
|
|
break;
|
|
|
|
case 'unite':
|
|
|
|
$type = 'unite';
|
|
|
|
$titrePartUn = 'Unite';
|
|
|
|
$table = 'Unite';
|
|
|
|
$determinant = "l'";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (isset($_GET['id'])){
|
|
|
|
$idElement = intval($_GET['id']);
|
|
|
|
|
|
|
|
if (isset($_POST['nom'])){
|
|
|
|
if ($type != 'unite'){
|
|
|
|
$nomNvl = transformeCharsAutorises($_POST['nom']);
|
|
|
|
}
|
|
|
|
$paireColonneValeur = '';
|
|
|
|
if ($type == 'ingredient'){
|
|
|
|
foreach (lANNEE as $mois){
|
|
|
|
$lMoisDispo[$mois] = isset($_POST[$mois]) ? 1 : 0;
|
|
|
|
}
|
|
|
|
foreach ($lMoisDispo as $mois => $dispo){
|
|
|
|
$paireColonneValeur .= $mois . ' = ' . $dispo . ', ';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$paireColonneValeur .= "nom = '$nomNvl' ";
|
|
|
|
$reqNvl = "UPDATE $table SET $paireColonneValeur WHERE id = $idElement;";
|
|
|
|
mysqli_query($c, $reqNvl);
|
|
|
|
}
|
|
|
|
|
2025-03-22 16:53:35 +01:00
|
|
|
$infoElement = ($table) ? getElementWithElementId($idElement, $table) : false;
|
2023-04-11 19:11:26 +02:00
|
|
|
$pageExiste = ($infoElement) ? true : false ;
|
2025-03-22 16:53:35 +01:00
|
|
|
$titrePartDeux = ($pageExiste) ? $infoElement['nom'] : $titrePartDeux;
|
2023-04-11 19:11:26 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$titrePage = $titrePartUn . ' : ' . $titrePartDeux;
|
|
|
|
|
|
|
|
$_SESSION['tableDernierElemVu'] = $table;
|
|
|
|
$_SESSION['typeDernierElemVu'] = $type;
|
|
|
|
$_SESSION['idDernierElemVu'] = $idElement;
|
|
|
|
?>
|