<?
#########################################################################################
# Modifier un élève de Pnyx #
# Auteur : V. Blais #
# Création : 2006-05-02 #
# Modification : 2008-09-03 #
# #
# 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 #
#########################################################################################
include_once("fckeditor/fckeditor.php");
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("mod_fiche.php");
if(isset($HTTP_POST_VARS['type_action'])){
if ($HTTP_POST_VARS['type_action'] == "modifier"){
$requete_sql = "SELECT *
FROM projet
WHERE statut = \"actif\"
";
$reponse_actif = bd_executer_sql($requete_sql);
$projet = mysql_fetch_array($reponse_actif);
$requete_sql = "UPDATE fiche
SET slogan = \"".addslashes($HTTP_POST_VARS["titre"])."\",
niveau = \"$HTTP_POST_VARS[niveau]\",
proposition = \"".addslashes($HTTP_POST_VARS["texte"])."\",
categorie = \"$HTTP_POST_VARS[cat]\",
aff_source = \"".addslashes($HTTP_POST_VARS["sourceI"])."\",
source = \"".addslashes($HTTP_POST_VARS["sourceT"])."\"
WHERE eleve_id = \"$HTTP_POST_VARS[id_eleve]\"
";
$reponse_mod_resp = bd_executer_sql($requete_sql);
$HTTP_SESSION_VARS['SESSION']['message'] = "La fiche de candidature est modifiée.";
}
} else {
$requete_sql = "SELECT *
FROM projet
WHERE statut = \"actif\"
";
$reponse_actif = bd_executer_sql($requete_sql);
$projet = mysql_fetch_array($reponse_actif);
$requete_sql = "SELECT *
FROM fiche
WHERE fiche_id = \"$HTTP_GET_VARS[id_fiche]\"
";
$reponse_val = bd_executer_sql($requete_sql);
$fiche = mysql_fetch_array($reponse_val);
$requete_sql = "SELECT *
FROM categorie_prop
WHERE actif = 1
";
$reponse_cat = 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);
$requete_sql = "SELECT groupe_id
FROM eleve
WHERE fiche_id = " . $fiche['fiche_id'] . "
";
$reponse_eleve = mysql_query($requete_sql);
$ligne_eleve = mysql_fetch_array($reponse_eleve);
$requete_sql = "SELECT resp_id
FROM groupe
WHERE groupe_id = " . $ligne_eleve['groupe_id'] . "
";
$reponse_grp = mysql_query($requete_sql);
$ligne_grp = mysql_fetch_array($reponse_grp);
}
?>
<!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">
<?
if(isset($HTTP_POST_VARS['type_action'])){
if ($HTTP_POST_VARS['type_action'] == "modifier"){
?>
<script language="JavaScript">
refresh_parent();
</script>
<?
}
}
if($ligne_grp['resp_id'] == $usager || $niveau == "admin"){
?>
<form action="mod_fiche.php?id_fiche=<?=$fiche['fiche_id']?>" name="form_mod" method="post">
<table width="664" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td colspan="2"><h2>Modifier une fiche de candidature</h2></td>
</tr>
<tr>
<td colspan="2"><?
if (isset($message)){
echo "<br><h3 align=\"center\"><font color='#FF0000'>$message</font></h3>";
$message="";
}else{
echo " ";
}
?>
</td>
</tr>
<tr>
<td><p><strong>Slogan :</strong></p></td>
<td><input type="text" size="50" maxlength="255" name="titre" value="<?= $fiche['slogan']?>"/></td>
</tr>
<tr>
<td><p><strong>Source de l'image :</strong></p></td>
<td><textarea cols="60" rows="5" name="sourceI" id="sourceI"><?= $fiche['aff_source']?></textarea></td>
</tr>
<tr>
<td valign="top" colspan="2"> </td>
</tr>
<tr>
<td valign="top" colspan="2"><p><strong>Proposition :</strong></p></td>
</tr>
<tr>
<td colspan="2">
<table cellpadding="0" cellspacing="0" width="600" align="center">
<tr>
<td><p><strong>Niveau :</strong></p></td>
<td><select name="niveau" size="1">
<?
if ($projet['international'] == 1){
if ($fiche['niveau'] == "international"){
echo "<option value=\"international\" selected=\"selected\">International</option>";
} else {
echo "<option value=\"international\">International</option>";
}
}
if ($projet['national'] == 1){
if ($fiche['niveau'] == "national"){
echo "<option value=\"national\" selected=\"selected\">National</option>";
} else {
echo "<option value=\"national\">National</option>";
}
}
if ($projet['local'] == 1){
if ($fiche['niveau'] == "local"){
echo "<option value=\"local\" selected=\"selected\">Local</option>";
} else {
echo "<option value=\"local\">Local</option>";
}
}
?>
</select>
</td>
</tr>
<tr>
<td width="150" valign="top"><p><strong>Catégorie:</strong></p></td>
<td><select name="cat" size="1">
<?
while($ligne_cat = mysql_fetch_array($reponse_cat)){
if ($fiche['categorie'] == $ligne_cat['cat_id']){
echo "<option value=\"$ligne_cat[cat_id]\" selected=\"selected\">" . $ligne_cat['nom'] . "</option>";
} else {
echo "<option value=\"$ligne_cat[cat_id]\">" . $ligne_cat['nom'] . "</option>";
}
}
?>
</select>
</td>
</tr>
<tr>
<td valign="top"><p><strong> Explication :</strong></p></td>
<td>
<?
if(file_exists('fckeditor/')){
$oFCKeditor = new FCKeditor('texte') ;
$oFCKeditor->BasePath = 'fckeditor/' ;
$oFCKeditor->Value = $fiche['proposition'];
$oFCKeditor->Create() ;
}
else{
?>
<textarea name="texte" cols="50" rows="10"><?= $fiche['proposition'] ?></textarea>
<?
}
?>
</td>
</tr>
<tr>
<td><p><strong>Source :</strong></p></td>
<td><textarea cols="60" rows="5" name="sourceT" id="sourceT"><?= $fiche['source']?></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="Submit3" value="Modifier"/>
<input type="hidden" name="type_action" value="modifier"/>
<input type="hidden" name="id_fiche" value="<?=$fiche['fiche_id'] ?>"/>
<input type="hidden" name="id_eleve" value="<?=$fiche['eleve_id'] ?>"/>
<?
if ($niveau == "admin"){
?>
<input type="button" value="Fermer" onclick="refresh_parent('ges_eleve.php?id_eleve=<?=$fiche['eleve_id'] ?>')" />
<?
} else if ($niveau == "resp"){
?>
<input type="button" value="Fermer" onclick="refresh_parent('ges_elever.php?id_eleve=<?=$fiche['eleve_id'] ?>')" />
<?
}
?>
</td>
</tr>
<tr>
<td colspan="2"><p> </p></td>
</tr>
</table>
</form>
<?
}
else{
?>
<p>Vous n'êtes pas l'enseignant de cet élève. Il vous est impossible de modifier sa fiche.</p>
<?
}
mysql_close();
?>
</body>
</html>