<?php
#########################################################################################
# Recherche par école dans les propositions de Pnyx #
# Auteur : V. Blais #
# Création : 2006-04-05 #
# Modification : 2008-09-08 #
# #
# 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";
#gen_variables_session();
#variables pour l'affichage graphique de la page
$titre = "Rechercher par école";
#affichage graphique
require "entete.php";
$tabRegion = array();
$tabCircon = array();
$tabEcole = array();
$tabGroupe = array();
$requete_sql = "SELECT RE.nom, RE.region_id
FROM ((((((fiche AS F LEFT JOIN eleve AS E ON F.eleve_id = E.eleve_id)
LEFT JOIN groupe AS G ON E.groupe_id = G.groupe_id)
LEFT JOIN responsable AS R ON G.resp_id = R.resp_id)
LEFT JOIN ecole AS EC ON R.ecole_id = EC.ecole_id)
LEFT JOIN commission_scolaire AS CS ON EC.comscol_id = CS.comscol_id)
LEFT JOIN region AS RE ON CS.region_id = RE.region_id)
WHERE F.valide = 1
AND F.projet_id = $projet";
$reponse_region = mysql_query($requete_sql);
while($ligne_region = mysql_fetch_array($reponse_region)){
$regionID = $ligne_region['region_id'];
$regionNom = $ligne_region['nom'];
$tabRegion[$regionID] = $regionNom;
}
$requete_sql = "SELECT EC.circonscription, EC.ecole_id
FROM ((((fiche AS F LEFT JOIN eleve AS E ON F.eleve_id = E.eleve_id)
LEFT JOIN groupe AS G ON E.groupe_id = G.groupe_id)
LEFT JOIN responsable AS R ON G.resp_id = R.resp_id)
LEFT JOIN ecole AS EC ON R.ecole_id = EC.ecole_id)
WHERE F.valide = 1
AND F.projet_id = $projet
GROUP BY EC.circonscription";
$reponse_circon = mysql_query($requete_sql);
while($ligne_circon = mysql_fetch_array($reponse_circon)){
$circonID = $ligne_circon['ecole_id'];
$circonNom = $ligne_circon['circonscription'];
$tabCircon[$circonID] = $circonNom;
}
$requete_sql = "SELECT EC.nom, EC.ecole_id
FROM ((((fiche AS F LEFT JOIN eleve AS E ON F.eleve_id = E.eleve_id)
LEFT JOIN groupe AS G ON E.groupe_id = G.groupe_id)
LEFT JOIN responsable AS R ON G.resp_id = R.resp_id)
LEFT JOIN ecole AS EC ON R.ecole_id = EC.ecole_id)
WHERE F.valide = 1
AND F.projet_id = $projet";
$reponse_ecole = mysql_query($requete_sql);
while($ligne_ecole = mysql_fetch_array($reponse_ecole)){
$ecoleID = $ligne_ecole['ecole_id'];
$ecoleNom = $ligne_ecole['nom'];
$tabEcole[$ecoleID] = $ecoleNom;
}
$requete_sql = "SELECT G.nom, G.groupe_id
FROM ((fiche AS F LEFT JOIN eleve AS E ON F.eleve_id = E.eleve_id)
LEFT JOIN groupe AS G ON E.groupe_id = G.groupe_id)
WHERE F.valide = 1
AND F.projet_id = $projet";
$reponse_groupe = mysql_query($requete_sql);
while($ligne_groupe = mysql_fetch_array($reponse_groupe)){
$groupeID = $ligne_groupe['groupe_id'];
$groupeNom = $ligne_groupe['nom'];
$tabGroupe[$groupeID] = $groupeNom;
}
$htmlRech = "";
$htmlRech .= "<form name=\"form_rech\" method=\"post\" action=\"gen_rech_prog2.php\">";
$htmlRech .= "<table cellpadding=\"0\" cellspacing=\"0\" width=\"623\" align=\"center\" border=\"0\">";
$htmlRech .= "<tr>";
$htmlRech .= "<td width=\"169\"><p><strong>Région :</strong></p></td>";
$htmlRech .= "<td width=\"454\">";
$htmlRech .= "<select name=\"region\" size=\"1\" onchange=\"choixEC_region()\" id=\"lstRegion\">";
$htmlRech .= "<option value=\"\">Choisissez une région</option>";
foreach($tabRegion as $regionID => $regionNom){
$htmlRech .= "<option value='" . $regionID . "'>" . $regionNom . "</option>";
}
$htmlRech .= "</select></td>";
$htmlRech .= "</tr>";
$htmlRech .= "<tr>";
$htmlRech .= "<td><p><strong>Circonscription :</strong></p></td>";
$htmlRech .= "<td>";
$htmlRech .= "<select name=\"circons\" size=\"1\" onchange=\"choixEC_circon()\" id=\"lstCircon\">";
$htmlRech .= "<option value=\"\">Choisissez une circonscription</option>";
foreach($tabCircon as $circonID => $circonNom){
$htmlRech .= "<option value='" . $circonID . "'>" . $circonNom . "</option>";
}
$htmlRech .= "</select></td></tr>";
$htmlRech .= "<tr>";
$htmlRech .= "<td><p><strong>École :</strong></p></td>";
$htmlRech .= "<td><select name=\"ecole\" size=\"1\" onchange=\"choixEC_ecole()\" id=\"lstEcole\">";
$htmlRech .= "<option value=\"\">Choisissez une école</option>";
foreach($tabEcole as $ecoleID => $ecoleNom){
$htmlRech .= "<option value='" . $ecoleID . "'>" . $ecoleNom . "</option>";
}
$htmlRech .= "</select></td></tr>";
$htmlRech .= "<tr>";
$htmlRech .= "<td><p><strong>Nom de groupe :</strong></p></td>";
$htmlRech .= "<td><select name=\"groupe\" size=\"1\" id=\"lstGroupe\">";
$htmlRech .= "<option value=\"\">Choisissez un groupe</option>";
foreach($tabGroupe as $groupeID => $groupeNom){
$htmlRech .= "<option value='" . $groupeID . "'>" . $groupeNom . "</option>";
}
$htmlRech .= "</select></td>";
$htmlRech .= "</tr>";
$htmlRech .= "<tr>";
$htmlRech .= "<td colspan=\"2\"> </td>";
$htmlRech .= "</tr>";
$htmlRech .= "<tr>";
$htmlRech .= "<td colspan=\"2\" align=\"center\">";
$htmlRech .= "<div align=\"center\"><input type=\"submit\" name=\"recherche\" value=\"Rechercher\"/></div>";
$htmlRech .= "<input type=\"hidden\" name=\"type_action\" value=\"rech_ecole\" />";
$htmlRech .= "</td>";
$htmlRech .= "</tr>";
$htmlRech .= "</table>";
$htmlRech .= "</form>";
################################### FIN REQUETES BDD #########################################
?>
<p>Pour chaque liste, il est possible de choisir plus d'un critère. </p>
<p>Ne s'affiche pas ici la liste complète des commissions scolaires et des écoles, mais seulement celles pour lesquelles il y a des propositions.</p>
<br />
<?
echo $htmlRech;
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<?
require "pied_page.php";
?>