Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/projet/listeProjetValides.php
<?

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

include("../Session/security.php");
print("<HTML><HEAD>\n
<TITLE>Projet</TITLE>\n
</HEAD>\n
<BODY>\n");
// Verification de la session
$autorisation_list[0]=0; // administrateur
$autorisation_list[1]=1; // Professeur
$autorisation_list[2]=2; // Etudiant
$autorisation_list[3]=3; // gestionnaire
$user_type = validateSession($id_session);
if ($user_type == -1 || !security($id_session,$autorisation_list)) print("Accès refusé");
else {
  // Entete
  buildHeader("Liste définitive des projets");

  // Barre de menu
  print("<FONT SIZE=2><I>\n");
  print("<A HREF='../index.php?id_session=$id_session'>Menu</A><BR>\n");
  print("</I></FONT>\n");

// Determination du user_id
  $user_id = getUserID($id_session);
 
// connection à la table emploi_du_temps
  openConnection($databaseName);
  
//*****************************************
// Choisir la promotion
  print("<FORM METHOD=POST ACTION=\"listeProjetValides.php\">\n");
  print("<INPUT TYPE=HIDDEN NAME=\"id_session\" VALUE=$id_session>\n");
  print("  <table align=center border=0 cellspacing=0 cellpading=0 width=600 bgcolor=\"#C0C000\">\n");
// Liste des promotions
  print("        <tr>\n");
  print("          <td valign=top width=100 nowrap rowspan=3><font size=3><i>Promotion :</i></font></td>\n");
  print("          <td width=250 rowspan=3 valign=top>\n");
  if ($user_type==3) $result = mysql_query("SELECT distinct(promotion.id_promotion),diplome.libelle as L1,promotion.libelle as L2 FROM promotion,diplome,gerer WHERE gerer.id_gestionnaire=$user_id AND promotion.id_promotion=gerer.id_promotion AND diplome.id_diplome=promotion.id_diplome ORDER BY diplome.libelle");
  else 
  {
    if ($user_type==2) $result = mysql_query("SELECT id_promotion,diplome.libelle as L1,promotion.libelle as L2 FROM promotion,diplome WHERE promotion.id_diplome=diplome.id_diplome ORDER BY diplome.libelle");
    else $result = mysql_query("SELECT id_promotion,diplome.libelle as L1,promotion.libelle as L2 FROM promotion,diplome WHERE promotion.id_diplome=diplome.id_diplome ORDER BY diplome.libelle");
  }
  $index_max = mysql_num_rows($result); 
  if ($user_type==3 && $index_max == 1) {
    $a_record = mysql_fetch_array($result);
    $id_promotion=$a_record["id_promotion"];
    print($a_record["L1"]." ".$a_record["L2"]);
    print("\n");
  }
  else {
    print("          <select name=\"id_promotion\" size=1 width=200 OnChange=\"submit();\">\n");
    if (!isset($id_promotion)) print("          <option selected>");
    for ($i=0;$i<$index_max;$i++) {
      $a_record = mysql_fetch_array($result);
      if ($id_promotion==$a_record["id_promotion"]) print("          <option value=".$a_record["id_promotion"]." selected>");
      else print("          <option value=".$a_record["id_promotion"].">");
      print($a_record["L1"]." ".$a_record["L2"]);
      print("\n");
    }
  
    print("          </select>\n");
  }
  print("          </td>\n");
  print("        </tr>\n");
  print("      </table>\n");
  print("  </FORM>\n");
//**
//*****************************************
	

  if (isset($id_promotion)) {
    if ($user_type==1)
    {
  // requete pour stocker toutes les promotions
  $resultP=mysql_query("SELECT id_promotion,sigle from promotion");
  $numP = mysql_num_rows($resultP); //calcul du nb de promotions
  
  $resultProf=mysql_query("select id_professeur,nom,prenom from professeur");
  $numProf = mysql_num_rows($resultProf); //calcul du nb de professeur


      $result=mysql_query("select * from projet where id_promotion=$id_promotion");
	$nb = mysql_num_rows($result); //calcul du nb de projets

      print("<P><table align='center' border=2 cellpadding=5 cellspacing=5 bgcolor='#FFFFFF' bordercolor='black'>
      <col span=6 align='center'> 
      <tr>
        <th>Descriptif du projet</th><th>Promotion</th><th>Enseignant responsable</th><th>Nombre d'étudiants</th>
      </tr>");
      
      // pour tous les enregistrements de la requete, donc de toute la table liste_projet
      $j=0;
      while( $enr = mysql_fetch_array( $result ))
      {
     	  $j++;
	  print("<tr><td>");
	  echo "<a href=\"".$enr["url"]."\" target=\"projet\">".$enr["descriptif"]."</A>\n";
	  print("</td>\n");
		
	  // affichage de la promotion
	  echo "<td>";
	  if($enr["id_promotion"]==-1) echo "???";
	  for ($i=0;$i<$numP;$i++) {
		mysql_data_seek($resultP,$i);
		$rowP = mysql_fetch_array($resultP);
		if ($rowP["id_promotion"]==$enr["id_promotion"]) echo $rowP["sigle"];
	  }
	  print("</td>\n");
	
	// affichage du professeur responsable
	  echo "<td>";
	
	for ($i=0;$i<$numProf;$i++) {
		mysql_data_seek($resultProf,$i);
		$rowProf = mysql_fetch_array($resultProf);
		if ($rowProf["id_professeur"]==$enr["id_professeur"]) echo $rowProf["nom"]." ".$rowProf["prenom"]."\n";
	}
	print("</td>\n");
	
	echo "<td>";
	if ($enr["nb_etudiant"]==0) {
	   echo "???\n";
	}
	else {
	  echo $enr["nb_etudiant"];
	}
	echo "</td>";
	
	print("</tr>\n");
	// et on passe à l'enregistrement suivant...
}
print("</table></center><BR>\n");

    }
    
   // Affichage de la liste des projets affectés 
    
    $requete=mysql_query("select id_groupeetudiant as id,descriptif as D,nom,prenom,p.nb_etudiant as nbE from validerprojet v,projet p,professeur pr where p.num_proj=v.num_proj and p.id_professeur=pr.id_professeur and id_promotion=$id_promotion order by descriptif");
    $nbListe=mysql_num_rows($requete);
    if(!$nbListe) {
      echo "<table align='center' border=0 cellpadding=20 cellspacing=5 bgcolor='#C0C000' width=600>\n";
      echo "<tr><th align=center>Aucun Projet n'a encore été validé !!</th></tr>\n";
      echo "</table>\n";
    }
    else 
    {
      echo "<table cellspacing=5 border=2 bordercolor=black align=center bgcolor=\"#FFFFFF\">\n";
      echo "<col span=3 align=center>\n";
      echo "<tr><th>Descriptif du projet</th><th>Enseignant responsable</th><th>GROUPE</th></tr>\n";
      for($i=0;$i<$nbListe;$i++) 
      {                //un projet et un groupe
        $enr=mysql_fetch_array($requete);
        echo "<tr>\n";
        echo "<td>".$enr["D"]."</td>\n";
        echo "<td>".$enr["nom"]." ".$enr["prenom"]."</td>\n";
    
        $request=mysql_query("select nom,prenom from etudiant where id_groupeetudiant=".$enr["id"]);
        $nbE=mysql_num_rows($request);
        echo "<td>";
        for($k=0;$k<$nbE;$k++) {
          $un_etudiant=mysql_fetch_array($request);
          echo $un_etudiant["nom"]." ".$un_etudiant["prenom"]."<br>";
        }
        echo "</td>\n";
      }
      echo "</table>\n";
      }
    
    
  }
}
buildEndOfPage();
print("
</body>
</BODY>
</HTML>");


?>
Return current item: EmploiNet : a timetable web manager