1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
|
<?php
include('connexion_sql.php');
?>
<?php include("haut.php"); ?>
<header>
<h1>PLANNING</h1>
</header>
<section id="centre">
<div id="corps"><a id="ancrecontenu"></a>
<table id="tableau">
<caption>Planning de</caption>
<thead>
<tr>
<th class="cacher" scope="col" rowspan="2">ID_PC</th>
<th scope="col" rowspan="2">Da</th>
<th scope="col" rowspan="2">Po</th>
<th scope="col" colspan="2">H</th>
<th scope="col" rowspan="2">Ve</th>
<th scope="col" rowspan="2">CHE</th>
<th scope="col" rowspan="2">CHA</th>
<th scope="col" colspan="2">S</th>
</tr>
<tr>
<th scope="col" class="nogras">h_d</th>
<th scope="col" class="nogras">h_f</th>
<th scope="col" class="nogras">s_1</th>
<th scope="col" class="nogras">s_2</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<?php
$req = $bdd->query('SELECT id_pc, da, po, h_d, h_f, ve, che, cha, s_1, s_2
FROM planning
ORDER BY date')
or die(print_r($bdd->errorInfo()));
define ('TAB', ' ') ;
while ($donnees = $req->fetch()) {
extract ($donnees);
$id_pc=$donnees["id_pc"];
$date=$donnees["da"];
$poste=$donnees["po"];
$heure_d=$donnees["h_d"];
$heure_f=$donnees["h_f"];
$vehicule=$donnees["ve"];
$chef=$donnees["che"];
$chauffeur=$donnees["cha"];
$secouriste_1=$donnees["s_1"];
$secouriste_2=$donnees["s_2"];
echo PHP_EOL . '<tr>';
echo PHP_EOL . TAB . '<td class="cacher">' .$id_pc. '</td>';
echo PHP_EOL . TAB . '<td scope="row">' .$da. '</td>';
echo PHP_EOL . TAB . '<td class="nowrap">' .stripslashes($po). '</td>';
echo PHP_EOL . TAB . '<td>' .$h_d. '</td>';
echo PHP_EOL . TAB . '<td>' .$h_f. '</td>';
echo PHP_EOL . TAB . '<td>' .$ve. '</td>';
echo PHP_EOL . TAB . '<td>' .stripslashes($che). '</td>';
echo PHP_EOL . TAB . '<td contenteditable="true">' .stripslashes($cha). '</td>';
echo PHP_EOL . TAB . '<td contenteditable="true">' .stripslashes($s_1). '</td>';
echo PHP_EOL . TAB . '<td contenteditable="true">' .stripslashes($s_2). '</td>';
echo PHP_EOL . TAB . "<td><button onclick='modifier(this.parentElement)'>ok</button></td>" ;
echo PHP_EOL . '</tr>';
}
?>
<script type="text/javascript">
<!--
function modifier(X) {
array = X.getElementsByTagName('TD');
xhr = new XMLHttpRequest() ;
xhr.open("POST", "maj.php", false) ;
xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded") ;
chaine = 'id_pc=' + array[1].innerHTML
+ '&da=' + array[2].innerHTML
+ '&po=' + array[3].innerHTML
+ '&h_d=' + array[4].innerHTML
+ '&h_f=' + array[5].innerHTML
+ '&ve=' + array[6].innerHTML
+ '&che=' + array[7].innerHTML
+ '&cha=' + array[8].innerHTML
+ '&s_1=' + array[9].innerHTML
+ '&s_2=' + array[10].innerHTML;
xhr.send(chaine);
}
-->
</script>
<?php
extract($_POST) ;
$req2 = $bdd->query ("UPDATE planning
SET da='$da', po='$po', h_d='$h_d', h_f='$h_f', ve='$ve', che='$che', cha='$cha', s_1='$s_1', s_2='$s_2' WHERE id_pc='$id_pc'") or die(print_r($bdd->errorInfo()));
?>
</tbody>
</table>
</div>
</section>
<footer id="copyright"><?php include("copyright.php"); ?></footer>
<?php include("bas.php"); ?> |
Partager