<?php 
include '../lib/configuration.inc';

if(!isset($_SESSION['SessionWeb_joueur_id'])){
	header('Location: ./deconnexion.php');
	exit;
}
?>

<html>
<head>
	<title><?=$txt_page_titre?></title>
	<?php include './commun/metatags.inc'; ?>
</head>

<body>

<?php include './commun/entete.inc'; ?>

<div id="contenu" align="center">

<div id="contenu_bis" align="left">

	<h1><?=$txt_espace_equipe_planning_titre?></h1>

	<div class="separateur"></div>

	<?php 
	if($parametre_site_affichage_planning==1){

		// Sélection du planning de l'équipe du joueur
		$requete_planning = mysqli_query($connexion_mysql, 'SELECT planning_groupe, DATE_FORMAT(planning_depart_date, "'.$txt_espace_equipe_planning_format_date.'"), DATE_FORMAT(planning_depart_heure, "'.$txt_espace_equipe_planning_format_heure.'"), golf_nom FROM planning A INNER JOIN golfs B ON A.golf_id=B.golf_id WHERE equipe_id="'.$_SESSION['SessionWeb_equipe_id'].'" ORDER BY planning_depart_date');
		$nb_departs = mysqli_num_rows($requete_planning);
		if($nb_departs!=0){

			for($depart_boucle=0; $depart_boucle<$nb_departs; $depart_boucle++){
				$resultat_depart = mysqli_fetch_array($requete_planning);
				$planning_groupe = $resultat_depart[0];
				$planning_depart_date = $resultat_depart[1];
				$planning_depart_heure = $resultat_depart[2];
				$golf_nom = decodage_apostrophe(html_entity_decode(stripslashes($resultat_depart[3])));

				if($depart_boucle==0){
					echo '<span class="texte_vert" style="font-size: 18px;">'.$txt_espace_equipe_planning_groupe.' '.$planning_groupe.'</span><br><br><br>';
				}

				echo '<b><u>'.$txt_espace_equipe_planning_depart.' N&deg; '.($depart_boucle+1).'</u></b><br><br>';

				echo '<span style="font-weight: normal;">'.$txt_espace_equipe_planning_date_heure.' :</span>&nbsp; '.$txt_espace_equipe_planning_le.'&nbsp; '.$planning_depart_date.'&nbsp;&nbsp; '.$txt_espace_equipe_planning_a.'&nbsp; '.$planning_depart_heure.'<br><br>';
				echo '<span style="font-weight: normal;">'.$txt_espace_equipe_planning_lieu.' :</span>&nbsp; Golf&nbsp; « '.$golf_nom.' »<br><br>';

				if($depart_boucle!=($nb_departs-1)){
					echo '<div class="separateur"></div>';
				}

			}
		}

	}
	?>

</div>
</div>

</body>
</html>
