Location: PHPKode > projects > Pnyx : des lections virtuelles! > pnyx1.0.1/entete.php
<?

	#########################################################################################
	# Entête pour le bon affichage des pages de Pnyx										#
	# Auteur : V. Blais																		#
	# Création : 2006-03-26																	#
	# Modification : 2008-08-29																#
	# 																						#
	# 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												#
	#########################################################################################	
	
	if(isset($_POST["titreSite"])){
		if($_POST['passAdmin'] != ""){
			$cryptPass = sha1($_POST['passAdmin']);
		}
		else{
			$requete_sql = "SELECT password FROM usager WHERE usager_id";
			$reponse_pass = mysql_query($requete_sql);
			$ligne_pass = mysql_fetch_array($reponse_pass);
			$cryptPass = $ligne_pass['password'];
		}		
		if(isset($_POST['chkEcole'])){
			$chkEcole = "1";
		} else {
			$chkEcole = "0";
		}
		if(isset($_POST['chkRegion'])){
			$chkRegion = "1";
		} else {
			$chkRegion = "0";
		}
		if(isset($_POST['titreBan'])){
			$chkTitreBan = "1";
		} else {
			$chkTitreBan = "0";
		}
		mysql_query("UPDATE site_parametres SET titre = '" . $_POST["titreSite"] . "', template = '" . $_POST["lstTemp"] . "', bouton1 = '" . $_POST["bouton1"] . "', bouton2 = '" . $_POST["bouton2"] . "', bouton3 = '" . $_POST["bouton3"] . "', bouton4 = '" . $_POST["bouton4"] . "', courriel_admin = '" . $_POST['courrielAdmin'] . "', rech_ecole = '" . $chkEcole . "', rech_region = '" . $chkRegion . "', titre_banniere = '" . $chkTitreBan . "' WHERE param_id = '1'");
		mysql_query("UPDATE usager SET login = '" . $_POST["adminNom"] . "', password = '" . $cryptPass . "' WHERE usager_id = '1'");
		$HTTP_SESSION_VARS['SESSION']['onglet'] = 2;
		$onglet = $HTTP_SESSION_VARS['SESSION']['onglet'];
	}
		
		$requeteInfo = mysql_query("SELECT * FROM site_parametres");
		$requeteAdmin = mysql_query("SELECT login FROM usager WHERE usager_id = 1");
		$requeteCycle = mysql_query("SELECT * FROM projet WHERE statut = \"actif\"");
		$ligneCycle = mysql_fetch_array($requeteCycle);
		
		$cycle1p = 	$ligneCycle['cycle1p'];
		$cycle2p = 	$ligneCycle['cycle2p'];
		$cycle3p = 	$ligneCycle['cycle3p'];
		$cycle1s = 	$ligneCycle['cycle1s'];
		$cycle2s = 	$ligneCycle['cycle2s'];
			
		$titreSite = "";
		$template = "";
		$bouton1 = "";
		$bouton2 = "";
		$bouton3 = "";
		$bouton4 = "";
		$rechEcole = "";
		$rechRegion = "";
		$nomAdmin = "";
		$courrielAdmin = "";
		$titreBan = "";
		
		$infoAdmin = mysql_fetch_array($requeteAdmin);
		while($infoTable = mysql_fetch_array($requeteInfo)){
			$titreSite = $infoTable["titre"];
			$template = $infoTable["template"];
			$bouton1 = $infoTable["bouton1"];
			$bouton2 = $infoTable["bouton2"];
			$bouton3 = $infoTable["bouton3"];
			$bouton4 = $infoTable["bouton4"];
			$rechEcole = $infoTable["rech_ecole"];
			$rechRegion = $infoTable["rech_region"];
			$nomAdmin = $infoAdmin["login"];
			$courrielAdmin = $infoTable["courriel_admin"];
			$titreBan = $infoTable["titre_banniere"];
		}
		
	if(isset($HTTP_GET_VARS['type_action'])){
		if ($HTTP_GET_VARS['type_action'] == "deconnect"){
	#			echo "--- avant---";
	#			gen_variables_session();
	#			gen_variables_cookie();
			$niveau = "general";
			kill_session();
		}
	}
	
	$stringPage = $_SERVER['PHP_SELF'];
	$stringPage = substr($stringPage, (strlen($stringPage) - 17), strlen($stringPage));
	$stringPage2 = $_SERVER['PHP_SELF'];
	$stringPage2 = substr($stringPage2, (strlen($stringPage2) - 13), strlen($stringPage2));
	if(!($stringPage == "gen_rech_prog.php" || $stringPage2 == "gen_fiche.php")){
		unset($_SESSION['listeProp']);
		unset($_SESSION['listeFinaliste']);
	}
