<?
include("../Session/security.php");
$autorisation_list[0]=0; // Administrateur
$autorisation_list[1]=1; // Professeur
$user_type = validateSession($id_session);
if ($user_type == -1 || !security($id_session,$autorisation_list)) print("Accès refusé");
else
{
// Ouverture de la connexion avec la base de donnees
$connection = openConnection(session);
if (!isset($id_prof)) {
$result=mysql_query("SELECT appartient.id FROM session,appartient
WHERE session.id_session='$id_session'
AND session.login=appartient.login");
$row=mysql_fetch_row($result);
$id_prof=$row[0];
}
$connection = openConnection($databaseName);
/*récupération des informations du prof sélectionné*/
$result=mysql_query("select titulaire, nom, prenom, id_grade, id_departement,
cnu,id_cgu,pedr from professeur where id_professeur=$id_prof");
$row=mysql_fetch_row($result);
/*affichage de l'entête*/
print("<html>\n");
print("<head>\n");
print("<title> Fiche Prévisionnelle de service annuel d'enseignement</title>\n");
print("</head>\n");
print("<body>\n");
print("<center>\n");
print("<h4> FICHE PREVISIONELLE DE SERVICE ANNUEL D'ENSEIGNEMENT\n");
print("<br> (Hors stage, mémoire, etc...)</h4>\n");
print("</center><br>\n");
print("<table border=0 width=1380>\n");
print("<tr>\n");
print("<td>\n");
if($row[0]=='O')
print("<h3>TITULAIRE</h3>\n");
else
print("<h3>VACATAIRE</h3>\n");
print("</td><td align=center>\n");
$annee=date("Y");
$mois=date("m");
if($mois<9) $per=($annee-1)."/".$annee;
else $per=$annee."/".($annee+1);
print($per."\n");
print("<br><br>");
print("</td>\n");
print("<tr>\n");
print("<td>\n");
print("<b> NOM : ".$row[1]."</b>\n");
print("</td><td>\n");
print("<b> PRENOM : ".$row[2]."</b>\n");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td>\n");
$result2=mysql_query("select libelle from grade where id_grade=".$row[3]);
$row2=mysql_fetch_row($result2);
print("EMPLOI SUPPORT (Grade) : ".$row2[0]."\n");
print("</td><td>\n");
$result2=mysql_query("select libelle from departement where id_departement=".$row[4]);
$row2=mysql_fetch_row($result2);
print("DEPARTEMENT DE RATTACHEMENT : ".$row2[0]."\n");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td>\n");
print("DISCIPLINE D'ENSEIGNEMENT (CNU) : ".$row[5]."\n");
print("</td><td>\n");
$result2=mysql_query("select libelle from cgu where id_cgu=".$row[6]);
$row2=mysql_fetch_row($result2);
print("C.G.U DE RATTACHEMENT : ".$row2[0]."\n");
print("</td>\n");
print("</tr>\n");
print("<tr>\n");
print("<td>\n");
print("PRIME D'ENCADREMENT DOCTORAL : ");
if($row[7]=='O') print("Oui\n");
else print("Non\n");
print("</td><td>\n");
print("PRIME PEDAGOGIQUE : \n");
print("</td>\n");
print("</tr>\n");
$result = mysql_query("select id_matiere,id_type_seance,nb_heures
from assurer
where id_professeur=$id_prof
and id_type_seance!=5
order by id_matiere,id_type_seance");
$i=0; /*compteur de boucle testant le nombre d'enregistrements*/
/*on teste le nombre d'enregistrements récupérés*/
if($result!=false)
$num=mysql_num_rows($result); /*num reçoit le nombre d'enregistrement*/
else
$num=0; /*mise à zéro de num pour n'afficher aucun enregistrement dans le tableau*/
$totalgene=0; /*variable stockant le total général eq TD*/
/*sélection du premier enregistrement*/
$enr=mysql_fetch_row($result);
/*boucle affichant le tableau sur plusieurs pages si num>20*/
while($i<$num)
{
/* en-tête du tableau */
print("</table><table border=1 CELLSPACING=0 CELLPADDING=0 width=1380>");
print("<tr align=center>");
print("<td rowspan=2 align=center valign=center width=50>");
print("<font size=2><B>CODE<br>DIPLÔME</B></font>\n");
print("</td><td rowspan=2 width=300 align=center nowrap>\n");
print("<font size=2><B>DIPLÔME ANNEE</B><BR>(ex: DEUG 1ère année, AES 2ème année...)</font>\n");
print("</td><td rowspan=2 width=50>\n");
print("<font size=2><B>SITE</B></font>\n");
print("</td><td rowspan=2 width=200>\n");
print("<font size=2><B>MATIERE ENSEIGNEE</B></font>\n");
print("</td><td colspan=3 width=150>\n");
print("<font size=2><B>CM</B></font>\n");
print("</td><td colspan=3 width=150>\n");
print("<font size=2><B>TD</B></font>\n");
print("</td><td colspan=3 width=150>\n");
print("<font size=2><B>TP</B></font>\n");
print("</td><td rowspan=2 width=80>\n");
print("<font size=2><B>Total</B></font>\n");
print("</td>\n");
print("<tr align=center>\n");
print("<td width=50>\n");
print("<font size=2>nbre H/<BR>groupe/an</font>\n");
print("</td><td width=50>\n");
print("<font size=2>nbre de<BR>groupe</font>\n");
print("</td><td valign=center width=50>\n");
print("<font size=2>total</font>\n");
print("</td>\n");
print("<td width=50>\n");
print("<font size=2>nbre H/<BR>groupe/an</font>\n");
print("</td><td width=50>\n");
print("<font size=2>nbre de<BR>groupe</font>\n");
print("</td><td valign=center width=50>\n");
print("<font size=2>total</font>\n");
print("</td>\n");
print("<td width=50>\n");
print("<font size=2>nbre H/<BR>groupe/an</font>\n");
print("</td><td width=50>\n");
print("<font size=2>nbre de<BR>groupe</font>\n");
print("</td><td valign=center width=50>\n");
print("<font size=2>total</font>\n");
print("</td>\n");
/* affichage de MAX enregistrements */
$MAX=20;
$j=0;
while($j<$MAX && $i<$num)
{
print("<tr>\n");
$id_matiere=$enr[0]; /*variable temporaire stockant la matière actuelle*/
/*celle-ci pouvant apparaître sur plusieurs enregistrements (CM, TD et/ou TP)*/
$total=0; /*variable stockant le total d'heures pour une matière*/
/*affichage d'un enregistrement*/
$nb_heures[1]=0;
$nb_heures[2]=0;
$nb_heures[3]=0;
$nb_heures[4]=0;
do
{
$nb_heures[$enr[1]]+=$enr[2];
$enr = mysql_fetch_row($result);
$i++;
}
while ($id_matiere==$enr[0]);
print("<td>\n");
print("<center>-</center>\n"); /*code diplome*/
print("</td><td>\n");
$result2 = mysql_query("select promotion.libelle,matiere.nom,diplome.libelle,promotion.id_promotion
from matiere,periode,promotion,diplome
where matiere.id_matiere='$id_matiere'
and periode.id_periode=matiere.id_periode
and promotion.id_promotion=periode.id_promotion
and diplome.id_diplome=promotion.id_diplome");
$enr2 = mysql_fetch_row($result2);
print($enr2[2]." ".$enr2[0]."\n"); /*diplome promotion*/
print("</td><td>\n");
/*Vérification de l'enregistrement d'un site*/
$site=mysql_query("SELECT cgu.id_cgu, cgu.libelle, FROM cgu,promotion
WHERE promotion.id_promotion=$enr2[3] AND promotion.id_cgu=cgu.id_cgu");
if ($site != false) {
$libsite=mysql_fetch_row($site);
print($libsite[1]."\n"); /*site*/
}
else print("<center>-</center>\n");
print("</td><td>\n");
print($enr2[1]."\n"); /*matière*/
print("</td>\n");
/*une matière pouvant être répartie ou non en CM, TD, et TP, il faut tester si l'enregistrement*/
/*concerne un CM, un TD ou un TP pour remplir les bonnes colonnes et calculer le bon*/
/*total général*/
if($nb_heures[1]!=0) /*cours magistral*/
{
/*affichage des informations*/
print("<td>".$nb_heures[1]."</td>\n"); /*nb h/gpe/an*/
print("<td>1</td>\n"); /*nb gpes*/
print("<td>".$nb_heures[1]."</td>\n"); /*total*/
/*addition aux total*/
$total+=$nb_heures[1]*1.5;
if(($total==(int)($total))!=0)
{
$total=(int)($total*100);
$total=($total/100);
}
/*ce n'est pas un CM. on met des blancs dans les trois colonnes CM*/
}
else print("<td> </td><td> </td><td> </td>\n");
/*TD et toujours même matière*/
if(($nb_heures[2]+$nb_heures[3])!=0)
{
/*supression des zéros inutiles*/
// if(($enr[5]==(int)($enr[5]))!=0) $enr[5]=(int)($enr[5]);
// if(($enr[7]==(int)($enr[7]))!=0) $enr[7]=(int)($enr[7]);
/*affichage des informations*/
print("<td>".($nb_heures[2]+$nb_heures[3])."</td>\n"); /*nb h/gpe/an*/
print("<td>1</td>\n"); /*nb gpes*/
print("<td>".($nb_heures[2]+$nb_heures[3])."</td>\n"); /*total*/
$total+=($nb_heures[2]+$nb_heures[3]);
if(($total==(int)($total))!=0)
{
$total=(int)($total*100);
$total=($total/100);
}
}
else print("<td> </td><td> </td><td> </td>\n");
/*TP et toujours même matière*/
if($nb_heures[4]!=0)
{
/*affichage des informations*/
print("<td>".$nb_heures[4]."</td>\n"); /*nb h/gpe/an*/
print("<td>1</td>\n"); /*nb gpes*/
print("<td>".$nb_heures[4]."</td>\n"); /*total*/
$total+=$nb_heures[4]*2/3;
if($total != floor($total) )
{
$total = floor($total*100);
$total=$total/100;
}
}
else print("<td> </td><td> </td><td> </td>\n");
/*affichage du total pour la matière*/
print("<td width=30>".$total."</td>\n");
$j++;
/*ajout au total général*/
$totalgene+=$total;
}/*while*/
/*le nombre d'enregistrement de la page en cours est <20. on ajoute des lignes vides*/
while($j<$MAX)
{
print("<tr><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td><td> </td>\n");
$j++;
}/*while*/
print("<br><br><br>\n");
}/*while*/
if(($totalgene==(int)($totalgene))!=0)
{
$totalgene=(int)($totalgene*100);
$totalgene=$totalgene/100;
}
/*pied de document et total général */
print("</table>\n");
print("<table border=0 CELLSPACING=0 CELLPADDING=0 width=1380>");
print("<tr>\n");
print("<td width=250 align=right>\n");
print("<font size=2>Signature de l'intéressé(e)</font>\n");
print("</td><td width=50 align=left> \n");
print("</td><td width=350 align=left>\n");
print("<font size=2>Signature du Directeur du C.G.U</font>\n");
print("</td><td width=650 align=center>\n");
print("<font size=2>Signature du Directeur de Département</font>\n");
print("</td><td width=50 align=right>\n");
print("<b>TOTAL</b>\n");
print("</td>\n");
print("<td><table border=1 width=50 cellspacing=0 cellpadding=0><tr><td width=50 align=center>\n");
print("<b>$totalgene</b>\n");
print("</td></table></td>\n");
print("</table>\n");
print("</body>\n");
print("</html>\n");
}
?>