File "affiche_planning03.php"
Full Path: /home/analogde/www/MassageProd/affiche_planning03.php
File size: 31.31 KB
MIME-type: text/x-php
Charset: utf-8
<?php
session_start ();
error_reporting(0);
if (!isset($_SESSION['nom']) && !isset($_SESSION['password']))
{
header("Location: login.php");
}
header( 'content-type: text/html; charset=utf-8' );
include('database.php');
include('fonctions.php');
include('generation_timing.php');
DB_connexion();
$utilisateur = $_SESSION['nom'] .' ' .$_SESSION['prenom'];
if( $_SESSION['mode_debug'] == "yes" )
{
$debug = true;
echo " ----> : Mode debug" ."<br>";
echo "<pre>";
print_r($_SESSION);
echo "</pre>";
}
else
{
$debug = false;
}
if(isset($_GET['ouvrir']) && $_GET['ouvrir'] == "ok")
{
echo "Ouverture dans la database ...";
echo "<br><br>";
$_GET['ouvrir'] = "";
if( $debug == true)
{
echo "--> " .$_GET['ouvrir'] ."<br>";
echo "--> " .$_GET['mois'] ."<br>";
echo "--> " .$_GET['jour'] ."<br>";
echo "--> " .$_GET['horaire'] ."<br>";
}
$annee = $_SESSION['year'];
$jour = $_GET['jour'];
$table = $_SESSION['table_reservation'];
mysqli_query($connexion, "SET NAMES 'utf8'");
// interrogation
//$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'courte' and mois =$_GET['mois'] and mode = 'actif' and rendezvous = '$_GET['jour']'";
//$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'courte' and mois ='$_GET['mois']' and mode = 'actif' ";
$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'courte' and mode = 'actif' and rendezvous = '$jour' ";
if( $debug == true)
{
echo $sql ."<br>";
}
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
$etat_seance = "";
$datas = mysqli_fetch_assoc ($result);
if( $debug == true)
{
echo "++++ " .$datas['seance1'] ."<br>";
echo "++++ " .$datas['seance2'] ."<br>";
echo "++++ " .$datas['seance3'] ."<br>";
echo "++++ " .$datas['seance4'] ."<br>";
echo "++++ " .$datas['seance5'] ."<br>";
echo "++++ " .$datas['seance6'] ."<br>";
echo "++++ " .$datas['seance7'] ."<br>";
echo "++++ " .$datas['seance8'] ."<br>";
}
$val = $_GET['horaire'];
//echo " 00000 " .$_GET['horaire'] . " " .$val ."<br>";
if (strcmp($val, "seance1") == 0)
{
$etat_seance = $datas['seance1'];
//echo " +++++++++ seance1 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance2") == 0)
{
$etat_seance = $datas['seance2'];
//echo " +++++++++ seance2 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance3") == 0)
{
$etat_seance = $datas['seance3'];
//echo " +++++++++ seance3 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance4") == 0)
{
$etat_seance = $datas['seance4'];
//echo " +++++++++ seance4 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance5") == 0)
{
$etat_seance = $datas['seance5'];
//echo " +++++++++ seance5 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance6") == 0)
{
$etat_seance = $datas['seance6'];
//echo " +++++++++ seance6 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance7") == 0)
{
$etat_seance = $datas['seance7'];
//echo " +++++++++ seance7 " .$etat_seance ."<br>";
}
if (strcmp($val, "seance8") == 0)
{
$etat_seance = $datas['seance8'];
//echo " +++++++++ seance8 " .$etat_seance ."<br>";
}
$text = "";
// si vide , on referme
/*if(empty($etat_seance))
{
$text = "Supplement fermé";
$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ." = " .$text ." WHERE rendezvous = '$jour' ";
if( $debug == true)
{
echo $sql;
echo "<br>";
}
//$result = mysqli_query($connexion, $sql );
}*/
// sinon on ouvre
//else
//{
$text = "";
$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ." = 'creneau ouvert' WHERE rendezvous = '$jour' ";
if( $debug == true)
{
echo "Passage fermé - ouvert";
echo "<br>";
echo $sql;
echo "<br>";
}
$result = mysqli_query($connexion, $sql );
//}
//}
//$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ."= '' WHERE rendezvous = $_GET['jour'] ";
//header("Location: affiche_planning03.php");
}
if(isset($_GET['fermer']) && $_GET['fermer'] == "ok")
{
echo "Fermueture du créneau sélectionné";
echo "<br>";
$_GET['fermer'] = "";
$table = $_SESSION['table_reservation'];
mysqli_query($connexion, "SET NAMES 'utf8'");
//$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ."= 'unselect' WHERE rendezvous = " .$_GET['jour'] ;
$text = "creneau fermer";
$jour = $_GET['jour'];
//$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ." = " .$text ." WHERE rendezvous = " .'$_GET['jour']' ;
if( strcmp ($_GET['horaire'], "seance1") == 0 )
{
$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ." = '$text' WHERE rendezvous = '$jour' ";
}
if( strcmp ($_GET['horaire'], "seance6") == 0 )
{
$sql = "UPDATE " .$table ." SET " .$_GET['horaire'] ." = '$text' WHERE rendezvous = '$jour' ";
}
echo $sql;
echo "<br>";
$result = mysqli_query($connexion, $sql );
//header ("Refresh: 0;URL=affiche_planning03.php");
}
?>
<!DOCTYPE html>
<html>
<head>
<style>
table {
width: 100%;
border-collapse: collapse;
}
table, td, th {
border: 1px solid black;
padding: 0px;
}
th {text-align: left;}
.titre {
margin-left:50px;
margin-top:50px;
font-size: 26px;
}
a:link { color: black;
text-decoration:none;
}
a:visited {color: black;
text-decoration:none;}
a:hover {color: black;
text-decoration:none;}
a:active {color: black;
text-decoration:none; }
.button {
background-color: #E84A35; /* Green avant 4CAF50*/
border: none;
color: white;
padding: 15px 32px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
<!-- #E84A35 #f9f21b -->
.btn {
background-color: #ffff66; /* Green avant 4CAF50*/
border: none;
color: white;
//height: 150%;
width: 100%;
padding-top: 18px;
//padding-right: 30px;
padding-bottom: 18px;
//padding-left: 80px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 16px;
}
}
<!--
css button fill table cell
how to make a button fill in a td completely
-->
<!--
example utilisation
<button>Default Button</button>
<a href="#" class="button">Link Button</a>
<button class="button">Button</button>
<input type="button" class="button" value="Input Button">
-->
</style>
</head>
<body>
<link rel="stylesheet" href="menu_style.css" type="text/css">
<div id='cssmenu'>
<ul>
<li><a href='home.php'><span>Home</span></a></li>
<li class='active'><a href='selection_planning_mois.php'><span>Planning</span></a></li>
<li><a href='selection_gestion_mois.php'><span>Gestion</span></a></li>
<li><a href='selection_statistique_mois.php'><span>Statistiques</span></a></li>
<?php
if($_SESSION['nom'] == "admin")
{
echo '<li><a href="deplacer_un_rendezvous_admin.php"><span>Déplacer</span></a></li>';
echo '<li><a href="configuration.php"><span>Configuration</span></a></li>';
}
else
{
echo '<li><a href="deplacer_un_rendezvous_user.php"><span>Déplacer</span></a></li>';
}
?>
<li><a href='change_password.php'><span>Changer password</span></a></li>
<li><a href='logout.php'><span>Déconnexion</span></a></li>
<li><a href='#'><span><?php echo $_SESSION['nom'] .' ' .$_SESSION['prenom'] .' connecté' ?></span></a></li>
<li><a href='#'><span><?php echo $_SESSION['year']; ?></span></a></li>
</ul>
</div>
<br>
<br>
<?php
$mois = $_GET['mois'];
$annee = $_SESSION['year'];
//$annee = date('Y');
if( $_SESSION['nom'] == "admin")
{
if($_SESSION['debug_mode'] == "yes")
{
echo 'Mode debug';
echo '<br><br>';
}
}
//echo $mois_actif;
//echo ucfirst($mois) ." " .$annee;
//echo '<br><br>';
//echo "Nous sommes le " .date("d-m-Y");
date_default_timezone_set('Europe/Paris');
$ts_du_jour = strtotime(date("d-m-Y"));
//$table = "reservation_dev" .$annee;
//$table = $_SESSION['table_reservation'];
$table = $_SESSION['table_reservation']; // = "reservation" .$_SESSION['year'] ."_v3_test";
//echo "******* -> " .$table;
//$table = "reservation" .$annee; // nouvelle possibilitée
// $sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and mois ='$mois' ";
// echo $sql;
// $result = mysqli_query($connexion, $sql );
// if(!$result)
// {
// die('Impossible d\'exécuter la requête :' . mysql_error());
// }
/* $n = mysqli_num_rows($result);
echo " ---> " .$n;
$cpt = 0;
$tab_jour = array();
$tab_ts = array();
$tab_cpt_par_semaine = array();
// compte le nombre de reservation par semaine
while ($datas = mysqli_fetch_assoc ($result))
{
$cpt = 0;
$tab_jour[] = $datas['jour'];
$seance1 = $datas['seance1'];
$seance2 = $datas['seance2'];
$seance3 = $datas['seance3'];
$seance4 = $datas['seance4'];
$seance5 = $datas['seance5'];
$seance6 = $datas['seance6'];
$seance7 = $datas['seance7'];
$seance8 = $datas['seance8'];
if(strlen($seance1) !=0 && $seance1 != "unselect")
{ $cpt = $cpt + 1;
}
if(strlen($seance2) !=0 && $seance2 != "unselect")
{ $cpt = $cpt + 1;
}
if(strlen($seance3) != 0 )
{ $cpt = $cpt + 1;
}
if(strlen($seance4) != 0 )
{ $cpt = $cpt + 1;
}
if(strlen($seance5) != 0 )
{ $cpt = $cpt + 1;
}
if(strlen($seance6) != 0)
{ $cpt = $cpt + 1;
}
if(strlen($seance7) != 0 && $seance7 != "unselect")
{ $cpt = $cpt + 1;
}
if(strlen($seance8) != 0 && $seance8 != "unselect")
{ $cpt = $cpt + 1;
}
echo $cpt;
$tab_cpt_par_semaine[]=$cpt;
}
for( $i=0; $i < count($tab_jour) ; $i++)
{
$tab_ts[] = strtotime($tab_jour[$i]);
echo $tab_jour[$i];
echo '<br>';
}
*/
//////////////////////////////////////////////////////////////////////////
///
/*
$sql="SELECT * FROM pipo ";
$result=@mysql_query($sql);
if (!$result)
{
echo "No table exists";
}
$sql="SELECT * FROM tarif ";
$result=@mysql_query($sql);
echo $result;
if (!$result)
{
echo "kjkjkjkjjlkj";
}
else
{
echo "bingo";
}
$dbname = "test";
$sql = "SHOW TABLES FROM $dbname";
$result = mysql_query($sql);
$liste_table_DB = array();
$cpt = 0;
while ($row = mysql_fetch_row($result))
{
$element = $row[0];
echo $element;
echo "<br>";
//liste_table_DB[cpt] = $element;
$cpt = $cpt + 1;
//echo "Table : $row[0]";
//echo "<br>";
}
echo '<pre>';
print_r($liste_table_DB);
$ts_du_jour = strtotime(date("d-m-Y"));
echo "<br>";
echo $table;
if(!(mysql_query("SELECT * FROM $table")))
{
//$str = 'Arnold a dit : "I\'ll be back"';
$str = " La database " .$_SESSION['year'] ." n'existe pas encors !";
die($str);
}
*/
//echo getcwd();
/*
$sql = "SELECT * FROM " .$table;
$result = mysqli_query($connexion, $sql );
if($result == null)
{
$table_nom = substr( $table, 0, -3 );
$str = " La table " .$table_nom ." n'exite pas configurée!.";
echo "<p><font size='5'>";
die($str);
echo "</p>";
echo "<br>";
}
*/
//$table = $_SESSION['table_reservation'] = "reservation" .$_SESSION['year'] ."_v3";
$table = $_SESSION['table_reservation'];
//echo $table;
if(!(mysqli_query($connexion, "SELECT * FROM $table")))
{
//$str = 'Arnold a dit : "I\'ll be back"';
echo "<div class ='titre' id ='titre'>";
$str = " La database " .$_SESSION['year'] ." n'existe pas encore !";
die($str);
echo "</div>";
}
//echo $mois_actif;
echo ucfirst($mois) ." " .$annee;
echo '<br><br>';
$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'longue' and mois ='$mois' and mode = 'actif' ";
//echo $sql;
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
if(!$result)
{
die('Impossible d\'exécuter la requête :' . mysql_error());
}
$n = mysqli_num_rows($result);
$flag_setting_longue = "";
if($n != 0)
{
$flag_setting_longue = "ok";
echo "Scéances de " .$_SESSION['temps_sceance_longue'] ." mins sur table + 5 mins pour l'aération";
echo"</br>";
echo"</br>";
//$array_horaire_long = generation_timing("12H30", 30, 5);
$array_horaire_long = generation_timing($_SESSION['debut_horaire_longue'], $_SESSION['temps_sceance_longue'], $_SESSION['temps_sanitaire']);
// echo ' <div id="list">
// <table align="left" bgcolor="#d5d5d5" border="0" cellpadding="5" cellspacing="1" width="100%">
// <tbody><tr bgcolor="#f1f3f5">
// <th align="center" width="1%">Sem</th>
// <th align="center" width="5%">Date</th>
// <th align="center" width="8%">12H00</th>
// <th align="center" width="8%">12H30</th>
// <th align="center" width="8%">13H</th>
// <th align="center" width="8%">13H30</th>
// <th align="center" width="8%">14H00</th>
// <th align="center" width="8%">14H30</th>
// <th align="center" width="8%">15H00</th>
// <th align="center" width="8%">15H30</th>
// <th class="center" width="1%">Réservation</th>
// </tr>';
echo ' <div id="list">
<table align="left" bgcolor="#d5d5d5" border="0" cellpadding="5" cellspacing="1" width="100%">
<tbody><tr bgcolor="#f1f3f5">
<th align="center" width="1%">Sem</th>
<th align="center" width="5%">Date</th>
<th align="center" width="8%">' .$array_horaire_long[0] .'</th>
<th align="center" width="8%">' .$array_horaire_long[1] .'</th>
<th align="center" width="8%">' .$array_horaire_long[2] .'</th>
<th align="center" width="8%">' .$array_horaire_long[3] .'</th>
<th align="center" width="8%">' .$array_horaire_long[4] .'</th>
<th align="center" width="8%">' .$array_horaire_long[5] .'</th>
<th align="center" width="8%">' .$array_horaire_long[6] .'</th>
<th align="center" width="8%">' .$array_horaire_long[7] .'</th>
<th class="center" width="1%">Réservation</th>
</tr>';
while ($datas = mysqli_fetch_assoc ($result))
{
$id = $datas['id'];
$rendezvous = $datas['rendezvous'];
$mode = $datas['mode'];
$jour = $datas['jour'];
$ts = $datas['ts'];
$semaine = $datas['semaine'];
$seance1 = $datas['seance1'];
$seance2 = $datas['seance2'];
$seance3 = $datas['seance3'];
$seance4 = $datas['seance4'];
$seance5 = $datas['seance5'];
$seance6 = $datas['seance6'];
$seance7 = $datas['seance7'];
$seance8 = $datas['seance8'];
switch ($jour)
{
case "Lundi":
$jour_sem = "LUN ";
break;
case "Mardi":
$jour_sem = "MAR ";
break;
case "Mercredi":
$jour_sem = "MER ";
break;
case "Jeudi":
$jour_sem = "JEU ";
break;
case "Vendredi":
$jour_sem = "VEN ";
break;
}
//$mois
$jour_du_mois = substr($rendezvous, 0, 2);
$date = $jour_sem ." " .$jour_du_mois ." " .ucfirst($mois);
echo '
<tr>
<td align="center" nowrap="nowrap">'.$semaine.'</td>
<td align="center" nowrap="nowrap">'.$date.'</td>';
for( $i=1; $i <= 8 ; $i++)
{
${'text'.$i} = "seance".$i;
$val = ${'text'.$i};
$n = 0;
$test = strpos($datas[$val], " ");
if($test != 0)
{ //echo $datas[$val];
//echo '<br>';
if($datas[$val] != "creneau fermer" && $datas[$val] != "creneau ouvert")
{
if( $_SESSION['nom'] != "admin")
{
if($ts < $ts_du_jour)
{
echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
}
else
{
if($utilisateur == $datas[$val]) // #f9f21b
{
//echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?formule=longue&mois='.$mois.'&jour='.$rendezvous.'&horaire=' //.$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
$s = "supprimer.php?formule=longue&mois=$mois&jour=$rendezvous&horaire=$val&client=$datas[$val]";
// <a href=$s class="button">Link Button</a>
//$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'longue' and mois ='$mois' and mode = 'actif' ";
//ok echo "<td align='center' >" . "<a href='https://www.w3schools.com' class='button' >Visit W3Schools</a>" ."</td>";
// ok echo "<td align='center' class='button' >" . "<a href= '$s' class='button' title='Suppression du créneau'> $datas[$val] </a>" ."</td>";
echo "<td align='center' >" . "<a href= '$s' class='btn' title='Suppression du créneau'> $datas[$val] </a>" ."</td>";
}
else
{
echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
}
}
}
//else
//{
// echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
// }
if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?formule=longue&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
}
}
}
if($datas[$val] == '')
{
echo '<td bgcolor ="#84E673" align="center"></td>';
}
if($datas[$val] == "unselect")
{
echo ' <td bgcolor ="#E6BA39" align="center">Inactif</td>';
}
if($datas[$val] == "creneau ouvert")
{
if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#E6BA39" align="center">
<a href="affiche_planning03.php?fermer=ok&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Fermeture du nouveau créneau">Supplement fermé</td>';
}
}
if($datas[$val] == "creneau fermer")
{ //echo '<td bgcolor ="#E6FF39" align="center">Supplement fermé</td>';
if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#E6BA39" align="center">
<a href="affiche_planning03.php?ouvrir=ok&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Ouverture d\'un nouveau créneau">Supplement fermé</td>';
}
else
{
echo '<td bgcolor ="#E6BA39" align="center">Inactif</td>';
}
}
/*if($datas[$val] == "creneau ouvert")
{ echo '<td bgcolor ="#84E673" align="center"></td>';
}*/
/* else
{
if($datas[$val] == "unselect")
{ if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#E6BA39" align="center"><a href="ouvrir.php?mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Ouverture d\'un nouveau créneau">Inactif</td>';
}
else
{
echo ' <td bgcolor ="#E6BA39" align="center">Inactif</td>';
}
}
else
{
if($datas[$val] == $utilisateur || $_SESSION['nom'] == "admin")
{
if($ts < $ts_du_jour)
{
echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
}
else
{
echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
}
}
else
{
echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
}
}
}*/
}// for
////////// bloquage si le jour est derriére nous ...
if($ts >= $ts_du_jour && $_SESSION['nom'] != "admin" )
{
echo '
<td align="center" width="1%">
<a href="reservation_longue02.php?formule=longue&mois='.$mois.'&jour='.$rendezvous.'">
<img src="calendar.png" border="0" alt="Réserver" title="Réservation"></a>
</td>';
}
if($ts < $ts_du_jour && $_SESSION['nom'] != "admin")
{
echo '<td align="center" width="1%">
<img src="delete.png" border="0" alt="impossible" title="impossible">
</td>';
}
if($_SESSION['nom'] == "admin")
{
echo '
<td align="center" width="1%">
<a href="reservation_longue02.php?formule=longue&mois='.$mois.'&jour='.$rendezvous.'">
<img src="calendar.png" border="0" alt="Réserver" title="Réservation"></a>
</td>';
}
} // while
echo ' <tr bgcolor="#f1f3f5">
<td colspan="11" class="center"> </td>
</tr>
</tbody>
</table>
</div> ';
}
else
{
// echo "Ce mois n'est pas configuré.";
//echo "Ce mois ne comporte pas de scéances ayant une durée de 30 min !.";
$flag_setting_longue = "none";
}
/*************************************************/
/*if($n != 0)
{
echo '<br><br>';
echo " ";
echo '<br><br>';
}*/
$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'courte' and mois ='$mois' and mode = 'actif' ";
mysqli_query($connexion, "SET NAMES 'utf8'");
$result = mysqli_query($connexion, $sql );
if(!$result)
{
die('Impossible d\'exécuter la requête :' . mysql_error());
}
$n = mysqli_num_rows($result);
$flag_setting_courte = "";
if($n != 0)
{
//echo '<br><br>';
//echo " ";
//echo '<br><br>';
$flag_setting_courte = "ok";
//$array_horaire_court = generation_timing("12H30", 20, 5);
$array_horaire_court = generation_timing($_SESSION['debut_horaire_courte'], $_SESSION['temps_sceance_courte'], $_SESSION['temps_sanitaire']);
echo"</br>";
echo"</br>";
echo "Scéances de " .$_SESSION['temps_sceance_courte'] ." mins + 5 mins pour l'aération";
echo"</br>";
echo"</br>";
// echo ' <div id="list">
// <table align="left" bgcolor="#d5d5d5" border="0" cellpadding="5" cellspacing="1" width="100%">
// <tbody><tr bgcolor="#f1f3f5">
// <th align="center" width="1%">Sem</th>
// <th align="center" width="5%">Date</th>
// <th align="center" width="8%">12H20</th>
// <th align="center" width="8%">12H40</th>
// <th align="center" width="8%">13H</th>
// <th align="center" width="8%">13H20</th>
// <th align="center" width="8%">13H40</th>
// <th align="center" width="8%">14H</th>
// <th align="center" width="8%">14H20</th>
// <th align="center" width="8%">14H40</th>
// <th class="center" width="1%">Réservation</th>
// </tr>';
echo ' <div id="list">
<table align="left" bgcolor="#d5d5d5" border="0" cellpadding="5" cellspacing="1" width="100%">
<tbody><tr bgcolor="#f1f3f5">
<th align="center" width="1%">Sem</th>
<th align="center" width="5%">Date</th>
<th align="center" width="8%">' .$array_horaire_court[0] .'</th>
<th align="center" width="8%">' .$array_horaire_court[1] .'</th>
<th align="center" width="8%">' .$array_horaire_court[2] .'</th>
<th align="center" width="8%">' .$array_horaire_court[3] .'</th>
<th align="center" width="8%">' .$array_horaire_court[4] .'</th>
<th align="center" width="8%">' .$array_horaire_court[5] .'</th>
<th align="center" width="8%">' .$array_horaire_court[6] . '</th>
<th align="center" width="8%">' .$array_horaire_court[7] . '</th>
<th class="center" width="1%">Réservation</th>
</tr>';
while ($datas = mysqli_fetch_assoc ($result))
{
$id = $datas['id'];
$rendezvous = $datas['rendezvous'];
$mode = $datas['mode'];
$jour = $datas['jour'];
$ts = $datas['ts'];
$semaine = $datas['semaine'];
$seance1 = $datas['seance1'];
$seance2 = $datas['seance2'];
$seance3 = $datas['seance3'];
$seance4 = $datas['seance4'];
$seance5 = $datas['seance5'];
$seance6 = $datas['seance6'];
$seance7 = $datas['seance7'];
$seance8 = $datas['seance8'];
if( $debug == true )
{
echo "<pre>";
print_r($datas);
echo "</pre>";
echo $seance1 ."<br>";
echo $seance2 ."<br>";
echo $seance3 ."<br>";
echo $seance4 ."<br>";
echo $seance5 ."<br>";
echo $seance6 ."<br>";
echo $seance7 ."<br>";
echo $seance8 ."<br>";
}
switch ($jour)
{
case "Lundi":
$jour_sem = "LUN ";
break;
case "Mardi":
$jour_sem = "MAR ";
break;
case "Mercredi":
$jour_sem = "MER ";
break;
case "Jeudi":
$jour_sem = "JEU ";
break;
case "Vendredi":
$jour_sem = "VEN ";
break;
}
//$mois
$jour_du_mois = substr($rendezvous, 0, 2);
$date = $jour_sem ." " .$jour_du_mois ." " .ucfirst($mois);
echo '
<tr>
<td align="center" nowrap="nowrap">'.$semaine.'</td>
<td align="center" nowrap="nowrap">'.$date.'</td>';
for( $i=1; $i <= 8 ; $i++)
{
${'text'.$i} = "seance".$i;
$val = ${'text'.$i};
$n = 0;
$test = strpos($datas[$val], " ");
if($test != 0)
{ //echo $datas[$val];
//echo '<br>';
// <a href="#" class="button">Link Button</a>
if($datas[$val] != "creneau fermer" && $datas[$val] != "creneau ouvert")
{
if( $_SESSION['nom'] != "admin")
{
if($ts < $ts_du_jour)
{
echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val] .'</td>';
}
else
{
//echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?formule=courte&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
if($utilisateur == $datas[$val])
{
//echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?formule=courte&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
//echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?formule=courte&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
$s = "supprimer.php?formule=courte&mois=$mois&jour=$rendezvous&horaire=$val&client=$datas[$val]";
// <a href=$s class="button">Link Button</a>
//$sql = "SELECT * FROM " .$table ." WHERE annee ='$annee' and formule = 'longue' and mois ='$mois' and mode = 'actif' ";
//ok echo "<td align='center' >" . "<a href='https://www.w3schools.com' class='button' >Visit W3Schools</a>" ."</td>";
// ok echo "<td align='center' class='button' >" . "<a href= '$s' class='button' title='Suppression du créneau'> $datas[$val] </a>" ."</td>";
echo "<td align='center' >" . "<a href= '$s' class='btn' title='Suppression du créneau'> $datas[$val] </a>" ."</td>";
}
else
{
//echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
}
}
}
//else
//{
// echo '<td bgcolor ="#E84A35" align="center">' .$datas[$val]. '</td>';
// }
if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#E84A35" align="center"><a href="supprimer.php?formule=courte&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'&client='.$datas[$val].'" title="Suppression">' .$datas[$val]. '</td>';
}
}
}
if($datas[$val] == '')
{
if($_SESSION['nom'] == "admin")
{
/*$eval = $i - 1;
if( $eval== 0 && $avant ==1 ) //&& $seance1 ="")
{
echo '<td bgcolor ="#84E673" align="center">
<a href="affiche_planning03.php?fermer=ok&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Fermeture du créneau">Supplement ouvert</td>';
}
if( $eval== 5 && $avant ==1 ) //&& $seance1 ="")
{
echo '<td bgcolor ="#84E673" align="center">
<a href="affiche_planning03.php?fermer=ok&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Fermeture du créneau">Supplement ouvert</td>';
}*/
echo '<td bgcolor ="#84E673" align="center"></td>';
}
else
{
echo '<td bgcolor ="#84E673" align="center"></td>';
}
}
if($datas[$val] == "unselect")
{
echo ' <td bgcolor ="#E6BA39" align="center">Inactif</td>';
}
if($datas[$val] == "creneau fermer")
{
if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#E6BA39" align="center">
<a href="affiche_planning03.php?ouvrir=ok&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Ouverture du nouveau créneau">Supplement fermé</td>';
}
else
{
echo '<td bgcolor ="#E6BA39" align="center">Inactif</td>';
}
}
if($datas[$val] == "creneau ouvert")
{
if($_SESSION['nom'] == "admin")
{
echo '<td bgcolor ="#84E673" align="center">
<a href="affiche_planning03.php?fermer=ok&mois='.$mois.'&jour='.$rendezvous.'&horaire=' .$val .'" title="Fermeture du nouveau créneau">Supplement ouvert</td>';
}
else
{
echo '<td bgcolor ="#84E673" align="center"></td>';
}
}
}// for
////////// bloquage si le jour est derriére nous ...
if($ts >= $ts_du_jour && $_SESSION['nom'] != "admin" )
{
echo '
<td align="center" width="1%">
<a href="reservation_courte02.php?formule=courte&mois='.$mois.'&jour='.$rendezvous.'">
<img src="calendar.png" border="0" alt="Réserver" title="Réservation"></a>
</td>';
}
if($ts < $ts_du_jour && $_SESSION['nom'] != "admin")
{
echo '<td align="center" width="1%">
<img src="delete.png" border="0" alt="impossible" title="impossible">
</td>';
}
if($_SESSION['nom'] == "admin")
{
echo '
<td align="center" width="1%">
<a href="reservation_courte02.php?formule=courte&mois='.$mois.'&jour='.$rendezvous.'">
<img src="calendar.png" border="0" alt="Réserver" title="Réservation"></a>
</td>';
}
} // while
echo ' <tr bgcolor="#f1f3f5">
<td colspan="11" class="center"> </td>
</tr>
</tbody>
</table>
</div> ';
}
else
{
// echo "Ce mois n'est pas configuré.";
//echo "Ce mois ne comporte pas de scéances ayant une durée de 20 min !.";
$flag_setting_courte = "none";
}
// double condition pour les creneaux de 20 et 30 min
if( $flag_setting_longue == "none" && $flag_setting_courte == "none" )
{
echo "Ce mois n'est pas configuré.";
}
/************************************************/
$tab_retour = compteur_reservation($mois);
$cpt = count($tab_retour);
echo '<br>';
echo '<br>';
echo '<br>';
echo '<br>';
if($cpt == 0)
{
echo "Actuellement, aucun créneau n'a été réservé.";
}
if($cpt == 1)
{
echo "Actuellement, 1 créneau est réservé.";
}
if($cpt > 1)
{
echo "Actuellement, " .$cpt . " créneaux ont été réservés";
}
?>
</body>
</html>