?>
<!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><?= $titreSite ?></title>

<meta name="description" content="Pnyx est une application (PHP/MySQL) d'élections virtuelles conçue pour des élèves du primaire et du secondaire du Québec, dans lequel ils sont amenés à faire des propositions en ligne et voter pour leur favorite, sous la supervision d'un enseignant." />
<script type="text/javascript" src="lib/fonctions.js"></script>
<?
	if($template == 1){
?>
	<link rel="stylesheet" type="text/css" href="lib/template1.css" />
<?
	} else {
?>
	<link rel="stylesheet" type="text/css" href="lib/template2.css" />
<?
	}
?>

<script type="text/javascript" src="lib/menu.js"></script>

<script src="lib/ajax.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="lib/panel.css" />
</head>

<body>
<a name="haut" id="haut"></a>
<div id="contenu">
	<div id="entete">
    	<div id="titreEntete">
			<?
				if($titreBan == 1){
            		echo $titreSite;
				}
			?>
        </div>
    </div>
	<div id="menuEntete">
		<ul>
			<li id="boutonAccueil">
				<a href="index.php">
					<span class="ongletG"></span>
					<span class="ongletM"><?= $bouton1 ?></span>
					<span class="ongletD"></span>
			  </a>
			</li>	
			<?		
				if($bouton2 != ""){
			?>
			<li id="boutonInformations">
				<a href="information.php">
					<span class="ongletG"></span>
					<span class="ongletM"><?= $bouton2 ?></span>
					<span class="ongletD"></span>
				</a>
			</li>
			<?
				}		
				if($bouton3 != ""){
			?>
			<li id="boutonAide">
				<a href="aide.php">
					<span class="ongletG"></span>
					<span class="ongletM"><?= $bouton3 ?></span>
					<span class="ongletD"></span>
				</a>
			</li>
			<?
				}
			?>
			<li id="boutonPropos">
				<a href="javascript:;" onmouseover="sousPropos()" onmouseout="debutTimeout()">
					<span class="ongletGP"></span>
					<span class="ongletMP"><?= $bouton4 ?></span>
					<span class="ongletDP"></span>
				</a>
			</li>
		</ul>
		<div id="alignementConnection">
            <div id="boutonConnection"> 
                <ul>
                    <li>
                        <span class="ongletG"></span>
                        <?
                            if ($niveau == "general"){
                                
                                $stringPage = $_SERVER['PHP_SELF'];
								$stringPage = substr($stringPage, (strlen($stringPage) - 9), strlen($stringPage));
								
								if ($stringPage == "index.php"){
                        ?>
                                    <a href="gen_inscription.php">
                                        <span class="ongletM">Inscription</span>                                    </a>
                        <?
                                } else {
                        ?>
                                    <a href="index.php">
                                        <span class="ongletM">Me connecter</span>                                    </a>
                        <?
                                }
                            } else {
                        ?>	
                                <a href="index.php?type_action=deconnect">
                                    <span class="ongletM">Me déconnecter</span>                                </a>
                        <?
                            }
                        ?>
                        <span class="ongletD"></span>                	</li>
                </ul>
            </div>
   	  </div>
