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 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
| <body>
<?php
// appel du fichier contenant les paramètres de connexion au SGBD
$CnxBDD = mysql_connect('localhost','user','base','mpd');
$TRANCHES=array('08h-09h','09h-10h','10h-11h','11h-12h','12h-13h','13h-14h','14h-15h','15h-16h','16h-17h','17h-18h','18h-19h');
$res_req = mysql_query("SELECT nom FROM base.salles");
if ($row =mysql_fetch_array($res_req)) {
?><form name="form1" method="POST" action=""><?php
echo "<select name=formdata[] multiple size=10>" ;
do {
extract ($row);
echo "<option value=\"$nom\">$nom</option>" ;
}
while($row = mysql_fetch_array($res_req) );
echo "</select>" ;
echo "<input type=submit>" ;
?>
<input type="text" method="POST" name="txtDate" id="txtDate" value="" ;" >
</form>
<?php$txtdate = trim($_POST['txtdate']);
}
if (isset($_POST["txtdate"])) $txtdate=$_POST["txtdate"];
$txtdate = trim($_POST['txtdate']);
$txtdate=$_GET['txtdate'];
if(empty($txtdate) ) {
echo 'date obligatoire !'; }
else {
$txtdate=date("Y-m-d", strtotime($txtDate));
}
if (isset($_GET['txtdate'])) {
$txtdate=$_GET['txtdate'];
}
else
{
$txtdate=date("Y-m-d", strtotime($txtDate));
}
$dsql=date("Y-m-d", strtotime($txtDate));
if (isset($_POST['formdata'])&& !empty($_POST['formdata'])) {
?>
<div style="text-align: center;"><big><span
style="font-weight: bold;">Liste des Disponibiltés de(s) salle(s) du <?php echo "$txtdate";?> </span></big><br>
</div>
<br>
<br><br>
<br>
<br>
<?php
// Show data
foreach( $_POST['formdata'] AS $data ) {
echo "$data";
echo '<table>';
echo '<th width="400px"> Salle</th>';
for($i=0;$i<$NT;$i++) {
echo '<th width="100px">'.$TRANCHES[$i].'</th>';
}
//SQL_SMALL_RESULT
//echo "$txtdate";
mysql_select_db('mabase');
$rowd=mysql_query("SELECT SQL_SMALL_RESULT Tranches, concat(ident,' \nSujet: ',motif) AS title,OK
FROM resas_demandes a, salles b where a.nums=b.nums and b.nom in ('$data') and Date='$dsql' ");
echo '<tr>';
echo '<td width="150px">'.$salle->Nom.'</td>';
for ($i=0;$i<$NT;$i++) {
$im='green.png';
$titre="Disponible";
foreach($rowd as $tranche) {
if ($tranche->Tranches & pow(2,$i+1))
{
//On a une entrée (validée ou non dans la tranche horaire
if ($tranche->OK == '1')
{
$im='red.png';
$titre="Réservée par: ".$tranche->title;
}
else
{
$im='blue.png';
$titre="Demandée par: ".$tranche->title;
}
}
}
echo "<td><span class='tooltipImage' title='".$titre."'> <img src='../images/".$im."' alt='".$titre."' /></span></td>";
}
echo '</tr>';
else
{
echo '<tr>';
echo '<td width="15%">'.$data->Nom.'</td>';
for($i=0;$i<$NT;$i++)
{
echo "<td><span class='tooltipImage' title='Disponible'><img src='../images/green.png' alt='Disponible' /></span></td>";
}
echo '</tr>';
}
}
}
echo "</table>";
?>
</body>
</html>
<script type="text/javascript">
$(".tooltipImage").dvjhTooltip({
needClass: "tooltipImage",
width: "270px",
height: "200px",
color: "black",
fontWeight: "bold"
});
</script> |
Partager