Files
resatennis_tyroltenn/www/tyroltenn/gestion_tournois.php

116 lines
4.1 KiB
PHP
Executable File

<?php
session_start();
header('P3P: CP="NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM"');
if(isset($_SESSION['Admin']) and $_SESSION['Admin']==2 and isset($_SESSION['Club'])) {
$id_club=$_SESSION['Club'];
?>
<html>
<head>
<meta http-equiv="Content-Language" content="fr">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>LE SERVEUR VOCAL DE RESERVATION DES SALLES DE TENNIS</title>
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body>
<div id="tout">
<?php
include("enTete.php");
include("menu.php");
include("conf.php");
echo "<div id='contenu'>";
echo "<center><h1>Gestion des tournois du club</h1></center><br />";
echo "<p>";
echo "A partir de cette page, vous pouvez visualiser vos tournois existants, cr&eacute;er un nouveau tournoi mais &eacute;galement consulter la liste des juges arbitres et en ajouter un.";
echo "</p>";
echo "<br />";
echo "<h3><center>Liste des tournois</center></h3><br />";
/* Tournois de moins de 2 ans */
$annee=date("Y");
$saison_2=$annee-2;
$requete="SELECT nom, debut, fin, id_jugearbitre, date_cloture, interne, id_tournoi, saison FROM tournoi WHERE id_club='$id_club' AND saison > '$saison_2' ORDER BY fin DESC";
$reponse=mysqli_query($db_connection, $requete) or die ("Erreur no".mysqli_errno($db_connection)()." : ".mysqli_error($db_connection)()."<br>");
$existe=mysqli_num_rows($reponse);
if($existe>0) {
echo "<center><table border='1' width='80%'>";
echo "<th bgcolor='#FFFACD'>Nom</th><th bgcolor='#FFFACD'>Saison</th><th bgcolor='#FFFACD'>Date d&eacute;but</th><th bgcolor='#FFFACD'>Date fin</th><th bgcolor='#FFFACD'>Cloture des<br />inscriptions</th>";
echo "<th bgcolor='#FFFACD'>Tournoi interne</th><th bgcolor='#FFFACD'>Juge Arbitre</th><th bgcolor='#FFFACD'>Etat</th><th bgcolor='#FFFACD'>Modifier</th>";
while($tournoi=mysqli_fetch_object($reponse)) {
echo "<tr>";
echo "<td><center>$tournoi->nom</center></td>";
echo "<td><center>$tournoi->saison</center></td>";
list($a,$m,$j)=explode("-",$tournoi->debut);
echo "<td><center>$j/$m/$a</center></td>";
list($a,$m,$j)=explode("-",$tournoi->fin);
echo "<td><center>$j/$m/$a</center></td>";
list($a,$m,$j)=explode("-",$tournoi->date_cloture);
echo "<td><center>$j/$m/$a</center></td>";
echo "<td><center>$tournoi->interne</center></td>";
$requete="SELECT nom FROM juge_arbitre WHERE id_ja='$tournoi->id_jugearbitre'";
$rep=mysqli_query($db_connection, $requete) or die ("Erreur no".mysqli_errno($db_connection)()." : ".mysqli_error($db_connection)()."<br>");
$ja=mysqli_fetch_object($rep);
echo "<td><center>$ja->nom</center></td>";
/* Détermination de l'état */
list($a,$m,$j)=explode("-",$tournoi->debut);
$ts_debut=mktime(9,0,0,$m,$j,$a);
list($a,$m,$j)=explode("-",$tournoi->date_cloture);
$ts_cloture=mktime(22,0,0,$m,$j,$a);
list($a,$m,$j)=explode("-",$tournoi->fin);
$ts_fin=mktime(22,0,0,$m,$j,$a);
$modif=0;
if($ts_debut > time()) {
$etat="Pas commenc&eacute;";
$modif=1;
}
else if($ts_debut <= time() and time() < $ts_fin) {
$etat="En cours";
$modif=1;
}
else if(time() > $ts_fin) {
$etat="Termin&eacute;";
}
if(time()<= $ts_cloture) {
$inscrit="Inscriptions en cours";
}
else {
$inscrit="Inscriptions clotur&eacute;es";
}
echo "<td><center>$etat /<br />$inscrit</center></td>";
if($modif==1) {
echo "<td><center><a href='modifier_tournoi_suite.php?id_tournoi=$tournoi->id_tournoi'>Modifier</a></center></td>";
}
else {
echo "<td></td>";
}
echo "</tr>";
}
echo "</table></center>";
}
else {
echo "<center>Vous n'avez aucun tournoi d&eacute;clar&eacute;. Cliquez sur le lien ci-dessous pour en cr&eacute;er un.</center><br /><br />";
}
echo "<br /><br />";
echo "<center><a href='creation_tournois.php'>Cr&eacute;er un nouveau tournoi</a></center><br /><br />";
echo "<center><a href='liste_ja.php'>Liste des juges arbitres</a></center>";
echo "<br /><br />";
include("deco_admin_club.php");
include("piedDePage.php");
}
else {
echo("Non autorisé - Redirection vers la page d'identification dans 2 secondes");
sleep(2);
include("admin_login.php");
}
?>