153 lines
2.8 KiB
PHP
Executable File
153 lines
2.8 KiB
PHP
Executable File
<html>
|
|
<body bgcolor="ffffff">
|
|
<center>
|
|
<H1>TENNIS CORPORATIF DU TREGOR SAISON 2003-2004</H1>
|
|
|
|
<?php
|
|
|
|
$equip=$HTTP_POST_VARS["equip"];
|
|
$div_equip=$HTTP_POST_VARS["equip_div_fait"];
|
|
$nb_journee=$HTTP_POST_VARS["nb_journee"];
|
|
$terrain=$HTTP_POST_VARS["terrain_bis"];
|
|
$nb_div=$HTTP_POST_VARS["nb_div"];
|
|
$proprio=$HTTP_POST_VARS["proprio"];
|
|
$impossible=$HTTP_POST_VARS["impossible"];
|
|
$semaine=$HTTP_POST_VARS["semaine"];
|
|
|
|
$nb_equip=count($equip);
|
|
$nb_terrain=count($terrain);
|
|
|
|
$fait="; donnee des equipes ;\n\n";
|
|
|
|
function imprimTable1 ($table,$name)
|
|
{
|
|
$taille=count($table);
|
|
$concaten="";;
|
|
for($i=0;$i<$taille;$i++)
|
|
{
|
|
//echo "$name$i:$table[$i]<BR>";
|
|
$concaten.="$table[$i]\n";
|
|
}
|
|
return $concaten;
|
|
|
|
}
|
|
|
|
function isLibre ($nom_ter,$proprio)
|
|
{
|
|
$retour=true;
|
|
$taille=count($proprio);
|
|
for($i=0;$i<$taille;$i++)
|
|
{
|
|
$test=strstr($proprio[$i],$nom_ter);
|
|
if($test!=false)
|
|
{
|
|
|
|
$retour=false;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
return $retour;
|
|
}
|
|
|
|
function findIndex ($semaine)
|
|
{
|
|
$taille=count($semaine);
|
|
$chaine="S35 \' SEMAINE";
|
|
$retour=-1;
|
|
for($i=0;$i<$taille;$i++)
|
|
{
|
|
if(strcmp($chaine,$semaine[$i])>0)
|
|
{
|
|
$retour=$i;
|
|
break;
|
|
}
|
|
}
|
|
return $retour;
|
|
}
|
|
|
|
//echo ("equip:<BR><PRE>$equip</PRE>");
|
|
$fait.=stripslashes($equip);
|
|
|
|
//echo ("div:<BR><PRE>$equip_div_fait</PRE>");
|
|
$fait.="\n; donnee des divisions des equipes ;\n\n";
|
|
$fait.=$equip_div_fait;
|
|
|
|
$fait.="\n; donnee des journees ;\n\n";
|
|
|
|
for($i=0;$i<$nb_journee;$i++)
|
|
{
|
|
//echo "<pre>";
|
|
//echo "J$i ' JOUR\n";
|
|
$fait.="J$i ' JOUR\n";
|
|
//echo "<pre>";
|
|
}
|
|
//echo "<br>";
|
|
$taille=count($terrain);
|
|
|
|
$fait.="\n; donnees des courts (jour+h+lieu) possibles ;\n\n";
|
|
|
|
for($i=0;$i<$taille;$i++)
|
|
{
|
|
//echo "<pre>";
|
|
//echo "$terrain[$i] ' COURT\n";
|
|
$fait.="$terrain[$i] ' COURT\n";
|
|
//echo "<pre>";
|
|
|
|
}
|
|
|
|
$fait.="\n; semaines a considerer ;\n\n";
|
|
//imprimTable1 ($semaine,"semaine");
|
|
$index=findIndex($semaine);
|
|
//echo "<br>index:$index<br>";
|
|
for($i=count($semaine)-1;$i>$index-1;$i--)
|
|
{
|
|
$fait.=stripslashes($semaine[$i])."\n";
|
|
}
|
|
for($i=$index-1;$i>-1;$i--)
|
|
{
|
|
$fait.=stripslashes($semaine[$i])."\n";
|
|
}
|
|
|
|
|
|
|
|
$libre;
|
|
for($i=0;$i<$taille;$i++)
|
|
{
|
|
//echo "terrain:$terrain[$i]";
|
|
//echo "<BR>";
|
|
|
|
if(isLibre($terrain[$i],$proprio))
|
|
{
|
|
$libre[]="$terrain[$i] EST_LIBRE VRAI";
|
|
}
|
|
|
|
}
|
|
$fait.="\n; terrains libres : aucune equipe proprietaire ;\n\n";
|
|
$fait.=imprimTable1 ($libre,"libre");
|
|
|
|
$fait.="\n; tel terrain ne peut etre occupe que par telle equipe ;\n\n";
|
|
$fait.=imprimTable1($proprio,"proprio");
|
|
|
|
$fait.="\n; tel terrain ne peut pas etre utilise par telle equipe (contrainte de jour) ;\n\n";
|
|
$fait.=imprimTable1 ($impossible,"impossible");
|
|
|
|
echo "<BR>";
|
|
echo "<BR>";
|
|
echo "fait:";
|
|
echo "<BR>";
|
|
echo "<pre>$fait</pre>";
|
|
echo "<BR>";
|
|
echo "<form action=\"tennis2.php\" method=\"post\">";
|
|
echo "<input type=\"submit\" value=\"OK\">";
|
|
echo "<input type=\"hidden\" name=\"fait\" value=\"$fait\">";
|
|
echo "</form>";
|
|
?>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|