<?php
#=
/****************************************************************************
Copyright 2002, Daniel Deycard, Jacques Messines, Alain Pomirol
(CATICE Académie de Bordeaux)

This file is part of GiBii/Melia.

GiBii/Melia 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; either version 2 of the License, or
(at your option) any later version.

GiBii/Melia 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 GiBii/Melia; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

****************************************************************************/
include("../include/vars_adm.php");
include("../include/util.inc.php");
include("../include/utiljs.php");

opensession("Admin",false);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
       <title>Liste des profs</title>
<link rel="stylesheet" href="<?php echo "../themes/".$etab_theme."/b2i.css" ?>">
</head>
<body class="arialadmin" bgcolor="white" text="black" link="blue" vlink="purple" alink="red">


<?php

//En-tête pour impression
Print "<p class='libelle_admin'>".$etab_nom."&nbsp;&nbsp;&nbsp;&nbsp;".
                 $etab_adresse."&nbsp;&nbsp;&nbsp;&nbsp;".$etab_codepostal.
                 "&nbsp;&nbsp;".$etab_ville;
Print "<hr>";

print "<p class='sous_titre'>Liste des professeurs</p>";

$conn  = connecte($host,$user,$mdp,$db);
$sql="SELECT profs.prof_id, profs.nom, profs.prenom, profs.dnaiss, comptes.login,
       disciplines.libelle, profs.admin , opt_dem1an FROM comptes, profs  LEFT JOIN disciplines
              ON disciplines.disc_id=profs.disc_id
               WHERE profs.compte_id=comptes.compte_id
                 and profs.etab_id=$etab_id
                 and profs.annee=$sess_ascol
                 and profs.tag<=0
               ORDER BY nom, prenom" ;
$resprofs=query ($sql);
$nbprofs=0;


//début du tableau
print "<div align='center'><table border='1'>\n";
print "<tr class='rubrique'>\n";
print "\t<td>Nom</td><td>Prénom</td><td>Discipline</td><td>D. de naissance</td><td>Login</td><td>Attributs</td></tr>\n";


while ($rowprof=mysql_fetch_array($resprofs)) {
	$prof_id=$rowprof["prof_id"];
	$nbprofs++;
	$nom=$rowprof["nom"];
	$prenom=$rowprof["prenom"];
	$dnaiss=$rowprof["dnaiss"];
	$login=$rowprof["login"];
	$disc=$rowprof["libelle"];
	$fadm=$rowprof['admin'];
	$longues=$rowprof['opt_dem1an'];
	
	if (empty($disc)) $disc="??";
	//Affichage d'une ligne
	print "\t<tr>\n";
	print "\t<td>&nbsp;&nbsp;$nom</td>\n";
	print "\t<td>&nbsp;&nbsp;$prenom</td>\n";
	print "\t<td>&nbsp;&nbsp;$disc</td>\n";
	print "\t<td>&nbsp;&nbsp;$dnaiss</td>\n";
	print "\t<td>&nbsp;&nbsp;$login</td>\n";
	$adm="";
	if ($fadm & 1) $adm="PA";
	if ($fadm & 2) {
	 	if ($adm) $adm.="-";
	 	$adm.="AA";
	 	}
	if ($fadm & 4) {
	 	if ($adm) $adm.="-";
	 	$adm.="GA";
	 	}
	if ($longues) {
	 	if ($adm) $adm.="-";
	 	$adm.="dl";
	 	}
	
	if (!$adm) $adm="&nbsp;";
	print "\t<td align='center'>$adm</td>\n";
	print "\t</tr>\n";
	}

print "</table></div><br>\n";
print "<p align = \"center\">";
print $nbprofs;
print ($nbprofs>1) ? " professeurs." : " professeur." ;

print "<p>";
print "<a href=\"../outils/profs2csv.php\">Télécharger la liste en fichier CSV</a>";
print "</p>";
?>
</p>
</body>
</html>