summaryrefslogtreecommitdiff
path: root/appli_3_alpha_old/index.php
blob: 0cf65e884c887be9962f6d117e72c05ef9d8ff45 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
require('include/ludo/session_verify.inc.php');
require_once('include/ludo/html_elements.inc.php');
generate_html_doctype_and_head("Mod�le");
echo "<body>\n";
generate_html_divs_menu();
?>
	<div id="sous_menu">
		<p class="arbre">
		&gt; <a href="index.php">Accueil</a>
		&gt; <a href="index.php">R&eacute;unions</a>
		&gt; Liste des r&eacute;unions
		</p>
	</div>
<?php
generate_html_div_help();
?>
	<div id="contenu">
<?php
	$idP= $_SESSION['idP'];
	if ( isset( $_SESSION['prenomP'] ) && isset( $_SESSION['prenomP'] ) )
	{ $nom=$_SESSION['prenomP'] . ' ' . $_SESSION['nomP']; }
	else { $nom = $_SESSION['loginP']; }
	
	echo "Bonjour $nom, nous sommes le " . date('d/m/Y') . ' et il est ' . date('H:i');
	echo "<pre>DEBUG : _SESSION :\n";
	print_r($_SESSION);
	echo "\nDEBUG : _REQUEST :\n";
	print_r($_REQUEST);
	echo "</pre>\n";
	
?>
	<br/><br/>
	<a href="organiser.php">Organiser une r&eacute;union</a>
	<br/><br/>
	<table class="listeReunions" summary="Liste des r�unions vous concernant">
		<tr>
			<th>Objet</th>
			<th>Organisateur</th>
			<th>Date</th>
			<th>Etat</th>
			<th>D&eacute;tails</th>
		</tr>
<?php
	// Connexion � la base et s�lection de la database
	require_once 'include/connect.inc.php';
	
	function fill_array_liste_reunion($query)
	{
		if ( ! $result = @mysql_query($query) ) 
		{
			require_once('fonctions.inc.php');
			$errmsg=mysql_generate_errmsg();
		}
		else
		{
			// On �crit ligne � ligne les personnes et les disponibilit�s
			while ( list($idR, $objetR, $nomP, $prenomP, $dateR) = mysql_fetch_array($result) )
			{
				// Boucle sur chaque personne
				echo "		<tr>\n";
				echo '			<td><a href="details_reunion.php?idR=' . $idR . '">' . "$objetR</td>\n";
				echo "			<td>$prenomP $nomP</td>\n";
				$dateStr='';
				$stateStr='En pr�paration';
				if ( isset($dateR) )
				{
					$dateStr=date('d/m/Y \� H:i', $dateR);
					if ( $dateR > time() )
					{
						$stateStr='Fix�e';
					}
					else
					{
						$stateStr='Pas�e';
					}
				}
				echo "			<td>$dateStr</td>\n";
				echo "			<td>$stateStr</td>\n";
				echo '			<td>';
				generate_html_reunion_detail_button($idR);
				echo "</td>\n";
				echo "		</tr>\n";
			}
		}
	}


	// R�unions fix�es et pass�es
	$query = 'SELECT DISTINCT R.idR, R.objetR, P.nomP, P.prenomP, UNIX_TIMESTAMP(C.dateHeure)'
		. ' FROM Liste L,Reunion R,Appartenir A,Creneau C,Personne P'
		. " WHERE ((A.idP = $idP AND A.idL = L.idL) OR R.idP_Orga = $idP)"
		. ' AND  R.idL = L.idL AND P.idP = R.idP_Orga AND R.idC_Fixe = C.idC'
		. ' ORDER BY C.dateHeure DESC;';
	fill_array_liste_reunion($query);

	// R�union en pr�paration
	$query = 'SELECT DISTINCT R.idR, R.objetR, P.nomP, P.prenomP, NULL'
		. ' FROM Liste L,Reunion R,Appartenir A,Personne P' // Creneau C,
		. " WHERE ((A.idP = $idP AND A.idL = L.idL) OR R.idP_Orga = $idP)"
		. ' AND  R.idL = L.idL AND P.idP = R.idP_Orga AND ISNULL(R.idC_Fixe);';
	//echo "DEBUG : $query\n";
	fill_array_liste_reunion($query);
	
	//$query = 
	//echo "DEBUG : $query\n";
?>
	</table>
	<br/>
	<a href="organiser.php">Organiser une r&eacute;union</a>
	</div>
<?php
	if ( isset ($errmsg) ) { generate_html_div_errmsg($errmsg); }
?>
</body>
</html>