<?
#########################################################################################
# Impression d'une fiche élève de Pnyx #
# Auteur : V. Blais #
# Création : 2006-05-02 #
# Modification : 2008-09-10 #
# #
# Pnyx - une application Web (PHP/MySQL) d'élections virtuelles conçue pour des élèves #
# du primaire et du secondaire, dans lequel ils sont amenés à faire des propositions #
# en ligne et voter pour leur favorite, sous la supervision d'un enseignant. #
# #
# Copyright (C) <2008 - 2009> #
# <Service national du RÉCIT de l'univers social de la Commission scolaire de la #
# Pointe-de-l'Île> #
# #
# This program is free software; you can redistribute it and/or modify it under the #
# terms of the GNU General Public License as published by the Free Software Foundation. #
# This program is distributed in the hope that it will be useful, but WITHOUT ANY #
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A #
# PARTICULAR PURPOSE. See the GNU General Public License for more details. #
# You should have received a copy of the GNU General Public License along with this #
# program as the file LICENSE.txt; if not, please see #
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. #
# #
# Service national du RÉCIT de l'univers social #
# http://www.recitus.qc.ca #
# Contact e-mail : steve-hide@address.com #
#########################################################################################
require "entete_php.php";
/*session_name("cliquez");
session_start();
bd_connexion();*/
# ou verifier si la session est valide
# puis verifier si l'usager dispose des autorisations requises
# pour la saisie
verifier_session();
acces_resp("ges_eleve.php");
/*$idp = $HTTP_SESSION_VARS[SESSION][projet];
$periode = $HTTP_SESSION_VARS[SESSION][periode];*/
if ($HTTP_GET_VARS['id_eleve'] != 0){
$requete_sql = "SELECT *
FROM eleve
WHERE eleve_id = '" . $HTTP_GET_VARS['id_eleve'] . "'
";
$reponse_eleve = bd_executer_sql($requete_sql);
$ligne_eleve = mysql_fetch_array($reponse_eleve);
$requete_sql = "SELECT *
FROM usager
WHERE usager_id = '" . $ligne_eleve['usager_id'] . "'
";
$reponse_log = bd_executer_sql($requete_sql);
$ligne_log = mysql_fetch_array($reponse_log);
$requete_sql = "SELECT *
FROM groupe
WHERE groupe_id = '" . $ligne_eleve['groupe_id'] . "'
";
$reponse_grp = bd_executer_sql($requete_sql);
$ligne_groupe = mysql_fetch_array($reponse_grp);
$requete_sql = "SELECT *
FROM fiche
WHERE eleve_id = '" . $ligne_eleve['eleve_id'] . "'
";
$reponse_fiche = bd_executer_sql($requete_sql);
$ligne_fiche = mysql_fetch_array($reponse_fiche);
$nb_fiche = mysql_num_rows($reponse_fiche);
} else if ($HTTP_GET_VARS['id_groupe'] != 0){
$requete_sql = "SELECT *
FROM eleve
WHERE groupe_id = \"$HTTP_GET_VARS[id_groupe]\"
ORDER BY nom
";
$reponse_eleve = bd_executer_sql($requete_sql);
$requete_sql = "SELECT *
FROM groupe
WHERE groupe_id = \"$HTTP_GET_VARS[id_groupe]\"
";
$reponse_grp = bd_executer_sql($requete_sql);
$ligne_groupe = mysql_fetch_array($reponse_grp);
}
$requete_sql = "SELECT titre
FROM site_parametres";
$reponse_titre = mysql_query($requete_sql);
$ligne_titre = mysql_fetch_array($reponse_titre);
?>
<!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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?= $ligne_titre['titre'] ?></title>
<script type="text/javascript" src="lib/fonctions.js"></script>
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-1684383-1";
urchinTracker();
</script>
</head>
<body>
<?
if($ligne_groupe['resp_id'] == $usager || $niveau == "admin"){
?>
<a name="haut" id="haut"></a>
<table width="580">
<tr>
<td>
<?
if ($HTTP_GET_VARS['id_eleve'] != 0){
?>
<h3>Impression du compte de
<?= $ligne_eleve['prenom']." ". $ligne_eleve['nom']?></h3>
<table width="580" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="233" valign="top">Nom d'utilisateur :</td>
<td width="345"><?= $ligne_log['login'] ?></td>
</tr>
<tr>
<td valign="top">Groupe classe :</td>
<td><?= $ligne_groupe['nom']?></td>
</tr>
<tr>
<td valign="top">Niveau scolaire :</td>
<td><?= $ligne_groupe['niveau']?></td>
</tr>
<tr>
<td valign="top">Statut de l'élève :</td>
<td><? if ($ligne_eleve['candidat'] == 1) echo "candidat"; else echo "électeur"; ?></td>
</tr>
<?
if ($ligne_eleve['valide'] == 0){
?>
<tr>
<td valign="top">Statut de l'inscription :</td>
<td>l'inscription de l'élève n'est toujours pas validée </td>
</tr>
<?
}else{
?>
<tr>
<td valign="top">Statut de l'inscription :</td>
<td>validée le <?= date_fr($ligne_eleve['date_valide']) ?></td>
</tr>
<?
if ($ligne_eleve['candidat'] == 1){
?>
<tr>
<td valign="top"><strong>Statut de la fiche de candidature : </strong></td>
<td>
<?
if ($ligne_fiche['valide'] == "1"){
echo "<strong>validée le ".date_fr($ligne_fiche['date_valide'])."</strong>";
}else if ($ligne_fiche['date_soumis'] != "0000-00-00" && $ligne_fiche['date_soumis'] != ""){
echo "<strong>soumise par l'élève le ".date_fr($ligne_fiche['date_soumis'])."</strong>";
} else if ($ligne_fiche['desactive'] == 1){
echo "<strong>désactivée pour que l'élève puisse la retravailler</strong>";
} else {
echo "<strong>toujours en travail par l'élève</strong>";
}
?></td>
</tr>
</table>
<br/>
<hr width="400" align="center" />
<br />
<table cellpadding="0" cellspacing="0" width="580" align="center" border="0">
<tr>
<td><p><strong>Slogan : </strong>
<?
if ($nb_fiche == 0){
echo "L'élève n'a pas défini de slogan.";
} else {
if ($ligne_fiche['slogan'] == ""){
echo "L'élève n'a pas défini de slogan.";
} else {
echo $ligne_fiche['slogan'];
}
}
?></p>
<p><strong>Pancarte électorale :</strong></p>
<?
if ($ligne_fiche['affiche'] == ""){
$affiche = "images/gen_affiche.jpg";
} else {
$affiche = $ligne_fiche['affiche'];
}
?>
<br />
<div align="center"><img src="<?= $affiche ?>" alt="affiche" /></div></td>
</tr>
<tr>
<td align="center">
<?
if($ligne_fiche['aff_source'] != ""){
?>
<strong>Source de l'image :</strong><?= $ligne_fiche['aff_source'] ?>
<?
}
?>
</td>
</tr>
<?
if ($nb_fiche == 0){
echo "<tr>
<td valign=\"top\" colspan=\"2\"><strong>Il n'y a aucune proposition.</strong><br /></td>
</tr><tr>
<td colspan=\"2\"> </td>
</tr>";
} else {
?>
<tr><td>
<p><strong><br />
Proposition : <?= $ligne_fiche['slogan']?>
</strong></p>
<blockquote>
<p><strong>Niveau :</strong> <?= $ligne_fiche['niveau']?></p>
<?
$requete_sql = "SELECT nom
FROM categorie_prop
WHERE cat_id = \"$ligne_fiche[categorie]\"
";
$reponse_catNom = mysql_query($requete_sql);
$ligne_catNom = mysql_fetch_array($reponse_catNom);
?>
<p><strong>Catégorie :</strong> <?= $ligne_catNom['nom']?></p>
<p><strong>Explication :</strong></p> <?= nl2br($ligne_fiche['proposition'])?>
<p><strong>Appréciation :</strong>
<?
if ($ligne_fiche['app_moyenne'] < 0.50){
echo "<img src='images/etoile_0.jpg' alt='0' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 0.99){
echo "<img src='images/etoile_0_5.jpg' alt='0,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 1.50){
echo "<img src='images/etoile_1.jpg' alt='1' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 2.00){
echo "<img src='images/etoile_1_5.jpg' alt='1,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 2.50){
echo "<img src='images/etoile_2.jpg' alt='2' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 3.00){
echo "<img src='images/etoile_2_5.jpg' alt='2,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 3.50){
echo "<img src='images/etoile_3.jpg' alt='3' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 4.00){
echo "<img src='images/etoile_3_5.jpg' alt='3,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 4.50){
echo "<img src='images/etoile_4.jpg' alt='4' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 5.00){
echo "<img src='images/etoile_4_5.jpg' alt='4,5' align='middle' />";
} else {
echo "<img src='images/etoile_5.jpg' alt='5' align='middle' />";
}
?>
/
<?
if ($ligne_fiche['app_nb'] > 1){
echo " ".$ligne_fiche['app_nb']." appréciations";
} else if ($ligne_fiche['app_nb'] == 1){
echo " ".$ligne_fiche['app_nb']." appréciation";
}
?>
</p>
<?
if ($periode == "fin_vote" || periode == "vote"){
$requete_sql = "SELECT E.nb_votes FROM election E
WHERE E.projet_id = $projet
AND E.final_id = '".$ligne_loc['fiche_id']."'
";
$reponse_fin = bd_executer_sql($requete_sql);
$nb_fin = mysql_num_rows($reponse_fin);
if ($nb_fin >0){
$fin = mysql_fetch_array($reponse_fin);
?>
<p>
<strong>Nombre de votes :</strong>
<?=$fin['app_nb']?>
</p>
<?
}
}
}
?>
</blockquote></td></tr></table>
<br />
<?
}
}
?>
<table width="580"><tr><td>
<p><strong>Discussion :</strong></p>
<?
#REQUÊTE FIL DE DISCUSSION
$requete_sql = "SELECT DISTINCT F.*
FROM fil_discussion F, msg_fil M
WHERE F.projet_id = $projet
AND (M.destinataire = \"$ligne_eleve[eleve_id]\"
OR (M.auteur = \"$ligne_eleve[eleve_id]\"
AND M.type_auteur = \"eleve\"))
AND F.fil_id = M.fil_id
ORDER BY F.date_last_msg DESC
";
$reponse_disc = bd_executer_sql($requete_sql);
$nb_disc = mysql_num_rows($reponse_disc);
if ($nb_disc == 0){
echo "<p>L'élève ne participe à aucune discussion.</p>";
}else{
while ($ligne_disc = mysql_fetch_array($reponse_disc)){
?>
<table border="1" width="580"><tr><td>
<?
$requete_sql = "SELECT *
FROM msg_fil
WHERE fil_id = \"$ligne_disc[fil_id]\"
AND projet_id = $projet
ORDER BY date ASC
";
$reponse_msgf = bd_executer_sql($requete_sql);
while ($ligne_msgf = mysql_fetch_array($reponse_msgf) ){
$date = date_fr(substr($ligne_msgf['date'], 0,10))." à ".substr($ligne_msgf['date'], 11, 5);
if ($ligne_msgf['type_auteur'] == "admin"){
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#CCCCCC'>
<tr>
<td valign="top"><strong><?=$date?></strong></td><td align='right'>Auteur: Administrateur</td>
</tr>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=$ligne_msgf['texte']?></blockquote></td></tr>
</table>
<?
} else if ($ligne_msgf['type_auteur'] == "resp"){
$requete_sql = "SELECT nom, prenom
FROM responsable
WHERE resp_id = '".$ligne_msgf['auteur']."'
";
$reponse_r = bd_executer_sql($requete_sql);
$ligne_r = mysql_fetch_array($reponse_r);
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#99CC66'>
<tr>
<td valign="top"><strong><?=$date?></strong></td><td align='right'>Auteur: <?= $ligne_r['prenom']." ".$ligne_r['nom']?><br />
Enseignant</td>
</tr>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=$ligne_msgf['texte']?></blockquote></td></tr>
</table>
<?
} else if ($ligne_msgf['auteur'] == $ligne_eleve['eleve_id']){
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#FFFFCC'>
<tr>
<td valign="top"><strong><?=$date?></strong></td><td align='right'>Auteur: <?= $ligne_log['login']?></td>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=nl2br($ligne_msgf['texte'])?></blockquote></td></tr>
</table>
<?
} else {
$requete_sql = "SELECT candidat
FROM eleve
WHERE eleve_id = '".$ligne_msgf['auteur']."'
";
$reponse_cand = bd_executer_sql($requete_sql);
$ligne_cand = mysql_fetch_array($reponse_cand);
if ($ligne_cand['candidat'] == 1){
$type_eleve = "Élève candidat";
} else {
$type_eleve = "Élève électeur";
}
$requete_sql = "SELECT U.login
FROM usager U, eleve E
WHERE E.eleve_id = \"$ligne_msgf[auteur]\"
AND U.usager_id = E.usager_id
";
$reponse_autre = bd_executer_sql($requete_sql);
$ligne_autre = mysql_fetch_array($reponse_autre);
$requete_sql = "SELECT fiche_id
FROM fiche
WHERE eleve_id = \"$ligne_msgf[auteur]\"
AND projet_id = $projet";
$reponse_lien = bd_executer_sql($requete_sql);
$ligne_lien = mysql_fetch_array($reponse_lien);
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#99CCFF'>
<tr>
<td valign="top"><strong><?=$date?></strong></td>
<td align='right'>Auteur: <a href="fiche.php?id_prop=<?=$ligne_lien['prop_id']?>"><?=$ligne_autre['login']?></a><br /><?=$type_eleve?></td></tr>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=nl2br($ligne_msgf['texte'])?></blockquote></td></tr>
</table>
<?
}
}
?>
</td></tr></table>
<?
}
}
?>
<p> </p></td></tr></table>
<?
$requete_sql = "SELECT *
FROM eleve
WHERE eleve_id = '".$ligne_eleve['eleve_id']."'
AND projet_id = $projet
";
$reponse_vote = bd_executer_sql($requete_sql);
$ligne_vote = mysql_fetch_array($reponse_vote);
if($ligne_vote['vote'] > 0){
$ligne_vote = mysql_fetch_array($reponse_vote);
$requete_sql = "SELECT *
FROM election
WHERE fiche_id = \"$ligne_vote[fiche_vote]\"
";
$reponse_final = bd_executer_sql($requete_sql);
$ligne_final = mysql_fetch_array($reponse_final);
$requete_sql = "SELECT *
FROM fiche
WHERE eleve_id = \"$ligne_vote[eleve_id]\"
";
$reponse_fiche = bd_executer_sql($requete_sql);
$ligne_fiche = mysql_fetch_array($reponse_fiche);
$requete_sql = "SELECT *
FROM eleve E, usager U
WHERE E.eleve_id = \"$ligne_vote[eleve_id]\"
AND U.usager_id = E.usager_id
";
$reponse_eleve = bd_executer_sql($requete_sql);
$ligne_eleve = mysql_fetch_array($reponse_eleve);
$requete_sql = "SELECT *
FROM groupe
WHERE groupe_id = \"$ligne_eleve[groupe_id]\"
";
$reponse_grp = bd_executer_sql($requete_sql);
$ligne_grp = mysql_fetch_array($reponse_grp);
$requete_sql = "SELECT E.nom
FROM ecole E, responsable R
WHERE R.resp_id = \"$ligne_grp[resp_id]\"
AND E.ecole_id = R.ecole_id
";
$reponse_ecole = bd_executer_sql($requete_sql);
$ligne_ecole = mysql_fetch_array($reponse_ecole);
?>
<p><strong>L'élève a voté pour :</strong></p>
<table cellpadding="0" cellspacing="0" width="580" border="0" align="center">
<tr>
<td align="left" width="200">
<?
if ($ligne_fiche['affiche'] == ""){
$affiche = "images/gen_affiche.jpg";
} else {
$affiche = $ligne_fiche['affiche'];
}
list($width) = getimagesize($affiche);
if ($width > 200){
echo "<img src=".$affiche." alt='affiche' width='200'/>";
} else {
?>
<img src='<?=$affiche?>' alt='affiche'/>
<?
}
?>
<td align="center" width="380">
<table cellpadding="0" cellspacing="0" width="95%" align="right">
<tr><td colspan="2"><strong><?=$ligne_fiche['slogan']?></strong></td></tr>
<tr>
<td width="30%">Auteur :</td>
<td width="70%"><?=$ligne_eleve['login']?></td>
</tr>
<tr>
<td>Niveau : </td>
<td><?=$ligne_fiche['niveau']?></td>
</tr>
<tr>
<td>Catégorie : </td>
<td>
<?
$requete_sql = "SELECT nom
FROM categorie_prop
WHERE cat_id = \"$ligne_fiche[categorie]\"
";
$reponse_catNom = mysql_query($requete_sql);
$ligne_catNom = mysql_fetch_array($reponse_catNom);
?>
<?=$ligne_catNom['nom']?>
</td>
</tr>
<tr>
<td>École : </td>
<td><?=$ligne_ecole['nom']?></td>
</tr>
<tr>
<td>Niveau scolaire : </td>
<td><?=$ligne_grp['niveau']?></td>
</tr>
<tr>
<td>Groupe : </td>
<td><?=$ligne_grp['nom']?></td>
</tr>
</table>
</td></tr>
<tr><td colspan="2"><p><strong>Texte de la proposition :</strong></p><?= nl2br($ligne_fiche['proposition']) ?></td></tr>
<tr><td colspan="2"><p><strong>Justification du vote :</strong></p>
<p><?=$ligne_vote['justification']?></p></td></tr>
</table>
<?
} else {
?>
<p><strong>L'élève n'a pas encore voté.</strong></p>
<?
}
?>
<?
} else if ($HTTP_GET_VARS['id_groupe'] != 0){
echo "<h3>Impression du compte des élèves du groupe ".$ligne_groupe['nom']."</h3>
<p><strong>Niveau scolaire :</strong> ".$ligne_groupe['niveau']."</p>
<p><strong>Type de groupe :</strong> ".$ligne_groupe['type']."</p>
<br />
<hr align='center' width='400' /><blockquote>";
while($ligne_eleve = mysql_fetch_array($reponse_eleve)){
$requete_sql = "SELECT *
FROM usager
WHERE usager_id = \"$ligne_eleve[usager_id]\"
";
$reponse_log = bd_executer_sql($requete_sql);
$ligne_log = mysql_fetch_array($reponse_log);
$requete_sql = "SELECT *
FROM fiche
WHERE eleve_id = \"$ligne_eleve[eleve_id]\"
";
$reponse_fiche = bd_executer_sql($requete_sql);
$ligne_fiche = mysql_fetch_array($reponse_fiche);
$nb_fiche = mysql_num_rows($reponse_fiche);
?>
<h3><?= $ligne_eleve['prenom']." ". $ligne_eleve['nom']?></h3>
<table width="580" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="233" valign="top">Nom d'utilisateur :</td>
<td width="345"><?= $ligne_log['login'] ?></td>
</tr>
<tr>
<td valign="top">Statut de l'élève :</td>
<td><? if ($ligne_eleve['candidat'] == 1) echo "candidat"; else echo "électeur"; ?></td>
</tr>
<?
if ($ligne_eleve['valide'] == 0){
?>
<tr>
<td valign="top">Statut de l'inscription :</td>
<td>l'inscription de l'élève n'est toujours pas validée </td>
</tr>
<?
}else{
?>
<tr>
<td valign="top">Statut de l'inscription :</td>
<td>validée le
<?= date_fr($ligne_eleve['date_valide']) ?></td>
</tr>
<?
if ($ligne_eleve['candidat'] == 1){
?>
<tr>
<td valign="top"> <strong>Statut de la fiche de candidature : </strong></td>
<td>
<?
if ($ligne_fiche['valide'] == "1"){
echo "<strong>validée le ".date_fr($ligne_fiche['date_valide'])."</strong>";
}else if ($ligne_fiche['date_soumis'] != "0000-00-00" && $ligne_fiche['date_soumis'] != ""){
echo "<strong>soumise par l'élève le ".date_fr($ligne_fiche['date_soumis'])."</strong>";
} else if ($ligne_fiche['desact'] == 1){
echo "<strong>désactivée pour que l'élève puisse la retravailler</strong>";
} else {
echo "<strong>toujours en travail par l'élève</strong>";
}
?>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" width="580" align="center" border="0">
<tr>
<td><p><strong>Slogan : </strong>
<? if ($nb_fiche == 0){
echo "L'élève n'a pas défini de slogan.";
} else {
if ($ligne_fiche['slogan'] == ""){
echo "L'élève n'a pas défini de slogan.";
} else {
echo $ligne_fiche['slogan'];
}
}
?>
</p>
<p><strong>Pancarte électorale :</strong></p>
<?
if ($ligne_fiche['affiche'] == ""){
$affiche = "images/gen_affiche.jpg";
} else {
$affiche = $ligne_fiche['affiche'];
}
?>
<br />
<div align="center"><img src="<?= $affiche ?>" alt="affiche" /></div></td>
</tr>
<tr>
<td align="center">
<?
if($ligne_fiche['aff_source'] != ""){
?>
<strong>Source de l'image :</strong><?= $ligne_fiche['aff_source'] ?>
<?
}
?>
</td>
</tr>
<?
if ($nb_fiche == 0){
echo "<tr>
<td valign=\"top\" colspan=\"2\"><strong>Il n'y a aucune proposition.</strong><br /></td>
</tr><tr>
<td colspan=\"2\"> </td>
</tr>";
} else {
?>
<tr>
<td>
<p><strong><br />
Proposition :
<?= $ligne_fiche['slogan']?>
</strong></p>
<blockquote>
<p><strong>Niveau :</strong>
<?= $ligne_fiche['niveau']?></p>
<p><strong>Catégorie :</strong>
<?
$requete_sql = "SELECT nom
FROM categorie_prop
WHERE cat_id = \"$ligne_fiche[categorie]\"
";
$reponse_catNom = mysql_query($requete_sql);
$ligne_catNom = mysql_fetch_array($reponse_catNom);
?>
<?=$ligne_catNom['nom']?></p>
<p><strong>
Explication :</strong></p>
<?= nl2br($ligne_fiche['proposition'])?>
<p><strong>Appréciation :</strong></p>
<?
if ($ligne_fiche['app_moyenne'] < 0.50){
echo "<img src='images/etoile_0.jpg' alt='0' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 0.99){
echo "<img src='images/etoile_0_5.jpg' alt='0,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 1.50){
echo "<img src='images/etoile_1.jpg' alt='1' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 2.00){
echo "<img src='images/etoile_1_5.jpg' alt='1,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 2.50){
echo "<img src='images/etoile_2.jpg' alt='2' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 3.00){
echo "<img src='images/etoile_2_5.jpg' alt='2,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 3.50){
echo "<img src='images/etoile_3.jpg' alt='3' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 4.00){
echo "<img src='images/etoile_3_5.jpg' alt='3,5' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 4.50){
echo "<img src='images/etoile_4.jpg' alt='4' align='middle' />";
} else if ($ligne_fiche['app_moyenne'] < 5.00){
echo "<img src='images/etoile_4_5.jpg' alt='4,5' align='middle' />";
} else {
echo "<img src='images/etoile_5.jpg' alt='5' align='middle' />";
}
?>
/
<?
if ($ligne_fiche['app_nb'] > 1){
echo " ".$ligne_fiche['app_nb']." appréciations";
} else if ($ligne_fiche['app_nb'] == 1){
echo " ".$ligne_fiche['app_nb']." appréciation";
}
if ($periode == "fin_vote" || $periode == "vote"){
$requete_sql = "SELECT E.nb_votes FROM election E
WHERE E.projet_id = $projet
AND E.fiche_id = '".$ligne_loc['fiche_id']."'
";
$reponse_fin = bd_executer_sql($requete_sql);
$nb_fin = mysql_num_rows($reponse_fin);
if ($nb_fin >0){
$fin = mysql_fetch_array($reponse_fin);
?>
<br />
<strong>Nombre de votes :</strong>
<?=$fin['nb_votes']?>
<?
}
}
?>
</blockquote></td></tr>
<?
}
}
}
?>
</table>
<table width="580">
<tr>
<td>
<p><strong>Discussion :</strong></p>
<?
#REQUÊTE FIL DE DISCUSSION
$requete_sql = "SELECT DISTINCT F.*
FROM fil_discussion F, msg_fil M
WHERE F.projet_id = $projet
AND (M.destinataire = \"$ligne_eleve[eleve_id]\"
OR (M.auteur = \"$ligne_eleve[eleve_id]\"
AND M.type_auteur = \"eleve\"))
AND F.fil_id = M.fil_id
ORDER BY F.date_last_msg DESC
";
$reponse_disc = bd_executer_sql($requete_sql);
$nb_disc = mysql_num_rows($reponse_disc);
if ($nb_disc == 0){
echo "<p>L'élève ne participe à aucune discussion.</p>";
}else{
while ($ligne_disc = mysql_fetch_array($reponse_disc)){
?>
<table border="1" width="580"><tr><td>
<?
$requete_sql = "SELECT *
FROM msg_fil
WHERE fil_id = \"$ligne_disc[fil_id]\"
AND projet_id = $projet
ORDER BY date ASC
";
$reponse_msgf = bd_executer_sql($requete_sql);
while ($ligne_msgf = mysql_fetch_array($reponse_msgf) ){
$date = date_fr(substr($ligne_msgf['date'], 0,10))." à ".substr($ligne_msgf['date'], 11, 5);
if ($ligne_msgf['type_auteur'] == "admin"){
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#CCCCCC'>
<tr>
<td valign="top"><strong><?=$date?></strong></td><td align='right'>Auteur: Administrateur</td>
</tr>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=$ligne_msgf['texte']?></blockquote></td></tr>
</table>
<?
} else if ($ligne_msgf['type_auteur'] == "resp"){
$requete_sql = "SELECT nom, prenom
FROM responsable
WHERE resp_id = '".$ligne_msgf['auteur']."'
";
$reponse_r = bd_executer_sql($requete_sql);
$ligne_r = mysql_fetch_array($reponse_r);
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#99CC66'>
<tr>
<td valign="top"><strong><?=$date?></strong></td><td align='right'>Auteur: <?= $ligne_r['prenom']." ".$ligne_r['nom']?><br />
Enseignant</td>
</tr>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=$ligne_msgf['texte']?></blockquote></td></tr>
</table>
<?
} else if ($ligne_msgf['auteur'] == $ligne_eleve['eleve_id']){
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#FFFFCC'>
<tr>
<td valign="top"><strong><?=$date?></strong></td><td align='right'>Auteur: <?= $ligne_log['login']?></td>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=nl2br($ligne_msgf['texte'])?></blockquote></td></tr>
</table>
<?
} else {
$requete_sql = "SELECT candidat
FROM eleve
WHERE eleve_id = '".$ligne_msgf['auteur']."'
";
$reponse_cand = bd_executer_sql($requete_sql);
$ligne_cand = mysql_fetch_array($reponse_cand);
if ($ligne_cand['candidat'] == 1){
$type_eleve = "Élève candidat";
} else {
$type_eleve = "Élève électeur";
}
$requete_sql = "SELECT fiche_id
FROM fiche
WHERE eleve_id = \"$ligne_msgf[auteur]\"
AND projet_id = $projet";
$reponse_lien = bd_executer_sql($requete_sql);
$ligne_lien = mysql_fetch_array($reponse_lien);
$requete_sql = "SELECT U.login
FROM usager U, eleve E
WHERE E.eleve_id = \"$ligne_msgf[auteur]\"
AND U.usager_id = E.usager_id
";
$reponse_autre = bd_executer_sql($requete_sql);
$ligne_autre = mysql_fetch_array($reponse_autre);
?>
<br />
<table cellpadding='0' cellspacing='0' width="100%" bgcolor='#99CCFF'>
<tr>
<td valign="top"><strong><?=$date?></strong></td>
<td align='right'>Auteur: <a href="fiche.php?id_prop=<?=$ligne_lien['fiche_id']?>"><?=$ligne_autre['login']?></a><br /><?=$type_eleve?></td></tr>
<tr><td colspan="2"><blockquote><strong><?=$ligne_msgf['titre']?></strong><br /><?=nl2br($ligne_msgf['texte'])?></blockquote></td></tr>
</table>
<?
}
}
}
?>
</td></tr></table>
<?
}
?>
<p> </p></td>
</tr>
</table> <?
$requete_sql = "SELECT *
FROM eleve
WHERE eleve_id = '".$ligne_eleve['eleve_id']."'
AND projet_id = $projet
";
$reponse_vote = bd_executer_sql($requete_sql);
$ligne_vote = mysql_fetch_array($reponse_vote);
if($ligne_vote['vote'] > 0){
$requete_sql = "SELECT *
FROM election
WHERE fiche_id = \"$ligne_vote[fiche_vote]\"
";
$reponse_finalv = bd_executer_sql($requete_sql);
$ligne_finalv = mysql_fetch_array($reponse_finalv);
$requete_sql = "SELECT *
FROM fiche
WHERE eleve_id = \"$ligne_fichev[eleve_id]\"
";
$reponse_fichev = bd_executer_sql($requete_sql);
$ligne_fichev = mysql_fetch_array($reponse_fichev);
$requete_sql = "SELECT *
FROM eleve E, usager U
WHERE E.eleve_id = \"$ligne_fichev[eleve_id]\"
AND U.usager_id = E.usager_id
";
$reponse_elevev = bd_executer_sql($requete_sql);
$ligne_elevev = mysql_fetch_array($reponse_elevev);
$requete_sql = "SELECT *
FROM groupe
WHERE groupe_id = \"$ligne_elevev[groupe_id]\"
";
$reponse_grpv = bd_executer_sql($requete_sql);
$ligne_grpv = mysql_fetch_array($reponse_grpv);
$requete_sql = "SELECT E.nom
FROM ecole E, responsable R
WHERE R.resp_id = \"$ligne_grpv[resp_id]\"
AND E.ecole_id = R.ecole_id
";
$reponse_ecolev = bd_executer_sql($requete_sql);
$ligne_ecolev = mysql_fetch_array($reponse_ecolev);
?>
<p><strong>L'élève a voté pour :</strong></p>
<table cellpadding="0" cellspacing="0" width="580" border="0" align="center">
<tr>
<td align="left" width="200">
<?
if ($ligne_fichev['affiche'] == ""){
$affiche = "images/gen_affiche.jpg";
} else {
$affiche = $ligne_fichev['affiche'];
}
list($width) = getimagesize($affiche);
if ($width > 200){
echo "<img src=".$affiche." alt='affiche' width='200'/>";
} else {
?>
<img src='<?=$affiche?>' alt='affiche'/>
<?
}
?>
</td>
<td align="center" width="380">
<table cellpadding="0" cellspacing="0" width="95%" align="right">
<tr>
<td colspan="2"><strong>
<?=$ligne_fichev['slogan']?>
</strong></td>
</tr>
<tr>
<td width="30%">Auteur :</td>
<td width="70%"><?=$ligne_elevev['login']?></td>
</tr>
<tr>
<td>Niveau : </td>
<td><?=$ligne_fichev['niveau']?></td>
</tr>
<tr>
<td>Catégorie : </td>
<td>
<?
$requete_sql = "SELECT nom
FROM categorie_prop
WHERE cat_id = \"$ligne_fichev[categorie]\"
";
$reponse_catNom = mysql_query($requete_sql);
$ligne_catNom = mysql_fetch_array($reponse_catNom);
?>
<?=$ligne_catNom['nom']?>
</td>
</tr>
<tr>
<td>École : </td>
<td><?=$ligne_ecolev['nom']?></td>
</tr>
<tr>
<td>Niveau scolaire : </td>
<td><?=$ligne_grpv['niveau']?></td>
</tr>
<tr>
<td>Groupe : </td>
<td><?=$ligne_grpv['nom']?></td>
</tr>
</table></td>
</tr>
<tr><td colspan="2"><p><strong>Texte de la proposition : </strong></p><?= nl2br($ligne_fichev['proposition']) ?></td></tr>
<tr><td colspan="2"><p><strong>Justification du vote :</strong></p><p><?=$ligne_vote['justification']?></p></td></tr>
</table>
<?
} else {
?>
<p><strong>L'élève n'a pas voté.</strong></p>
<br />
<?
}
?>
<hr align="center" width="400" />
<br />
<?
}
echo "</blockquote>";
}
?>
<div align="right"><a href="#haut"><img src="images/haut.gif" alt="Retour au haut de la page" width="37" height="17" border="0" /></a></div>
<div align="center"><input type="button" value="Imprimer" onclick="self.print()" /> <input type="button" value="Fermer" onclick="self.close()" /></div></td>
</tr>
</table>
<?
}
else{
if ($HTTP_GET_VARS['id_eleve'] != 0){
?>
<p>Vous n'êtes pas l'enseignant de cet élève. Il vous est interdit d'imprimer les informations de cet élève.</p>
<?
} else if ($HTTP_GET_VARS['id_groupe'] != 0){
?>
<p>Vous n'êtes pas l'enseignant de ce groupe. Il vous est interdit d'imprimer les informations de ce groupe.</p>
<?
}
}
mysql_close();
?>
</body>
</html>