<?
#########################################################################################
# Impression d'une fiche élève de Pnyx #
# Auteur : V. Blais #
# Création : 2006-05-02 #
# Modification : 2008-08-28 #
# #
# 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();
/*$idp = $HTTP_SESSION_VARS[SESSION][projet];
$periode = $HTTP_SESSION_VARS[SESSION][periode];*/
$requete_sql = "SELECT * FROM election
WHERE projet_id = $projet
ORDER BY nb_votes DESC
";
$reponse_fin = bd_executer_sql($requete_sql);
$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 bgcolor="#FFFFFF">
<a name="haut" id="haut"></a>
<table bgcolor="#FFFFFF" width="580">
<tr>
<td>
<?
if ($periode == "vote"){
echo "<h4>Impression des propositions finalistes</h4>";
}else{
echo "<h4>Impression des résultats de l'élection</h4>";
}
while ($ligne = mysql_fetch_array($reponse_fin)) {
$requete_sql = "SELECT *
FROM fiche
WHERE fiche_id = \"$ligne[fiche_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_fiche[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);
?>
<h4><?=$ligne_fiche['slogan']?></h4>
<table cellpadding="0" cellspacing="0" width="580" border="0" align="center">
<tr>
<td width="200" align="left" valign="top">
<?
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 {
?>
<div align="center"><img src='<?=$affiche?>' alt='affiche'/></div>
<?
}
?>
</td>
<td width="380" align="center">
<table cellpadding="0" cellspacing="0" width="95%" align="right">
<tr>
<td width="33%">Auteur :</td>
<td width="67%"><?=$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>
<tr>
<td valign="top">Appréciation :</td>
<td>
<?
if ($ligne_fiche['app_moyenne'] < 0.50){
echo "<img src='images/etoile_0.jpg' alt='0' />";
} else if ($ligne_fiche['app_moyenne'] < 0.99){
echo "<img src='images/etoile_0_5.jpg' alt='0,5' />";
} else if ($ligne_fiche['app_moyenne'] < 1.50){
echo "<img src='images/etoile_1.jpg' alt='1' />";
} else if ($ligne_fiche['app_moyenne'] < 2.00){
echo "<img src='images/etoile_1_5.jpg' alt='1,5' />";
} else if ($ligne_fiche['app_moyenne'] < 2.50){
echo "<img src='images/etoile_2.jpg' alt='2' />";
} else if ($ligne_fiche['app_moyenne'] < 3.00){
echo "<img src='images/etoile_2_5.jpg' alt='2,5' />";
} else if ($ligne_fiche['app_moyenne'] < 3.50){
echo "<img src='images/etoile_3.jpg' alt='3' />";
} else if ($ligne_fiche['app_moyenne'] < 4.00){
echo "<img src='images/etoile_3_5.jpg' alt='3,5' />";
} else if ($ligne_fiche['app_moyenne'] < 4.50){
echo "<img src='images/etoile_4.jpg' alt='4' />";
} else if ($ligne_fiche['app_moyenne'] < 5.00){
echo "<img src='images/etoile_4_5.jpg' alt='4,5' />";
} else {
echo "<img src='images/etoile_5.jpg' alt='5' />";
}
?>
<br /></td>
</tr>
<tr>
<td valign="top"> </td>
<td>
<?
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";
}
?>
<br />
</td>
</tr>
<?
if ($periode == "fin_vote"){
?>
<tr>
<td>Nombre de votes :</td>
<td><?=$ligne['nb_votes']?></td>
</tr>
<?
}
?>
</table>
</td>
</tr>
<tr><td colspan="2"><br />
<strong>Explication</strong> : <?= nl2br($ligne_fiche['proposition'])?>
</td>
</tr>
</table>
<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>
<hr align="center" width="400" /><?
}
?>
<div align="center">
<br />
<input type="button" value="Imprimer" onclick="self.print()" />
<input type="button" value="Fermer" onclick="self.close()" />
</div></td>
</tr>
</table>
<?
mysql_close();
?>
</body>
</html>