Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/FichesAdmin/suivi_hres.php3
<?
	include("../date.php3");
    include("../Session/security.php");

	print("<HTML>\n<BODY BGCOLOR=white>\n");

// Verification de la session
	$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
    {
//		$idp=getUserID($id_session);
	    $connection = openConnection(session);
	if (!isset($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);
	$prof=$row[0];
	}
	    $connection = openConnection($databaseName);	
		$idp=$prof;
// Ouverture de la connexion avec la base de donnees

		$result=mysql_query("SELECT nom, prenom, id_grade, id_departement, cnu, titulaire, id_cgu, pedr FROM professeur WHERE id_professeur=".$idp);
		$row=mysql_fetch_row($result);
		$result2=mysql_query("SELECT libelle FROM grade WHERE id_grade=".$row[2]);
		$row2=mysql_fetch_row($result2);
		$grade=$row2[0];
	
		$result2=mysql_query("SELECT libelle FROM departement WHERE id_departement=".$row[3]);
		$row2=mysql_fetch_row($result2);
		$departement=$row2[0];
	
		$result2=mysql_query("SELECT libelle FROM cgu WHERE id_cgu=".$row[6]);
		$row2=mysql_fetch_row($result2);
		$cgu=$row2[0];
	
// Determination de l'annee courante
	$result2=mysql_query("SELECT annee FROM global");
	$row2=mysql_fetch_row($result2);
	$anneeDeb=$row2[0];
	$per=$anneeDeb."/".($anneeDeb+1);

// Chargement des enregistrements relatifs aux cours effectues avec les promotions et les groupes
	// Récupération de la première semaine d'enseignement
	$premsemaine=mysql_query("SELECT semaine_debut FROM global");
	$premsemaine=mysql_fetch_array($premsemaine);

	$resultPromotion=mysql_query("SELECT p.id_planifie, id_matiere, id_type_seance, semaine, jour_semaine, 
	heure_debut, heure_fin, c.libelle, p.semaine-$premsemaine[0] as tst, p.semaine-$premsemaine[0]<=0 as tst2, 
	pr.id_promotion FROM planifie p, planifiepromotion pp, promotion pr, cgu c 
	WHERE p.id_professeur=".$idp." AND p.id_type_seance<>5 AND 
	pp.id_planifie=p.id_planifie AND pr.id_promotion=pp.id_promotion 
	AND c.id_cgu=pr.id_cgu 
	ORDER BY pp.id_promotion ASC,tst2 ASC, tst ASC, p.jour_semaine ASC");

	$resultGroupe=mysql_query("SELECT p.id_planifie, id_matiere, p.id_type_seance, semaine, jour_semaine, 
	heure_debut, heure_fin, c.libelle, p.semaine-35 as tst, p.semaine-35<=0 as tst2, 
	pr.id_promotion FROM planifie p, planifiegroupe pg, groupe g,associer a, promotion pr, cgu c 
	WHERE p.id_professeur=".$idp." AND p.id_type_seance<>5 AND 
	pg.id_planifie=p.id_planifie AND g.id_groupe=pg.id_groupe 
	AND a.id_groupe=g.id_groupe AND a.id_promotion=pr.id_promotion AND c.id_cgu=pr.id_cgu 
	ORDER BY pr.id_promotion ASC,tst2 ASC, tst ASC, p.jour_semaine ASC");
	$nb_enrP=0;
	$nb_enrG=0;
	if($resultPromotion!=false) $nb_enrP=mysql_num_rows($resultPromotion);
	if($resultGroupe!=false) $nb_enrG=mysql_num_rows($resultGroupe);
	// Nombre total d'enregistrements 
	$nb_enr=$nb_enrP+$nb_enrG;

// Positionnement sur les enregistrements en cours par rapport aux derniers enregistrements 
// traites sur la page precedente
	if (isset($posP))
	{
		if ($posP<$nb_enrP) mysql_data_seek($resultPromotion,$posP);
		if ($posG<$nb_enrG) mysql_data_seek($resultGroupe,$posG);
	}
	else
	{	
		$posP=0;
		$posG=0;
	}

	print("<FORM NAME=\"page\">\n");
	print("<INPUT TYPE=HIDDEN NAME=\"prof\" VALUE=".$idp.">\n");
	print("<INPUT TYPE=HIDDEN NAME=\"id_session\" VALUE=".$id_session.">\n");

// Calcul du numero de la page courante
	print("<INPUT TYPE=HIDDEN NAME=\"numPages\" VALUE=");
	if (isset($numPages)) 
	{
		$numPages++;
		print($numPages);
	}
	else 
	{
		print(1);
		$numPages=1;
	}
	print(">\n");

// Calcul du nombre de pages
	$MAX=19; // Nombre de lignes par pages	
	if($nb_enr<=$MAX) $totalPages=1;
	else $totalPages=(int)((($nb_enr-$MAX)/32)+2);
	print("<INPUT TYPE=HIDDEN NAME=\"totalPages\" VALUE=".$totalPages.">\n");

// Determination du numero d'enregistrement	courant
	print("<INPUT TYPE=HIDDEN NAME=\"index\" VALUE=");
	if (isset($index)) print($index+32);
	else print($MAX);
	print(">\n");
	
	$tabMois=array(1=>"janv","fév","mars","avr","mai","juin","juil","aout","sept","oct","nov","déc");

	if ($numPages==1)
	{

/**********************************************/	
/******		PREMIERE PAGE		***************/		
/**********************************************/	

	print("<TABLE BORDER=0 WIDTH=925>\n");
	
	print("<TR>\n");
		print("<TD VALIGN=TOP ALIGN=CENTER COLSPAN=2>\n");
		print("	
	<B>
	FICHE DE SUIVI DES HEURES D'ENSEIGNEMENT <BR>
	(hors stages, mémoires, projets, T.E.R, etc.) <BR></B>
		");
		print("</TD>\n");
	print("<TR>\n");
		print("<TD VALIGN=TOP ALIGN=RIGHT COLSPAN=2>\n");		
		print($per."\n");
		print("</TD>\n");
	print("<TR>\n");
		print("<TD ALIGN=LEFT COLSPAN=2>\n");
		if($row[5]=='0') print("<B><FONT SIZE=3>VACATAIRE(1)</FONT><BR>\n");
		else print("<B><FONT SIZE=3>TITULAIRE(1)</FONT><BR>\n");
		print("<BR></FONT></B>\n");
		print("</TD>\n");
	print("<TR>\n");
		print("<TD VALIGN=TOP ALIGN=LEFT>\n");
		print("<BR><B><FONT SIZE=3>NOM : </FONT></B> ".$row[0]."<BR>\n");
		print("<FONT SIZE=2>EMPLOI PRINCIPAL (Grade) : ".$grade."<BR>\n");
		print("DISCIPLINE D'ENSEIGNEMENT : ".$row[4]."<BR>\n");
		print("C.G.U. DE RATTACHEMENT : ".$cgu."<BR>\n");
		print("DEPARTEMENT DE RATTACHEMENT : ".$departement."<BR>\n");
		print("</TD>\n");
		
		print("<TD VALIGN=TOP ALIGN=LEFT>\n");
		print("<BR><B><FONT SIZE=3>PRENOM : </FONT></B> ".StrToUpper($row[1])."\n");
		print("</TD>\n");
	print("</TABLE>\n");
	
	print("<BR>\n");
	
	print("<TABLE BORDER=2 WIDTH=925 CELLSPACING=0 CELLPADDING=0>\n");
	
	print("<TR>\n");
		print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=310>\n");
		print("<FONT SIZE=2>\n");
		print("<B><BR>DIPL&Ocirc;ME ANNEE</B><BR>\n");
		print("<BR>(ex: DEUG 1ère année AES, 2ème année...)(2)\n");
		print("</FONT>\n");
		print("</TD>\n");
		
		print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=68>\n");
		print("<font size=2>\n");
		print("<B><BR>SITE</B><BR>\n");
		print("</FONT>\n");
		print("</TD>\n");

		print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=170>\n");
		print("<font size=2>\n");
		print("<B><BR>MATIERE ENSEIGNEE</B><BR>\n");
		print("</FONT>\n");	
		print("</TD>\n");
		
		print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=87>\n");
		print("<font size=2>\n");
		print("<B><BR>DATE</B><BR>\n");
		print("</FONT>\n");		
		print("</TD>\n");
		
		print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=113>\n");
		print("<font size=2>\n");
		print("<B><BR>HORAIRE<BR>Nombre d'heures<B>\n");
		print("</FONT>\n");
		print("</TD>\n");
		
		print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=94>\n");
		print("<font size=2>\n");
		print("Nature de<BR>l'enseignement<BR>\n");
		print("<B>CM - TD - TP</B>\n");
		print("</FONT>\n");	
		print("</TD>\n");
		
		print("<TD ALIGN=LEFT VALIGN=TOP WIDTH=83 HEIGHT=68>\n");
			print("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0>\n");
			print("<TR>\n");
				print("<TD WIDTH=83 HEIGHT=68 ALIGN=CENTER VALIGN=TOP>\n");
				print("<font size=2>\n");
				print("<B><BR>Total éq. TD</B><BR>\n");
				print("</FONT>\n");
				print("</TD>\n");
			print("</TABLE>\n");
		print("</TD>\n");

	print("<TR>\n");
	
	/*	DIPLOME ANNEE	*/
		print("<TD ALIGN=LEFT HEIGHT=300 VALIGN=TOP>\n");
		print("<font size=2>\n");
		for($i=0;$i<$nb_enr && $i<$MAX;$i++)
		{
			if($posP==$nb_enrP && $posG<$nb_enrG)
			{
				$row2=mysql_fetch_array($resultGroupe);
				$posG++;
			}
			if($posG==$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$posP++;
			}
			if($posG<$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$tstP=$row2["tst"];
				$tstP2=$row2["tst2"];
				$row2=mysql_fetch_array($resultGroupe);
				$tstG=$row2["tst"];
				$tstG2=$row2["tst2"];				
				if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
				{
					mysql_data_seek($resultGroupe,$posG);
					mysql_data_seek($resultPromotion,$posP);
					$posP++;
					$row2=mysql_fetch_array($resultPromotion);
				}else{
					$posG++;
					mysql_data_seek($resultPromotion,$posP);
				}
			}			
			$result3=mysql_query("SELECT d.libelle, p.libelle FROM diplome d, promotion p 
			WHERE d.id_diplome=p.id_diplome AND p.id_promotion=".$row2["id_promotion"]);
			$row3=mysql_fetch_row($result3);
			print($row3[0]." - ".$row3[1]."<BR>\n");			
		}
		for($j=$i;$j<$MAX;$j++)
		{
			print("<BR>\n");
		}
		print("</FONT>\n");
		print("</TD>\n");		
		
	/*	SITE		*/
		print("</FONT>\n");
		print("</TD>\n");
		print("<TD ALIGN=CENTER VALIGN=TOP>\n");
		print("<font size=2>\n");
		
		$posP=0;
		$posG=0;
		if($nb_enrP>0) mysql_data_seek($resultPromotion,0);
		if($nb_enrG>0) mysql_data_seek($resultGroupe,0);
		
		for($i=0;$i<$nb_enr && $i<$MAX;$i++)
		{
			if($posP==$nb_enrP && $posG<$nb_enrG)
			{
				$row2=mysql_fetch_array($resultGroupe);
				$posG++;
			}
			if($posG==$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$posP++;
			}
			if($posG<$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$tstP=$row2["tst"];
				$tstP2=$row2["tst2"];
				$row2=mysql_fetch_array($resultGroupe);
				$tstG=$row2["tst"];
				$tstG2=$row2["tst2"];				
				if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
				{
					mysql_data_seek($resultGroupe,$posG);
					mysql_data_seek($resultPromotion,$posP);
					$posP++;
					$row2=mysql_fetch_array($resultPromotion);
				}else{
					$posG++;
					mysql_data_seek($resultPromotion,$posP);
				}
			}			
			print($row2["libelle"]."<BR>\n");
		}
		for($j=$i;$j<$MAX;$j++)
		{
			print("<BR>\n");
		}
		print("</FONT>\n");
		print("</TD>\n");

	/*	MATIERE		*/
		print("<TD ALIGN=CENTER VALIGN=TOP>\n");
		print("<font size=2>\n");

		$posP=0;
		$posG=0;
		if($nb_enrP>0) mysql_data_seek($resultPromotion,0);
		if($nb_enrG>0) mysql_data_seek($resultGroupe,0);

		for($i=0;$i<$nb_enr && $i<$MAX;$i++)
		{
			if($posP==$nb_enrP && $posG<$nb_enrG)
			{
				$row2=mysql_fetch_array($resultGroupe);
				$posG++;
			}
			if($posG==$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$posP++;
			}
			if($posG<$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$tstP=$row2["tst"];
				$tstP2=$row2["tst2"];
				$row2=mysql_fetch_array($resultGroupe);
				$tstG=$row2["tst"];
				$tstG2=$row2["tst2"];				
				if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
				{
					mysql_data_seek($resultGroupe,$posG);
					mysql_data_seek($resultPromotion,$posP);
					$posP++;
					$row2=mysql_fetch_array($resultPromotion);
				}else{
					$posG++;
					mysql_data_seek($resultPromotion,$posP);
				}
			}			
			$result3=mysql_query("SELECT nom FROM matiere m, planifie p WHERE m.id_matiere=p.id_matiere AND p.id_planifie=".$row2["id_planifie"],$connection);
			$row3=mysql_fetch_row($result3);
			print($row3[0]."<BR>\n");			
		}
		for($j=$i;$j<$MAX;$j++)
		{
			print("<BR>\n");
		}
		print("</FONT>\n");
		print("</TD>\n");		
		
	/*	DATE		*/
		print("<TD ALIGN=CENTER VALIGN=TOP>\n");
		print("<font size=2>\n");
		
		$posP=0;
		$posG=0;
		if($nb_enrP>0) mysql_data_seek($resultPromotion,0);
		if($nb_enrG>0) mysql_data_seek($resultGroupe,0);
		
		for($k=0;$k<$nb_enr && $k<$MAX;$k++)
		{
			if($posP==$nb_enrP && $posG<$nb_enrG)
			{
				$row2=mysql_fetch_array($resultGroupe);
				$posG++;
				
	//print("g1\n");
			}
			if($posG==$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$posP++;
				
	//print("p1\n");
			}
			if($posG<$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$tstP=$row2["tst"];
				$tstP2=$row2["tst2"];
				$row2=mysql_fetch_array($resultGroupe);
				$tstG=$row2["tst"];
				$tstG2=$row2["tst2"];				
				if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
				{
					mysql_data_seek($resultGroupe,$posG);
					mysql_data_seek($resultPromotion,$posP);
					$posP++;
					$row2=mysql_fetch_array($resultPromotion);
				}else{
					$posG++;
					mysql_data_seek($resultPromotion,$posP);
				}
			}			
			$resultS=mysql_query("SELECT numero_semaine_debut FROM periode pe WHERE pe.id_promotion=".$row2["id_promotion"],$connection);
			$rowS=mysql_fetch_array($resultS);
			
	print(weekAndDayToDate($row2["jour_semaine"],$row2["semaine"],$connection)."<BR>\n");

		}
		for($j=$k;$j<$MAX;$j++)
		{
			print("<BR>\n");
		}
		print("</FONT>\n");
		print("</TD>\n");		

	/*	HORAIRE		*/
	
		print("<TD ALIGN=CENTER VALIGN=TOP>\n");
		print("<font size=2>\n");

		$posP=0;
		$posG=0;
		if($nb_enrP>0) mysql_data_seek($resultPromotion,0);
		if($nb_enrG>0) mysql_data_seek($resultGroupe,0);

		for($i=0;$i<$nb_enr && $i<$MAX;$i++)
		{
			if($posP==$nb_enrP && $posG<$nb_enrG)
			{
				$row2=mysql_fetch_array($resultGroupe);
				$posG++;
			}
			if($posG==$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$posP++;
			}
			if($posG<$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$tstP=$row2["tst"];
				$tstP2=$row2["tst2"];
				$row2=mysql_fetch_array($resultGroupe);
				$tstG=$row2["tst"];
				$tstG2=$row2["tst2"];				
				if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
				{
					mysql_data_seek($resultGroupe,$posG);
					mysql_data_seek($resultPromotion,$posP);
					$posP++;
					$row2=mysql_fetch_array($resultPromotion);
				}else{
					$posG++;
					mysql_data_seek($resultPromotion,$posP);
				}
			}			
			$hd=explode(":",$row2["heure_debut"]);
			$hf=explode(":",$row2["heure_fin"]);
			print($hd[0]."h");
			if(strcmp($hd[1],"00")!=0) print($hd[1]);
			print(" - ".$hf[0]."h");
			if(strcmp($hf[1],"00")!=0) print($hf[1]);			
			print("<BR>\n");
			
			/* Calcul du nombre de minutes : */
			$minutes=((float)((int)($hf[1]))-((int)($hd[1])))*0.5/30;

			/* Calcul du nombre d'heures : */
			$heures=((int)($hf[0]))-((int)($hd[0]));
						
			$nbHeuresCours[$i]=($heures+$minutes);			
		}
		for($j=$i;$j<$MAX;$j++)
		{
			print("<BR>\n");
		}
		print("</FONT>\n");
		print("</TD>\n");		

	/*	NATURE		*/
		print("<TD ALIGN=CENTER VALIGN=TOP>\n");
		print("<font size=2>\n");

		$posP=0;
		$posG=0;
		if($nb_enrP>0) mysql_data_seek($resultPromotion,0);
		if($nb_enrG>0) mysql_data_seek($resultGroupe,0);

		for($i=0;$i<$nb_enr && $i<$MAX;$i++)
		{
			if($posP==$nb_enrP && $posG<$nb_enrG)
			{
				$row2=mysql_fetch_array($resultGroupe);
				$posG++;
			}
			if($posG==$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$posP++;
			}
			if($posG<$nb_enrG && $posP<$nb_enrP)
			{
				$row2=mysql_fetch_array($resultPromotion);
				$tstP=$row2["tst"];
				$tstP2=$row2["tst2"];
				$row2=mysql_fetch_array($resultGroupe);
				$tstG=$row2["tst"];
				$tstG2=$row2["tst2"];				
				if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
				{
					mysql_data_seek($resultGroupe,$posG);
					mysql_data_seek($resultPromotion,$posP);
					$posP++;
					$row2=mysql_fetch_array($resultPromotion);
				}else{
					$posG++;
					mysql_data_seek($resultPromotion,$posP);
				}
			}			
			$result3=mysql_query("SELECT type FROM typeseance t WHERE t.id_type_seance=".$row2["id_type_seance"],$connection);
			$row3=mysql_fetch_row($result3);
			print($row3[0]."<BR>\n");
			
			$c=0;
					
			if($row3[0]=="CM") $c=1.5;		// 1	CM
			if($row3[0]=="TD") $c=1;		// 2	TD
			if($row3[0]=="TDm") $c=1;		// 3	TDm
			if($row3[0]=="TP") $c=2/3;		// 4	TP
			
			$coeffTypeSeance[$i]=$c;
		}
		for($j=$i;$j<$MAX;$j++)
		{
			print("<BR>\n");
		}
		print("</FONT>\n");
		print("</TD>\n");		
		
	/*	TOTAL		*/
	
		print("<TD ALIGN=LEFT VALIGN=TOP WIDTH=83>\n");
			print("<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0>\n");
			print("<TR>\n");
				print("<TD WIDTH=83 HEIGHT=300 VALIGN=TOP ALIGN=RIGHT>\n");
				print("<font size=2>\n");
				
				$sommeEqTDPage=0;
				
				for($i=0;$i<$nb_enr && $i<$MAX;$i++)
				{		
					$eqTD=$nbHeuresCours[$i]*$coeffTypeSeance[$i];
					if($eqTD-((int)($eqTD))!=0) printf("%01.2f\n",$eqTD);
					else printf("%01.0f\n",$eqTD);
					print("<BR>\n");
					$sommeEqTDPage+=$eqTD;
				}
				for($j=$i;$j<$MAX;$j++)
				{
					print("<BR>\n");
				}
				print("</FONT>\n");					
				print("</TD>\n");
			print("</TABLE>\n");
		
		print("</FONT>\n");
		print("</TD>\n");		
			
	
	print("</TABLE>\n");
	
	print("<TABLE BORDER=0 WIDTH=925 CELLSPACING=0>\n");
	print("<TR>\n");
		print("<TD WIDTH=310></TD>\n");
		print("<TD WIDTH=68></TD>\n");
		print("<TD WIDTH=170></TD>\n");
		print("<TD WIDTH=87></TD>\n");
		print("<TD WIDTH=113></TD>\n");
		print("<TD WIDTH=94 ALIGN=RIGHT>\n");
			if($numPages==$totalPages) print("Total :\n");
			else print("Sous-total :\n");
		print("</TD>\n");
		print("<TD WIDTH=83 VALIGN=TOP ALIGN=LEFT>\n");
			print("<TABLE BORDER=2 CELLPADDING=0 CELLSPACING=0>\n");
			print("<TR>\n");
				print("<TD WIDTH=83 HEIGHT=20 ALIGN=CENTER><font size=2>\n");
				if($eqTD-((int)($sommeEqTDPage))!=0) printf("%01.2f\n",$sommeEqTDPage);
				else printf("%01.0f\n",$sommeEqTDPage);				
				print("</FONT></TD>\n");
			print("</TABLE>\n");			
		print("</TD>\n");		
	print("<TR>\n");
		print("<TD WIDTH=842 ALIGN=CENTER COLSPAN=6>\n");
			print("<font size=2>\n");
			if($numPages==$totalPages) print("Signature de l'intéressé(e) :\n");
			print("</FONT>\n");
		print("</TD>\n");
		print("<TD WIDTH=83 ALIGN=CENTER>\n");	
			print("<font size=2>\n");
			print("Page : ".$numPages."/".$totalPages);
			print("</FONT>\n");
		print("</TD>\n");	
	print("</TABLE>\n");	
	
	} // Fin de la premiere page
	
/**********************************************/	
/******		PAGES SUIVANTES		***************/	
/**********************************************/	

	else
	{
	$debutPage=$index;
		$debutP=$posP;
		$debutG=$posG;
		
		print("<TABLE BORDER=2 WIDTH=925 CELLSPACING=0 CELLPADDING=0>\n");
		
		print("<TR>\n");
			print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=310>\n");
			print("<FONT SIZE=2>\n");
			print("<B><BR>DIPL&Ocirc;ME ANNEE</B><BR>\n");
			print("<BR>(ex: DEUG 1ère année AES, 2ème année...)(2)\n");
			print("</FONT>\n");
			print("</TD>\n");
			
			print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=68>\n");
			print("<font size=2>\n");
			print("<B><BR>SITE</B><BR>\n");
			print("</FONT>\n");
			print("</TD>\n");
	
			print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=170>\n");
			print("<font size=2>\n");
			print("<B><BR>MATIERE ENSEIGNEE</B><BR>\n");
			print("</FONT>\n");	
			print("</TD>\n");
			
			print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=87>\n");
			print("<font size=2>\n");
			print("<B><BR>DATE</B><BR>\n");
			print("</FONT>\n");		
			print("</TD>\n");
			
			print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=113>\n");
			print("<font size=2>\n");
			print("<B><BR>HORAIRE<BR>Nombre d'heures<B>\n");
			print("</FONT>\n");
			print("</TD>\n");
			
			print("<TD ALIGN=CENTER VALIGN=TOP WIDTH=94>\n");
			print("<font size=2>\n");
			print("Nature de<BR>l'enseignement<BR>\n");
			print("<B>CM - TD - TP</B>\n");
			print("</FONT>\n");	
			print("</TD>\n");
			
			print("<TD ALIGN=LEFT VALIGN=TOP WIDTH=83 HEIGHT=68>\n");
				print("<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0>\n");
				print("<TR>\n");
					print("<TD WIDTH=83 HEIGHT=68 ALIGN=CENTER VALIGN=TOP>\n");
					print("<font size=2>\n");
					print("<B><BR>Total éq. TD</B><BR>\n");
					print("</FONT>\n");
					print("</TD>\n");
				print("</TABLE>\n");
			print("</TD>\n");
	
		print("<TR>\n");
		
		/*	DIPLOME ANNEE	*/
			print("<TD ALIGN=LEFT HEIGHT=530 VALIGN=TOP>\n");
			print("<font size=2>\n");
	
			$posP=$debutP;
			$posG=$debutG;
			if($debutP<$nb_enrP) mysql_data_seek($resultPromotion,$debutP);
			if($debutG<$nb_enrG) mysql_data_seek($resultGroupe,$debutG);
	
			for($i=$debutPage;$i<$nb_enr && $i<$debutPage+32;$i++)
			{
		//print($i." ".$nb_enrP." ".$nb_enrG." ".$posP." ".$posG."*");
			
				if($posP==$nb_enrP && $posG<$nb_enrG)
				{
					$row2=mysql_fetch_array($resultGroupe);
					$posG++;
					
		//print("g1\n");
				}
				if($posG==$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$posP++;
					
		//print("p1\n");
				}
				if($posG<$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$tstP=$row2["tst"];
					$tstP2=$row2["tst2"];
					$row2=mysql_fetch_array($resultGroupe);
					$tstG=$row2["tst"];
					$tstG2=$row2["tst2"];				
					if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
					{
						mysql_data_seek($resultGroupe,$posG);
						mysql_data_seek($resultPromotion,$posP);
						$posP++;
						$row2=mysql_fetch_array($resultPromotion);
		//print("p2\n");
					}else{
						$posG++;
						mysql_data_seek($resultPromotion,$posP);
		//print("g2\n");
					}
				}			
		//print($row2["id_planifie"]."\n");
				
				$result3=mysql_query("SELECT d.libelle, p.libelle FROM diplome d, promotion p WHERE d.id_diplome=p.id_diplome AND p.id_promotion=".$row2["id_promotion"],$connection);
				$row3=mysql_fetch_row($result3);
				print($row3[0]." - ".$row3[1]."<BR>\n");			
			}
			for($j=$i;$j<$debutPage+32;$j++)
			{
				print("<BR>\n");
			}
			print("</FONT>\n");
			print("</TD>\n");		
			
		/*	SITE		*/
	
			print("</FONT>\n");
			print("</TD>\n");
	
			print("<TD ALIGN=CENTER VALIGN=TOP>\n");
			print("<font size=2>\n");
	
			$posP=$debutP;
			$posG=$debutG;
			if($debutP<$nb_enrP) mysql_data_seek($resultPromotion,$debutP);
			if($debutG<$nb_enrG) mysql_data_seek($resultGroupe,$debutG);			
	
			for($i=$debutPage;$i<$nb_enr && $i<$debutPage+32;$i++)
			{
		//print($i." ".$nb_enrP." ".$nb_enrG." ".$posP." ".$posG."*");
			
				if($posP==$nb_enrP && $posG<$nb_enrG)
				{
					$row2=mysql_fetch_array($resultGroupe);
					$posG++;
					
		//print("g1\n");
				}
				if($posG==$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$posP++;
					
		//print("p1\n");
				}
				if($posG<$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$tstP=$row2["tst"];
					$tstP2=$row2["tst2"];
					$row2=mysql_fetch_array($resultGroupe);
					$tstG=$row2["tst"];
					$tstG2=$row2["tst2"];				
					if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
					{
						mysql_data_seek($resultGroupe,$posG);
						mysql_data_seek($resultPromotion,$posP);
						$posP++;
						$row2=mysql_fetch_array($resultPromotion);
		//print("p2\n");
					}else{
						$posG++;
						mysql_data_seek($resultPromotion,$posP);
		//print("g2\n");
					}
				}			
		//print($row2["id_planifie"]."\n");
				
				print($row2["libelle"]."<BR>\n");
			}
			for($j=$i;$j<$debutPage+32;$j++)
			{
				print("<BR>\n");
			}
			print("</FONT>\n");
			print("</TD>\n");
			
	
		/*	MATIERE		*/
	
			print("<TD ALIGN=CENTER VALIGN=TOP>\n");
			print("<font size=2>\n");
	
			$posP=$debutP;
			$posG=$debutG;
			if($debutP<$nb_enrP) mysql_data_seek($resultPromotion,$debutP);
			if($debutG<$nb_enrG) mysql_data_seek($resultGroupe,$debutG);
	
			for($i=$debutPage;$i<$nb_enr && $i<$debutPage+32;$i++)
			{
		//print($i." ".$nb_enrP." ".$nb_enrG." ".$posP." ".$posG."*");
			
				if($posP==$nb_enrP && $posG<$nb_enrG)
				{
					$row2=mysql_fetch_array($resultGroupe);
					$posG++;
					
		//print("g1\n");
				}
				if($posG==$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$posP++;
					
		//print("p1\n");
				}
				if($posG<$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$tstP=$row2["tst"];
					$tstP2=$row2["tst2"];
					$row2=mysql_fetch_array($resultGroupe);
					$tstG=$row2["tst"];
					$tstG2=$row2["tst2"];				
					if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
					{
						mysql_data_seek($resultGroupe,$posG);
						mysql_data_seek($resultPromotion,$posP);
						$posP++;
						$row2=mysql_fetch_array($resultPromotion);
		//print("p2\n");
					}else{
						$posG++;
						mysql_data_seek($resultPromotion,$posP);
		//print("g2\n");
					}
				}			
		//print($row2["id_planifie"]."\n");
				
				$result3=mysql_query("SELECT nom FROM matiere m WHERE m.id_matiere=".$row2["id_matiere"],$connection);
				$row3=mysql_fetch_row($result3);
				print($row3[0]."<BR>\n");			
			}
			for($j=$i;$j<$debutPage+32;$j++)
			{
				print("<BR>\n");
			}
			print("</FONT>\n");
			print("</TD>\n");		
			
		/*	DATE		*/
		
			print("<TD ALIGN=CENTER VALIGN=TOP>\n");
			print("<font size=2>\n");
	
			$posP=$debutP;
			$posG=$debutG;
			if($debutP<$nb_enrP) mysql_data_seek($resultPromotion,$debutP);
			if($debutG<$nb_enrG) mysql_data_seek($resultGroupe,$debutG);
	
			for($k=$debutPage;$k<$nb_enr && $k<$debutPage+32;$k++)
			{
		//print($i." ".$nb_enrP." ".$nb_enrG." ".$posP." ".$posG."*");
			
				if($posP==$nb_enrP && $posG<$nb_enrG)
				{
					$row2=mysql_fetch_array($resultGroupe);
					$posG++;
					
		//print("g1\n");
				}
				if($posG==$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$posP++;
					
		//print("p1\n");
				}
				if($posG<$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$tstP=$row2["tst"];
					$tstP2=$row2["tst2"];
					$row2=mysql_fetch_array($resultGroupe);
					$tstG=$row2["tst"];
					$tstG2=$row2["tst2"];				
					if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
					{
						mysql_data_seek($resultGroupe,$posG);
						mysql_data_seek($resultPromotion,$posP);
						$posP++;
						$row2=mysql_fetch_array($resultPromotion);
		//print("p2\n");
					}else{
						$posG++;
						mysql_data_seek($resultPromotion,$posP);
		//print("g2\n");
					}
				}			
		//print($row2["id_planifie"]."\n");
				
		//print("-".$row2["semaine"]."*".$row2["jour_semaine"]."-\n");				
				
				$resultS=mysql_query("SELECT numero_semaine_debut FROM periode pe WHERE pe.id_promotion=".$row2["id_promotion"],$connection);
				$rowS=mysql_fetch_array($resultS);
				
				/* test si le numéro de semaine est inférieur à la première semaine */
				if($row2["semaine"]<$rowS["numero_semaine_debut"])
				{
					$annee=$anneeDeb+1;
				}else{
					$annee=$anneeDeb;
				}
				$i=1;
				while(date("w",mktime(0,0,0,1,$i,$annee))!=1) $i++;
				$jourSemaineUn=$i;
				
				$mois=1;
				$finMois=31;
				$jour=$i;
				$dateAff=$jour." ".$tabMois[$mois]." ".$annee;
				while($i-$jourSemaineUn<(($row2["semaine"]-1)*7)+($row2["jour_semaine"])-1)
				{
					$jour++;
					if($jour>date("t",mktime(0,0,0,$mois,1,$annee)))
					{
						$jour=1;					
					}
					
					$i++;
					
					if($i>$finMois)
					{
						$mois++;
						$finMois=$finMois+date("t",mktime(0,0,0,$mois,1,$annee));
					}
					
					$dateAff=$jour." ".$tabMois[$mois]." ".$annee;
	//if($row2["semaine"]==5) print($dateAff."<BR>\n");
				}
				
				print($dateAff."<BR>\n");			
			}
			for($j=$k;$j<$debutPage+32;$j++)
			{
				print("<BR>\n");
			}
			print("</FONT>\n");
			print("</TD>\n");		
	
		/*	HORAIRE		*/
		
			print("<TD ALIGN=CENTER VALIGN=TOP>\n");
			print("<font size=2>\n");
	
			$posP=$debutP;
			$posG=$debutG;
			if($debutP<$nb_enrP) mysql_data_seek($resultPromotion,$debutP);
			if($debutG<$nb_enrG) mysql_data_seek($resultGroupe,$debutG);
	
			for($i=$debutPage;$i<$nb_enr && $i<$debutPage+32;$i++)
			{
		//print($i." ".$nb_enrP." ".$nb_enrG." ".$posP." ".$posG."*");
			
				if($posP==$nb_enrP && $posG<$nb_enrG)
				{
					$row2=mysql_fetch_array($resultGroupe);
					$posG++;
					
		//print("g1\n");
				}
				if($posG==$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$posP++;
					
		//print("p1\n");
				}
				if($posG<$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$tstP=$row2["tst"];
					$tstP2=$row2["tst2"];
					$row2=mysql_fetch_array($resultGroupe);
					$tstG=$row2["tst"];
					$tstG2=$row2["tst2"];				
					if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
					{
						mysql_data_seek($resultGroupe,$posG);
						mysql_data_seek($resultPromotion,$posP);
						$posP++;
						$row2=mysql_fetch_array($resultPromotion);
		//print("p2\n");
					}else{
						$posG++;
						mysql_data_seek($resultPromotion,$posP);
		//print("g2\n");
					}
				}			
		//print($row2["id_planifie"]."\n");
				
				$hd=explode(":",$row2["heure_debut"]);
				$hf=explode(":",$row2["heure_fin"]);
				print($hd[0]."h");
				if(strcmp($hd[1],"00")!=0) print($hd[1]);
				print(" - ".$hf[0]."h");
				if(strcmp($hf[1],"00")!=0) print($hf[1]);			
				print("<BR>\n");
				
				/* Calcul du nombre de minutes : */
				$minutes=((float)((int)($hf[1]))-((int)($hd[1])))*0.5/30;
	
				/* Calcul du nombre d'heures : */
				$heures=((int)($hf[0]))-((int)($hd[0]));
							
				$nbHeuresCours[$i]=($heures+$minutes);			
			}
			for($j=$i;$j<$debutPage+32;$j++)
			{
				print("<BR>\n");
			}
			print("</FONT>\n");
			print("</TD>\n");		
	
		/*	NATURE		*/
		
			print("<TD ALIGN=CENTER VALIGN=TOP>\n");
			print("<font size=2>\n");
	
			$posP=$debutP;
			$posG=$debutG;
			if($debutP<$nb_enrP) mysql_data_seek($resultPromotion,$debutP);
			if($debutG<$nb_enrG) mysql_data_seek($resultGroupe,$debutG);
	
			for($i=$debutPage;$i<$nb_enr && $i<$debutPage+32;$i++)
			{
		//print($i." ".$nb_enrP." ".$nb_enrG." ".$posP." ".$posG."*");
			
				if($posP==$nb_enrP && $posG<$nb_enrG)
				{
					$row2=mysql_fetch_array($resultGroupe);
					$posG++;
					
		//print("g1\n");
				}
				if($posG==$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$posP++;
					
		//print("p1\n");
				}
				if($posG<$nb_enrG && $posP<$nb_enrP)
				{
					$row2=mysql_fetch_array($resultPromotion);
					$tstP=$row2["tst"];
					$tstP2=$row2["tst2"];
					$row2=mysql_fetch_array($resultGroupe);
					$tstG=$row2["tst"];
					$tstG2=$row2["tst2"];				
					if($tstP2<$tstG2 || ($tstP2==$tstG2 && $tstP<$tstG))
					{
						mysql_data_seek($resultGroupe,$posG);
						mysql_data_seek($resultPromotion,$posP);
						$posP++;
						$row2=mysql_fetch_array($resultPromotion);
					}else{
						$posG++;
						mysql_data_seek($resultPromotion,$posP);
					}
				}			
				$result3=mysql_query("SELECT type, t.id_type_seance FROM typeseance t WHERE t.id_type_seance=".$row2["id_type_seance"],$connection);
				$row3=mysql_fetch_row($result3);
				print($row3[0]."<BR>\n");
				
				$c=0;
				
				if($row3[1]==1) $c=1.5;
				if($row3[1]==2) $c=1;
				if($row3[1]==3) $c=1;
				if($row3[1]==4) $c=2/3;
				
				$coeffTypeSeance[$i]=$c;		
			}
			for($j=$i;$j<$debutPage+32;$j++)
			{
				print("<BR>\n");
			}
			print("</FONT>\n");
			print("</TD>\n");		
			
		/*	TOTAL		*/
		
			print("<TD ALIGN=LEFT VALIGN=TOP WIDTH=83>\n");
				print("<TABLE BORDER=1 CELLPADDING=0 CELLSPACING=0>\n");
				print("<TR>\n");
					print("<TD WIDTH=83 HEIGHT=530 VALIGN=TOP ALIGN=RIGHT>\n");
					print("<font size=2>\n");
					
					for($i=$debutPage;$i<$nb_enr && $i<$debutPage+32;$i++)
					{		
						$eqTD=$nbHeuresCours[$i]*$coeffTypeSeance[$i];			
						if($eqTD-((int)($eqTD))!=0) printf("%01.2f\n",$eqTD);
						else printf("%01.0f\n",$eqTD);
						print("<BR>\n");
						$sommeEqTDPage+=$eqTD;
					}
					for($j=$i;$j<$debutPage+32;$j++)
					{
						print("<BR>\n");
					}
					print("</FONT>\n");					
					print("</TD>\n");
				print("</TABLE>\n");
			
			print("</FONT>\n");
			print("</TD>\n");		
				
		
		print("</TABLE>\n");
		
		print("<TABLE BORDER=0 WIDTH=925 CELLSPACING=0>\n");
		print("<TR>\n");
			print("<TD WIDTH=310></TD>\n");
			print("<TD WIDTH=68></TD>\n");
			print("<TD WIDTH=170></TD>\n");
			print("<TD WIDTH=87></TD>\n");
			print("<TD WIDTH=113></TD>\n");
			print("<TD WIDTH=94 ALIGN=RIGHT>\n");
				if($numPages==$totalPages) print("Total :\n");
				else print("Sous-total :\n");
			print("</TD>\n");
			print("<TD WIDTH=83 VALIGN=TOP ALIGN=LEFT>\n");
				print("<TABLE BORDER=2 CELLPADDING=0 CELLSPACING=0>\n");
				print("<TR>\n");
					print("<TD WIDTH=83 HEIGHT=20 ALIGN=CENTER><font size=2>\n");
					if($eqTD-((int)($sommeEqTDPage))!=0) printf("%01.2f\n",$sommeEqTDPage);
					else printf("%01.0f\n",$sommeEqTDPage);
					print("</FONT></TD>\n");
				print("</TABLE>\n");			
			print("</TD>\n");		
		print("<TR>\n");
			print("<TD WIDTH=842 ALIGN=CENTER COLSPAN=6>\n");
				print("<font size=2>\n");
				if($numPages==$totalPages) print("Signature de l'intéressé(e) :\n");
				print("</FONT>\n");
			print("</TD>\n");
			print("<TD WIDTH=83 ALIGN=CENTER>\n");	
				print("<font size=2>\n");
				print("Page : ".$numPages."/".$totalPages);
				print("</FONT>\n");
			print("</TD>\n");
		print("</TABLE>\n");
	} // Fin des pages suivantes

	if ($numPages<$totalPages) print("<INPUT TYPE=SUBMIT VALUE=\"Suite\">\n"); 
	print("<INPUT TYPE=HIDDEN NAME=\"posP\" VALUE=".$posP.">\n");
	print("<INPUT TYPE=HIDDEN NAME=\"posG\" VALUE=".$posG.">\n");
	print("<INPUT TYPE=HIDDEN NAME=\"sommeEqTDPage\" VALUE=".$sommeEqTDPage.">\n");
	print("</FORM>\n");

	}

	print("</BODY>\n</HTML>\n");
?>
Return current item: EmploiNet : a timetable web manager