Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/gdn/sortir_bulletin.php3
<?



	

	include("../BarreDeMenu.php3");

	

	include("../Session/security.php");



// Entete

    buildHeader("Relev&eacute; de notes");



// Verification de la session

	$autorisation_list[0]=1; // Professeur

	$autorisation_list[1]=2; // Etudiant

	$user_type = validateSession($id_session);

	if ($user_type == -1 || !security($id_session,$autorisation_list)) print("Accès refusé");

    else

    {

// Barre de menu

		buildMenuBar($id_session,$user_type,"gdn/sortir_bulletin.php3",false);

// Determination du id_user a l'aide du id_session

		$user_id = getUserID($id_session);

// Ouverture de la connexion

	    $connection = openConnection($databaseName);

	    if (!isset($index)) $index=0;


//***********************************************************************************************

//*  Debut du formulaire

//***********************************************************************************************



    print("<form name=\"form1\" action=\"sortir_bulletin.php3\" method=post>\n");



    print("  <input type=\"hidden\" name=\"login\" value=\"$login\">\n");

	print("  <input type=\"hidden\" name=\"index\" value=\"$index\">\n");	

	print("  <input type=\"hidden\" name=\"choice\" value=\"0\">\n");	

    print("  <input type=\"hidden\" name=\"id_session\" value=\"$id_session\">\n");

    print("  <input type=\"hidden\" name=\"user_type\" value=\"$user_type\">\n");

    print("  <input type=\"hidden\" name=\"user_id\" value=\"$user_id\">\n");

    print("  <input type=\"hidden\" name=\"display\" value=\"$display\">\n");

    print("  <input type=\"hidden\" name=\"id_typebulletin\" value=\"$id_typebulletin\">\n");

    print("  <input type=\"hidden\" name=\"id_groupematiere\" value=\"$id_groupematiere\">\n");

    print("  <input type=\"hidden\" name=\"promo\" value=\"$promo\">\n");

    print("  <input type=\"hidden\" name=\"id_periode\" value=\"$id_periode\">\n");



	// on recherche qui est le gestionnaire :

	$result = mysql_query("SELECT id_gestionnaire, G.nom, G.prenom FROM gestionnaire G, professeur P WHERE P.id_professeur=$user_id AND P.nom=G.nom AND P.prenom=G.prenom");

	$tmp = mysql_fetch_row($result);

	$id_gestionnaire = $tmp[0];

	$nom_g		= $tmp[1];

	$prenom_g	= $tmp[2];





//***********************************************************************************************

//****	PREMIERE ETAPE : SELECTION DE LA PROMOTION, DE LA PERIODE, ET DU TYPE DE BULLETIN	*****

//***********************************************************************************************

if($index<=3){



	// liste des promotions que le gestionnaire gère

	$result2 = mysql_query("SELECT P.id_promotion, P.sigle FROM promotion P, gerer G WHERE P.id_promotion=G.id_promotion AND G.id_gestionnaire=$id_gestionnaire");



    print("  <table align=center border=0 cellspacing=0 cellpading=0 bgcolor=\"#C0C000\">\n");

    print("  <tr>\n");

    print("    <td>\n");

    print("		<font size=3><i>Promotion : </i></font> \n");

    print("    </td>\n");

    print("    <td>\n");

    print("		<SELECT tabindex=-1 NAME=\"promo\" onChange=\"index.value=2;submit();\">  \n");

	if(!isset($promo))  print("	<OPTION SELECTED > </option> \n");

	for($i=0;$i<mysql_num_rows($result2);$i++){

		$temp = mysql_fetch_row($result2);

		if(isset($promo) && $temp[0]==$promo)

		    print("	<OPTION SELECTED VALUE=$temp[0]> $temp[1] \n");

		else

		    print("	<OPTION VALUE=$temp[0]> $temp[1] \n");

	}

    print("		</SELECT>  \n");

    print("    </td>\n");

    print("  </tr>\n");



	if($index==2){

		// liste des périodes :

		$result3 = mysql_query("SELECT id_periode, numero FROM periode WHERE id_promotion=$promo");

		print("  <tr>\n");

		print("    <td>\n");

		print("		<font size=3><i>P&eacute;riode : </i></font> \n");

		print("    </td>\n");

		print("    <td>\n");

		print("		<SELECT size=1 tabindex=-1 NAME=\"id_periode\" onChange=\"index.value=3;submit();\">  \n");

		print("	<OPTION SELECTED > </option> \n");

		for($i=0;$i<mysql_num_rows($result3);$i++){

			$temp = mysql_fetch_row($result3);

			print("	<OPTION VALUE=$temp[0]> $temp[1] \n");

		}

		print("		</SELECT>  \n");

		print("    </td>\n");

		print("  </tr>\n");

	}



	if($index==3){

		// liste des types de bulletins :

		$result4 = mysql_query("SELECT id_typebulletin, libelle FROM typebulletin WHERE id_promotion=$promo");

		print("  <tr>\n");

		print("    <td>\n");

		print("		<font size=3><i>Type de bulletin : </i></font> \n");

		print("    </td>\n");

		print("    <td>\n");

		print("		<SELECT size=1 tabindex=-1 NAME=\"id_typebulletin\" onChange=\"index.value=4;submit();\">  \n");

		print("	<OPTION SELECTED > </option> \n");

		for($i=0;$i<mysql_num_rows($result4);$i++){

			$temp = mysql_fetch_row($result4);

			print("	<OPTION VALUE=$temp[0]> $temp[1] \n");

		}

		print("		</SELECT>  \n");

		print("    </td>\n");

		print("  </tr>\n");

	}



	print("  </table> \n");



}// fin index==1 ou 2 ou 3





//***********************************************************************************************

//********			INDEX = 4 : LISTE DES ETUDIANTS INSCRITS DANS LA PROMO			*************

//***********************************************************************************************



if($index==4){



	// infos sur la promotion et sur la période :

	$result2 = mysql_query("SELECT P.libelle, PE.numero, PE.numero_semaine_debut, nb_semaines, P.sigle, TB.libelle FROM promotion P, periode PE, typebulletin TB WHERE P.id_promotion=$promo AND PE.id_promotion=$promo AND PE.id_periode=$id_periode AND TB.id_typebulletin=$id_typebulletin ");

	$tmp = mysql_fetch_row($result2);



	print("  &nbsp;<i> <u>Promotion :</u> $tmp[0]</i> <BR> \n");

	print("  &nbsp;<i> <u>P&eacute;riode :</u> $tmp[1] (commence sem. $tmp[2] et s'&eacute;tend sur $tmp[3] sem.)</i> <BR> \n");

	print("  &nbsp;<i> <u>Type de Bulletin :</u> $tmp[5]</i> <BR> \n");



	$result3 = mysql_query("SELECT E.id_etudiant, E.nom, E.prenom FROM etudiant E, inscrit I WHERE E.id_etudiant=I.id_etudiant AND I.id_promotion=$promo ORDER BY E.nom, E.prenom ");



	print(" <div align=center > <br><i><b>Liste des &eacute;tudiants concern&eacute;s :</b></i><br><br> \n");

	print("  <select name=id_etudiant size=10  onChange=\"index.value=5;submit();\"> \n");

	for($i=0;$i<mysql_num_rows($result3);$i++){

		$temp = mysql_fetch_row($result3);

		print(" <option value=$temp[0]> $temp[1] $temp[2] \n");

	}

	print(" </select> </div> \n");



}// fin index=4





//***********************************************************************************************

//********				INDEX = 5 : BULLETIN DE L'ETUDIANT SELECTIONNE				*************

//***********************************************************************************************



if($index==5){

    print("  <input type=\"hidden\" name=\"id_etudiant\" value=\"$id_etudiant\">\n");



	$result1 = mysql_query(" SELECT E.nom, E.prenom, P.libelle, TB.libelle FROM etudiant E, inscrit I, promotion P, typebulletin TB WHERE E.id_etudiant=$id_etudiant AND I.id_etudiant=E.id_etudiant AND I.id_promotion=P.id_promotion AND TB.id_typebulletin=$id_typebulletin ");

	$infos = mysql_fetch_row($result1);

	print(" <font face=\"arial\" size=3><i> &nbsp;Relev&eacute; de notes - bulletin $infos[3] <br>&nbsp;Promotion $infos[2]</i><br><b>&nbsp; Notes obtenues par $infos[1] $infos[0] </b></font><hr width=600><br>\n");



	$result2 = mysql_query(" SELECT DISTINCT GM.id_groupematiere, GM.numero, GM.intitule, GM.id_groupe FROM groupematiere GM, appartient A WHERE GM.id_typebulletin=$id_typebulletin AND (GM.id_groupe=-1 OR ( A.id_etudiant=$id_etudiant AND A.id_groupe=GM.id_groupe ) ) ORDER BY GM.numero");

	$nb_mat = 0;



	print(" <table width=600 align=center border=0 cellspacing=0 cellpading=0> <tr> <td width=100>&nbsp; </td> <td> \n");

	print(" <table width=500 align=center border=1 cellspacing=0 cellpading=0> \n");

	print(" <tr>  \n");

	print("   <td align=left width=275><font face=\"arial\" size=2>  &nbsp; Discipline </font></td>  \n"); 

	print("   <td align=center width=75><font face=\"arial\" size=2> Moyenne<br>&eacute;tudiant </font></td>  \n"); 

	print("   <td align=center width=75><font face=\"arial\" size=2> Moyenne<br>promotion </font></td>  \n"); 

	print("   <td align=center width=75><font face=\"arial\" size=2> Coefficient </font></td>  \n"); 

	print(" </tr>  \n");

	print(" </table>  \n");



	$moyenne_generale_etudiant = 0.0;

	$moyenne_generale_promotion = 0.0;

	$nb_gm = 0;

	$defaillant = 0;



	for($i=0;$i<mysql_num_rows($result2);$i++){

		$defaillant_matiere = 0;

		$groupematiere = mysql_fetch_row($result2);

		print(" </td></tr><tr> <td colspan=2> \n");

		print("  <table align=center border=0 cellspacing=0 cellpading=0 width=600>\n");

		print(" <tr> \n");

		print("   <td align=left bgcolor=\"#CCCCCC\"><font face=\"arial\" size=3><b> &nbsp;&nbsp;$groupematiere[1] - $groupematiere[2] </b></font></td> \n");

		print(" </tr> \n");

		print(" </table> \n");

		print(" </td></tr>  \n");

		print("  <tr> <td width=100>&nbsp; </td> <td> \n");



		$result3 = mysql_query(" SELECT MAT.id_matiere, MAT.nom, AMA.coefficient FROM matiere MAT, associerMatiereAGroupeMatiere AMA WHERE MAT.id_periode=$id_periode AND AMA.id_matiere=MAT.id_matiere AND AMA.id_groupematiere=$groupematiere[0]");

		$nb_mat_groupe = mysql_num_rows($result3);

		$nb_mat += $nb_mat_groupe;

		print(" <table width=500 align=center border=1 cellspacing=0 cellpading=0> \n");

		$moy_etudiant = 0.0;

		$moy_promotion = 0.0;

		$somme_coeff = 0;

		for($j=0;$j<$nb_mat_groupe;$j++){

			$matiere = mysql_fetch_row($result3);

			$result3_bis = mysql_query(" SELECT M.moyenne, MP.moyenne FROM  moyenne M, moyennepromotion MP WHERE M.id_matiere=$matiere[0] AND M.id_etudiant=$id_etudiant AND MP.id_matiere=M.id_matiere AND MP.id_promotion=$promo AND MP.id_groupe=$groupematiere[3]");

			if(mysql_num_rows($result3_bis)!=0){

				$matiere_bis = mysql_fetch_row($result3_bis);

			}else{

				$matiere_bis[0] = "&nbsp;";

				$matiere_bis[1] = "&nbsp;";

			}

			if($matiere_bis[0]==-2){

				$moy="<font color=red>def</font>";

				$defaillant_matiere = 1;

				$defaillant = 1;

			}else

				$moy=$matiere_bis[0];

			print(" <tr> \n");

			print("   <td align=left width=275><font face=\"arial\" size=2> &nbsp; $matiere[1]  </font></td>  \n");

			print("   <td align=center width=75><font face=\"arial\" size=2>  $moy  </font></td>  \n");

			print("   <td align=center width=75> <font face=\"arial\" size=2> $matiere_bis[1]   </font></td>  \n");

			print("   <td align=center width=75> <font face=\"arial\" size=2>  $matiere[2]  </font></td> </tr> \n");

			if($matiere_bis[0]!="&nbsp;"){

				$moy_etudiant += ($matiere_bis[0] * $matiere[2]);

				$moy_promotion += ($matiere_bis[1] * $matiere[2]);

				$somme_coeff += $matiere[2];

			}

		}

		if($somme_coeff!=0){

			if($defaillant_matiere==1) 

				$moy_etudiant = "<font color=red>def</font>";

			else{

				$moy_etudiant = sprintf ("%01.2f",$moy_etudiant / $somme_coeff);

				$moyenne_generale_etudiant += $moy_etudiant;

			}

			$moy_promotion = sprintf ("%01.2f",$moy_promotion / $somme_coeff);

			$moyenne_generale_promotion += $moy_promotion;

			$nb_gm++;

		}else{

			$moy_etudiant = "";

			$moy_promotion = "";

		}

		print(" <tr> \n");

		print("   <td align=left width=275><font face=\"arial\" size=2><b> &nbsp;Moyenne  </b></font></td>  \n");

		print("   <td align=center width=75><font face=\"arial\" size=2><b>  $moy_etudiant  </b></font></td>  \n");

		print("   <td align=center width=75> <font face=\"arial\" size=2><b> $moy_promotion   </b></font></td>  \n");

		print("   <td align=center width=75> <font face=\"arial\" size=2> &nbsp;  </font></td> </tr> \n");



		print(" </table><br> \n");

	}





	if($nb_gm!=0){

		if($defaillant==1)

			$moyenne_generale_etudiant = "<font color=red>D&eacute;faillant</font>";

		else

			$moyenne_generale_etudiant = sprintf ("%01.2f", $moyenne_generale_etudiant / $nb_gm );

		$moyenne_generale_promotion = sprintf ("%01.2f", $moyenne_generale_promotion / $nb_gm );

	}else{

		$moyenne_generale_etudiant = "";

		$moyenne_generale_promotion = "";

	}

	print(" </td></tr> \n");

	print(" <tr><td> </td> <td align=left> \n");

	print(" <table width=425 align=left border=1 cellspacing=0 cellpading=0> \n");

	print(" <tr> \n");

	print("   <td align=left width=275><font face=\"arial\" size=2><b> &nbsp;Moyenne G&eacute;n&eacute;rale  </b></font></td>  \n");

	print("   <td align=center width=75><font face=\"arial\" size=2><b>  $moyenne_generale_etudiant  </b></font></td>  \n");

	print("   <td align=center width=75> <font face=\"arial\" size=2><b> $moyenne_generale_promotion   </b></font></td>  \n");

	print(" </tr> \n");

	print(" </table><br> \n");



	print(" </td></tr></table> \n");





	$tmp = mysql_query(" SELECT E.id_etudiant FROM etudiant E, inscrit I WHERE I.id_etudiant=E.id_etudiant AND I.id_promotion=$promo ORDER BY E.nom, E.prenom");

	$data = mysql_fetch_row($tmp);

	$i=0;

	while($data[0]!=$id_etudiant){

		$data = mysql_fetch_row($tmp);

		$i++;

	}

	if($i==0) $prec = 0;

	else $prec = $i-1;

	if($i==mysql_num_rows($tmp)-1) $suiv = $i;

	else $suiv = $i+1;

	// recherche de l'id de l'etudiant precedant dans la liste

	mysql_data_seek($tmp, $prec);

	$data = mysql_fetch_row($tmp);

	$prec = $data[0];

	// recherche de l'id de l'etudiant suivant

	mysql_data_seek($tmp, $suiv);

	$data = mysql_fetch_row($tmp);

	$suiv = $data[0];



	print(" <a href=\"Javascript:document.form1.id_etudiant.value=$prec;document.form1.submit();\"><</a> \n");

	print(" <a href=\"Javascript:document.form1.id_etudiant.value=$suiv;document.form1.submit();\">></a> \n");



}//fin index=5

//***********************************************************************************************

//*  Fin du formulaire

//***********************************************************************************************



	print("</form> \n");



//***********************************************************************************************

//***********************************************************************************************

//***********************************************************************************************

}

	

	buildEndOfPage();	



?>

Return current item: EmploiNet : a timetable web manager