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
| <?
/* Is it a public day? */
$qry = "SELECT IdHd, YearHd FROM ".HOLI." ".
"WHERE DayHd = '".$curday."' ".
"AND MonthHd = '".$curmonth."' ";
$ret = mysql_query($qry, $cnx) ;
$hd = mysql_fetch_row($ret) ;
if ( $hd[0]!=0 && ($hd[1]==NULL || $hd[1]==$curyear) ) $holiday = $txt[8];
/* Requête pour afficher tous les ateliers */
$req = "select IdRm, NameRm, BkcolRm, FtcolRm FROM rp_room ORDER BY IdRm";
if (!$res = mysql_query($req)) exit("Erreur : ".mysql_error());
while ($col = mysql_fetch_row($res))
/* Room name and date (mise en commentaire pour infos)*/
/* $qry = "SELECT IdRm, NameRm, BkcolRm, FtcolRm FROM ".ROOM; */
/* $ret = mysql_query($qry, $cnx) ; */
/* while($col = mysql_fetch_row($ret))*/
{
$idroom = $col[0];
$nameroom = $col[1];
$bkcolorroom = $col[2];
$ftcolorroom = $col[3];
echo'<TH COLSPAN="3" WIDTH="100%" VALIGN="TOP" BGCOLOR="'.$bkcolorroom.'">'
.'<P><FONT FACE="'.$font.'" COLOR="'.$ftcolorroom.'">'
.$nameroom.' - '.sprintf('%02d', $curday).'/'
.sprintf('%02d', $curmonth).'/'.$curyear.'<BR>'.$holiday.'</P></TH>';
}
?>
</TR>
</THEAD>
<TBODY>
<?
/* Requête pour extraire toutes les réservations */
$qry = "select IdRs, TitleRs, BegRs, EndRs FROM rp_resa ORDER BY BegRs";
if (!$res = mysql_query($qry)) exit("Erreur : ".mysql_error());
while ($col = mysql_fetch_row($res))
/* Extract reservation (code original)*/
/* $qry = "SELECT IdRs, TitleRs, BegRs, EndRs ". */
/* "FROM ".RESA." ". */
/* "WHERE IdRm = ".$idroom." ". */
/* "AND DateRs = '".$curyear."-".$curmonth."-".$curday."' ". */
/* "ORDER BY BegRs"; */
$ret = mysql_query($qry, $cnx) ;
$c=0;
while ( $col = mysql_fetch_row($ret) )
{
$idresa[$c] = $col[0] ;
$titleresa[$c] = $col[1] ;
// extract and formate begin time from 07:00 to 0730
$begh = substr($col[2],0,2);
if (intval(substr($col[2],3,2))==30) $begm="30"; else $begm="00";
$begresa[$c] = $begh.$begm;
// extract and formate end time from 07:00 to 0730
$endh = substr($col[3],0,2);
if (intval(substr($col[3],3,2))==30) $endm="30"; else $endm="00";
// Formula to calculate number of boxes to set
$begtmp = intval($begh.$begm);
$endtmp = intval($endh.$endm);
$ecart = ($endtmp - $begtmp)/100;
$intpart = intval($ecart);
$decpart = ($ecart - $intpart)*10;
$boxresa[$c] = $intpart *2-1; # <------- Modify in 1.4
if ( $decpart!=0 ) $boxresa[$c]++;
$c++;
}
$c = 0; $odd=1;
for ( $t=$begrange ; $t<$endrange ; $t++)
{
$view = sprintf ( $viewbutton, $idresa[$c]); |
Partager