</div>
<div id="sousMenuProposition" onmouseover="sousPropos()" onmouseout="debutTimeout()">
<table>
	<tr>
    	<td>
        	<a href="gen_rech_prog2.php?type_action=tous">Voir toutes les propositions</a>        </td>
    </tr>
    <?
		if($rechEcole == "1"){
			if($periode != ""){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_ecole.php">Rechercher par &eacute;cole</a>        </td>
    </tr>
    <?
			}
		}
		
		if($rechRegion == "1"){
			if($periode != ""){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_region.php">Rechercher par r&eacute;gion</a>        </td>
    </tr>
    <?
			}
		}
		if($cycle1p == "1"){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_prog2.php?type_action=rechA5">Propositions du primaire (1er cycle)</a>        </td>
    </tr>
    <?
		}
		if($cycle2p == "1"){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_prog2.php?type_action=rechA4">Propositions du primaire (2e cycle)</a>        </td>
    </tr>
    <?
		}
		if($cycle3p == "1"){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_prog2.php?type_action=rechA3">Propositions du primaire (3e cycle)</a>        </td>
    </tr>
    <?
		}
		if($cycle1s == "1"){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_prog2.php?type_action=rechA1">Propositions du secondaire (1er cycle)</a>        </td>
    </tr>
    <?
		}
		if($cycle2s == "1"){
	?>
    <tr>
    	<td>
        	<a href="gen_rech_prog2.php?type_action=rechA2">Propositions du Secondaire (2e cycle)</a>        </td>
    </tr>
    <?
		}
	?>
</table>
</div>
<?
		$stringPage = $_SERVER['PHP_SELF'];
		$stringPage = substr($stringPage, (strlen($stringPage) - 9), strlen($stringPage));
		
		if ($stringPage != "index.php"){
?>
		<div id="sousMenuEntete">
<?		
			if ($niveau == "admin"){
		?>
			  <a href="adm_projet.php">Projets</a> &#124; 
			  <a href="adm_enregistrement.php?id_projet=<?=$projet?>">Responsables</a> &#124; 
			  <a href="adm_groupe.php">Groupes</a> &#124; <a href="adm_eleve.php">&Eacute;l&egrave;ves</a> &#124; 
			  <a href="#" onclick="javascript:window.open('croquis/admin.php','popupa','height=505, width=643,location=no,menubar=no,titlebar=no,status=0,scrollbars=no,toolbar=no,resizable=0');">Croquis en ligne</a> &#124; 
			  <a href="adm_election.php">&Eacute;lections</a> &#124; 
			  <a href="adm_stat.php">Statistiques</a> &#124; 
			  <a href="adm_publications.php">Derni&egrave;res publications</a>
		<?
			} else if ($niveau == "resp"){
		?>
			  <a href="rsp_compte.php">Gestion de mon compte</a> &#124; 
			  <a href="rsp_groupe.php">Gestion de mes groupes</a> &#124; 
			  <a href="rsp_eleve.php">Gestion de mes &eacute;l&egrave;ves</a> &#124;
              <a href="rsp_publications.php">Derni&egrave;res publications</a>
		<?	  
			  #<a href="aide_resp.php">Aide</a>
		
			} else if ($niveau == "eleve"){
			
				#requete pour connaitre statut de l'élève (électeur ou candidat)
				$requete_sql = "SELECT *
								FROM eleve
								WHERE eleve_id = $usager
								";
				$reponse_eleve = bd_executer_sql($requete_sql);
				$ligne_eleve = mysql_fetch_array($reponse_eleve);
		?>
			  <a href="ele_compte.php">Mes consignes</a> &#124;
		<?			
				if($ligne_eleve['candidat'] == 1){
					if ($periode != "vote" && $periode != "fin_vote"){
		?>
						<a href="ele_fiche.php">Ma fiche de candidature</a> &#124;
		<?
					}
				}
		?>
				<a href="ele_vote.php">Mon vote</a> &#124; 
				<a href="ele_discussion.php">Mes discussions</a> &#124; 
				<a href="ele_aide.php">Aide</a>
		<?
			}
?>		
	</div>
<?
}
		?>
<table width="780">
	<?
		$stringPage = $_SERVER['PHP_SELF'];
		$stringPage = substr($stringPage, (strlen($stringPage) - 9), strlen($stringPage));
		
		if ($stringPage != "index.php"){
	?>
	<tr>
		<td width="780" height="79" colspan="3">
			<div id="titreSection">
				<img src="images/ico_vote.gif" alt="Icone titre" width="50" height="50" hspace="5" align="absmiddle" /> 
			  <h3><?= $titre ?></h3>
			</div>
	  </td>
	</tr>
	<?
		}
	?>
	<tr>
		<td>
			<table>
				<tr>
					<td width="96%" valign="top">
						<table cellpadding="0" cellspacing="0" align="center" width="91%">
							<tr>
								<td align="left" valign="top">
Return current item: Pnyx : des lections virtuelles!