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
|
<table id="plages">
<tr>
<th></th>
<th colspan="4">10h</th>
<th colspan="4">11h</th>
<th colspan="4">12h</th>
<th colspan="4">13h</th>
<th colspan="4">14h</th>
<th colspan="4">15h</th>
<th colspan="4">16h</th>
<th colspan="4">17h</th>
<th colspan="4">18h</th>
<th colspan="4">19h</th>
</tr>
<?php
$jour = array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
$mois = array("","Janvier","Février","Mars","Avril","Mai","Juin","Juillet","Août","Septembre","Octobre","Novembre","Décembre");
date_default_timezone_set('Europe/Paris');
$now = time();
$then = strtotime('+7 days', $now); // dans 4 semaines
$current = $now;
do {
if (date('D', $current) == 'Sun') // ou Dim selon la locale
continue;
$dateDuJour = $jour[date("w",$current)]." ".date("d",$current)." ".$mois[date("n",$current)]." ".date("Y",$current);
echo '<tr><th>'.$dateDuJour.'</th><td time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><td time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><td time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><td time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><th> </th><td class="picked" time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><td time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><td time="123">00</td><td time="456">20</td><td time="789">40</td><th> </th><td time="123">00</td><td time="456">20</td><td time="789">40</td>';
} while (($current = strtotime('+1 days', $current)) && $current <= $then);
?>
</tr>
</table>
<form action="...">
<input type="text" id="time" value="" />
<input type="submit" value="Réserver" />
</form>
<script type="text/javascript">
<!--
$(function () {
$('#plages td:not(.picked)').click(function () {
$('#plages td').removeClass('clicked');
$(this).toggleClass('clicked');
$('#time').val( $(this).attr('time') );
});
});
</script> |