File "consultation_plongee.php"
Full Path: /home/asmplong/www/ancien-site-2019/plongeev4/consultation_plongee.php
File size: 9.76 KB
MIME-type: text/x-php
Charset: 8 bit
<?php
// script permettant de generer une fiche de plongee
//information recu : action=\"consultation_plongee.php?date=$row[0]&theme_plongee=$row[1]&niveau_minimum=$row[2]&nom_du_Dp=$row[3]
include('parametres.php');
include('connexion_bdd.php');
session_start();
?>
<?php
$table=explode("/",$_GET['la_date']);
$niveau_minimum=$_GET['niveau_minimum'];
$theme_plongee = $_GET['theme_plongee'];
$niveau_de_plongee_de_l_adherent=$_POST['niveau_plongee_adherent'];
$adherent_connecte=$_GET['nom_adherent'];
$adherent_connect=explode("_",$adherent_connecte);
//mettre le nom du plongeur dans la partie de la fiche qui va bein en fonction de son niveau
$lejour=$table[0];
$lemois=$table[1];
$lannee=$table[2];
// pour l inscription il faut d'abord verifier que des MF1 MF2 ou N4+ sont deja inscrit
switch($theme_plongee)
{
case "Plongee_Du_Soir" :
$heure_depart="18h30";
break;
case "Plongee_Du_Week_End" :
$heure_depart="8h00";
break;
case "Plongee_Bapteme" :
$heure_depart="08h00";
break;
case "Plongee_a_theme" :
$heure_depart="08h00";
break;
case "Plongee_profonde" :
$heure_depart="xxhxx";
break;
}
$jours = array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi');
$timestamp = mktime(0, 0, 0, $table[1], $table[0],$table[2]);
$numero_jour = date('w', $timestamp);
$jours = array('Dimanche', 'Lundi', 'Mardi', 'Mercredi', 'Jeudi', 'Vendredi', 'Samedi');
$jour_correspondant = $jours[$numero_jour];
?>
<center>
<table border=1 width = 800><tr><td width=200>mettre logo</td><td align="right">
<table border =0 width =600>
<tr>
<td>
<center>Activites Subaquatiques Marignane</center>
<center>Sortie du <?php echo $_GET['la_date'] ?>
<table border =0><tr>
<?php
if($jour_correspondant=="Lundi")
{
echo "<td width=20><font color =red><b>L</b></font></td>";
}
else
{
echo "<td width=20><b>L</b></td>";
}
if($jour_correspondant=="Mardi")
{
echo "<td width=20><font color =red><b>M</b></font></td>";
}
else
{
echo "<td width=20><b>M</b></td>";
}
if($jour_correspondant=="Mercredi")
{
echo "<td width=20><font color =red><b>M</b></font></td>";
}
else
{
echo "<td width=20><b>M</b></td>";
}
if($jour_correspondant=="Jeudi")
{
echo "<td width=20><font color =red><b>J</b></font></td>";
}
else
{
echo "<td width=20><b>J</b></td>";
}
if($jour_correspondant=="Vendredi")
{
echo "<td width=20><font color =red><b>V</b></font></td>";
}
else
{
echo "<td width=20><b>V</b></td>";
}
if($jour_correspondant=="Samedi")
{
echo "<td width=20><font color =red><b>S</b></font></td>";
}
else
{
echo "<td width=20><b>S</b></td>";
}
if($jour_correspondant=="Dimanche")
{
echo "<td width=20><font color =red><b>D</b></font></td>";
}
else
{
echo "<td width=20><b>D</b></td>";
}
?>
<table border =0><tr><td> Depart a <?php echo $heure_depart ?> <td width =50></td><td> Heure du club</td></tr></table>
</center>
</td>
</tr>
</table>
</td></tr></table>
<table border=1 width = 800><tr><td width=800 ><b>Responsable de la sortie, Directeur de Plongee: <?php echo $_GET['nom_du_Dp'] ?></b></td></tr></table>
<table border=1 width = 800>
<tr>
<td width=400 align="center">
<b>ENCADREMENT</b>
</td>
<td>
N5
</td>
<td width=73>
E1
</td>
<td width=73>
E2
</td>
<td width=73>
E2
</td>
<td width=73>
E2
</td>
<td width=73>
E2
</td>
<td>
Certif.
</td>
</tr>
<td width=400 align="center">
Nom et Prenom
</td>
<td>
  
</td>
<td width=73>
Init
</td>
<td width=73>
N4+
</td>
<td width=73>
MF1
</td>
<td width=73>
MF2
</td>
<td width=73>
  
