<?php

	$sPage  = "calendar";
	require("admin/§lib_inc.php");

	$sTitle = decode_lng_text("CALENDAR_TITLE");

	$FAMILY=isset($_REQUEST["FAMILY"])?$_REQUEST["FAMILY"] : -1; 

	require("§menu.php");
	require("§progress_bar.php");

/*	if($bSessionOk==false)
	{
		$sReqCont="and contemporary=1";
	}
	else*/
	{
		$sReqCont="";
	}

	$sReqFam="and id_family=$FAMILY";

	//set_time_limit(0);
	
	flush();


//afficharge du tableau final
	echo "<table align=center cellspacing=0 border=1><TR bgcolor=lightblue align=center>";
	echo "<td>".decode_lng_text('STATS_MONTH')."</td>";
	$cpt=1;
	while ($cpt<32) { echo "<td>$cpt</td>"; $cpt+=1; }
	echo "<td>".decode_lng_text('STATS_MONTH')."</td></tr>";
	
	$cpt=1;

	while ($cpt<13)
	{
		$cptJour=1;
		$month_name=decode_lng_text("MONTH$cpt");
		echo "<TR><TD align=center>$month_name</TD>";
		$result = mysql_query($sql_query="select DAY, TOTAL from oxg_calendar where MONTH=$cpt $sReqFam order by DAY asc") or mysql_die();
		while ($row = mysql_fetch_array($result))
		{
			$jour=$row['DAY'];
			$total=$row['TOTAL'];
			while($cptJour<$jour)
			{
				echo "<TD align=center>.</TD>";
				$cptJour=$cptJour+1;
			}
			if ($total==0)
			{
				echo "<TD align=center>$total</TD>";
			}
			else
			{
				echo "<TD align=center><a href='§detail_ind_date.php?FAMILY=$FAMILY&DAY=$jour&MONTH=$cpt'>$total</a></TD>";
			}
			$cptJour=$cptJour+1;
			//{echo "<TD align=center onmouseover=this.className='b' onmouseout=this.className='a' onclick='location.href='§detail_ind_date.php?FAMILY=$FAMILY&DAY=$jour&MONTH=$mois''>$total</TD>";}
		}
		while($cptJour<32)
		{
			echo "<TD align=center>.</TD>";
			$cptJour=$cptJour+1;
		}
		echo "<TD align=center>$month_name</TD>";
		$cpt+=1;
	}
	echo "</table>";

	affiche_pied_page(true);
?>

<html>
<script type="text/javascript">
document.getElementById('progress_bar').style.display="none"
</script>
</html>
