diff options
author | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-06-30 10:01:33 +0200 |
---|---|---|
committer | Ludovic Pouzenc <ludovic@pouzenc.fr> | 2018-06-30 10:01:33 +0200 |
commit | 30238f5847b418645983a4efddb13f087c99e585 (patch) | |
tree | 0cec8e6d657bbecab865f75a5c3f8bffc369b47f /test/test-tab_v1.php | |
parent | 052fe50e28a53c3ece30c2ad1090f313b3bb7337 (diff) | |
download | 2007-AWOR-30238f5847b418645983a4efddb13f087c99e585.tar.gz 2007-AWOR-30238f5847b418645983a4efddb13f087c99e585.tar.bz2 2007-AWOR-30238f5847b418645983a4efddb13f087c99e585.zip |
Premiers tests 2007-01-02+20:01:04 - 2007-02-02+16:43:14
Diffstat (limited to 'test/test-tab_v1.php')
-rw-r--r-- | test/test-tab_v1.php | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/test/test-tab_v1.php b/test/test-tab_v1.php new file mode 100644 index 0000000..79d13b1 --- /dev/null +++ b/test/test-tab_v1.php @@ -0,0 +1,103 @@ +<?php +$mysql_host='localhost'; +$mysql_user='lud_restricted'; +$mysql_pass='maille_ess_ku_elle'; +$mysql_base='awor'; +$link = mysql_connect($mysql_host,$mysql_user,$mysql_pass) + or die('Erreur MySql : Impossible de se connecter : ' . mysql_error()); +mysql_select_db($mysql_base) or die('Erreur Mysql : Impossible de sélectionner la database'); + +// Variables récupérées par les $_POST ou dans les sessions (évite les modifications côté client) + +$id_reunion=1; +$id_personne=2; + +echo '<?xml version="1.0" encoding="ISO-8859-1"?>'."\n" +?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr"> + <head> + <title>Tests BD</title> + <link rel="stylesheet" type="text/css" href="style1.css" /> + </head> + <body> +<table class="details" cellspacing="0"> +<thead> +<tr> +<th>Personnes/Creneaux</th> +<?php + $query="SELECT idC, UNIX_TIMESTAMP(dateHeure), duree FROM Creneau WHERE idR='$id_reunion';"; + $creneaux=array(); + if ( $result = mysql_query($query) ) + { + while ( $c = mysql_fetch_row($result) ) + { + $date_deb =$c[1]; + //echo $date_deb . "\n"; + $date_fin = $date_deb + 60 * $c[2]; + echo '<th>' . date('d/m/y', $date_deb) . '<br />' . date('H:i', $date_deb) . ' - ' . date('H:i', $date_fin) . "</th>\n"; + $creneaux[] = $c[0]; + } + } + //print_r($creneaux); +?> +</tr> +</thead> +<tbody> +<?php + // Requette écrivant les disponibilités dans un tableau associatif en une seule fois + $query='SELECT ch.idC, ch.idP, ch.estDispo FROM Choisir ch, Creneau c, Personne p, Appartenir a, Reunion r WHERE ' + ."c.idR=$id_reunion AND r.idR=$id_reunion AND a.idL=r.idL AND p.idP=a.idP AND ch.idC = c.idC AND ch.idP = p.idP;"; + //echo $query . "\n"; + $dispos=array(); + if ( $result = mysql_query($query) ) + { + while ( list($idC, $idP, $estDispo) = mysql_fetch_row($result) ) + { + $dispos[$idC][$idP]=$estDispo; + } + } + //print_r($dispos); + + $query='SELECT p.idP, p.prenomP, p.nomP FROM Personne p, Appartenir a, Reunion r WHERE ' + . "r.idR='$id_reunion' AND a.idL=r.idL AND p.idP=a.idP;"; + if ( $result = mysql_query($query) ) + { + while ( $p = mysql_fetch_array($result) ) + { + // Boucle sur chaque personne + // TODO : vérif car changement de la boucle + echo "<tr>\n<td>$p[1] $p[2]</td>\n"; + // Pour chaque créneau + foreach ( $creneaux as $c_id ) + { + // TODO : voir si l'on est la personne concernée !!! + + // Cas général, on n'est pas la personne concernée + if ( ! isset($dispos[$c_id][$p[0]]) ) + { + // Dispo Inconnue (icone ?) + echo '<td><img src="./images/question.gif" alt="Inconnu" height="15" width="15"></td>' . "\n"; + } + else + { + if ( $dispos[$c_id][$p[0]] == 'oui' ) + { + // Disponible + echo '<td><img src="./images/ok.gif" alt="Disponible" height="16" width="16"></td>' . "\n"; + }else + { + // Non Disponible + echo '<td><img src="./images/del.gif" alt="Non disponible" height="15" width="15"></td>' . "\n"; + } + } + } + echo "</tr>\n"; + } + } +?> +</tbody> +</table> +</body> +</html> + |