</td>
<td>
Medic.
</td>
</tr>
<?php
// si c est un encadrant
echo "niveau connect".$niveau_de_plongee_de_l_adherent;
if(($niveau_de_plongee_de_l_adherent=="MF1")||($niveau_de_plongee_de_l_adherent=="MF2")||($niveau_de_plongee_de_l_adherent=="N4")||($niveau_de_plongee_de_l_adherent=="N5"))
{
// AFFICHAGE DE LA PARTIE HAUTE DE LA FICHE D INSCRIPTION
$ad=$adherent_connect[0]." ".$adherent_connect[1];
$query ="SELECT numero_de_la_plongee FROM `planification _des_plongees` WHERE date LIKE '".$_GET['la_date']."' AND theme_plongee LIKE '".$_GET['theme_plongee']."' AND niveau_minimum LIKE '".$_GET['niveau_minimum']."' AND nom_du_Dp LIKE '".$_GET['nom_du_Dp']."'";
$result = mysql_query($query,$connexion);
$row = mysql_fetch_row($result) ;
$numero_de_la_plongee_selectionnee = $row[0];
$query ="INSERT INTO `".$numero_de_la_plongee_selectionnee."`(`encadrement`,`plongeur`,`nombre_encadrant`,`nombre_plongeurs`,`niveau_encadrant`) VALUES (";
$query= $query."'".$ad."',' ','1',' ','".$niveau_de_plongee_de_l_adherent."')";
//echo $query;
$result = mysql_query($query,$connexion) or die(mysql_error());
$query ="SELECT encadrement,niveau_encadrant FROM `".$numero_de_la_plongee_selectionnee."`";
$result = mysql_query($query,$connexion);
$mn=0;
while ($row = mysql_fetch_row($result))
{
if($niveau_de_plongee_de_l_adherent=="MF1")
{
echo "</tr><td width=400 align=\"center\">".$row[0]."</td><td>  </td><td width=73>  </td><td width=73>  </td><td width=73>XXX</td><td width=73>  </td><td width=73>  </td><td>".$_SESSION['date_validation_certificat_medical']."</td></tr>";
}
if($niveau_de_plongee_de_l_adherent=="MF2")
{
echo "</tr><td width=400 align=\"center\">".$row[0]."</td><td>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>XXX</td><td width=73>  </td><td>".$_SESSION['date_validation_certificat_medical']."</td></tr>";
}
}
for($i=0;$i<6;$i++)
{
echo "</tr><td width=400 align=\"center\">  </td><td>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td>  </td></tr>";
}
// on recupere le nom des plongeurs inscrits
$query ="SELECT plongeur FROM `".$numero_de_la_plongee_selectionnee."`";
$result = mysql_query($query,$connexion);
echo "</table>";
echo "<table border=1 width = 800><tr><td width=800 ><b>Pour Plonger de nuit : Etre N2 Minimum avec Lampe</b></td></tr></table><table border=1 width = 800>";
echo "<tr><td width=400 align=\"center\"><b>PLONGEURS</b></td><td>Bapt</td><td width=73>N0</td><td width=73>N1</td><td width=73>N2</td><td width=73>N3</td><td width=73>N4</td><td>Certif.</td></tr>";
echo "<tr><td width=400 align=\"center\">Nom et Prenom</td><td>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td>Medic.</td></tr>";
echo "<tr><td width=400 align=\"center\">  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td><td width=73>  </td></tr>";
$numero_colonne=-1;
$nombre_de_case_max=5;
$indice_numero_de_case=-2;
//$niveau_requis = explode($niveau_minimum,"N");
$niveau_requis=substr($niveau_minimum, 1);
$query ="SELECT plongeur FROM `".$numero_de_la_plongee_selectionnee."`";
$result = mysql_query($query,$connexion);
while ($row = mysql_fetch_row($result))
{
if($indice_numero_de_case==-2)
{
echo "<tr><td width=73 align=\"center\" bgcolor=\"white\">$row[0]</td>";
}
else
{
if ($indice_numero_de_case<$niveau_requis)
{
if($indice_numero_de_case<$nombre_de_case_max)
{
echo "<td width=73 align=\"center\" bgcolor=\"gray\">  </td>";
}
else
{
echo "<td width=73 align=\"center\" bgcolor=\"gray\">  </td></tr>";
$indice_numero_de_case=-3;
}
}
else
{
if($indice_numero_de_case<$nombre_de_case_max)
{
echo "<td width=73 align=\"center\">  </td>";
}
else
{
echo "<td width=73 align=\"center\">  </td></tr>";
$indice_numero_de_case=-3;
}
}
}
$indice_numero_de_case=$indice_numero_de_case+1;
}
$indice_numero_de_case=-2;
for($i=0;$i<200;$i++) // pour faire 25 lignes
{
$query ="SELECT plongeur FROM `".$numero_de_la_plongee_selectionnee."`";
$result = mysql_query($query,$connexion);
if($indice_numero_de_case==-2)
{
echo "<tr><td width=73 align=\"center\" bgcolor=\"white\">$row[0]</td>";
}
else
{
if ($indice_numero_de_case<$niveau_requis)
{
if($indice_numero_de_case<$nombre_de_case_max)
{
echo "<td width=73 align=\"center\" bgcolor=\"gray\">  </td>";
}
else
{
echo "<td width=73 align=\"center\" bgcolor=\"gray\">  </td></tr>";
$indice_numero_de_case=-3;
}
}
else
{
if($indice_numero_de_case<$nombre_de_case_max)
{
echo "<td width=73 align=\"center\">  </td>";
}
else
{
echo "<td width=73 align=\"center\">  </td></tr>";
$indice_numero_de_case=-3;
}
}
}
$indice_numero_de_case=$indice_numero_de_case+1;
}
}
else // si c est pas un encadrant qui s est logge
{
}
?>
</table>
</form>
</center>