Location: PHPKode > projects > EmploiNet : a timetable web manager > EmploiNet/v0.8.0/FichesAdmin/suivi_hres_departement.php3
<?
include("../Session/security.php");
   
$Max_ligne=15; // Nombre maximum de lignes par page
   
$autorisation_list[0]=0; // Administrateur
$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($databaseName);

  print("<HTML>\n<BODY BGCOLOR=white>\n");
  print("<FORM NAME=\"page\" action=\"suivi_hres_departement.php3\">\n");
  print("<INPUT TYPE=HIDDEN NAME=\"id_session\" VALUE=$id_session>\n");
  // Determination du numero d'enregistrement	courant
  if (isset($id_departement))
    $resultProf=mysql_query("SELECT id_professeur, nom, prenom FROM professeur WHERE id_departement=$id_departement ORDER BY nom,prenom");
  else 	$resultProf=mysql_query("SELECT id_professeur, nom, prenom FROM professeur ORDER BY nom,prenom");
  $nbEnr=mysql_num_rows($resultProf);
  if ($nbEnr>$Max_ligne) {
    print("<INPUT TYPE=HIDDEN NAME=\"index\" VALUE=");
    if (isset($index)) print($index+$Max_ligne);
    else print($Max_ligne);
    print(">\n");
  }
  if (!isset($num_ligne)) $num_ligne=0;
  // Calcul du numero de la page courante
  print("<INPUT TYPE=HIDDEN NAME=\"numPages\" VALUE=");
  if (isset($numPages)) print($numPages+1);
  else
    {
      print(2);
      $numPages=1;
      $num_ligne=0;
      $total_ligne=0;
    }
  print(">\n");
  $totalPages=floor($nbEnr/$Max_ligne);
  if ( ($nbEnr/$Max_ligne)-floor($nbEnr/$Max_ligne) != 0 ) $totalPages++;
	
  print("<INPUT TYPE=HIDDEN NAME=\"totalPages\" VALUE=$totalPages>\n");
  if ($numPages==1) $totalEqDoc=0;
  $totalEqPage=0;
  mysql_data_seek($resultProf,$index);

  print("<TABLE BORDER=1 WIDTH=471 CELLSPACING=0 CELLPADDING=0>\n");
  print("<TR>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=81>\n");
  print("	<FONT SIZE=2><B><BR>Prénom</B></FONT>\n");
  print("	</TD>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=81>\n");
  print("	<FONT SIZE=2><B><BR>Nom</B></FONT>\n");
  print("	</TD>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=57>\n");
  print("	<FONT SIZE=2><B><BR>Cours</B></FONT>\n");
  print("	</TD>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=57>\n");
  print("	<FONT SIZE=2><B><BR>TD</B></FONT>\n");
  print("	</TD>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=57>\n");
  print("	<FONT SIZE=2><B><BR>TDm</B></FONT>\n");
  print("	</TD>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=57>\n");
  print("	<FONT SIZE=2><B><BR>TP</B></FONT>\n");
  print("	</TD>\n");
  print("	<TD ALIGN=CENTER VALIGN=MIDDLE WIDTH=87>\n");
  print("	<font size=2><B><BR>Total(eq.TD)</B><BR></FONT>\n");
  print("	</TD>\n");
  print("</tr>\n");
  print("<TR>\n");				
  print("<TD>\n");
  while($num_ligne < $Max_ligne && $total_ligne < $nbEnr)	{
    $row=mysql_fetch_row($resultProf);			
    print("<TR>\n");
    print("<TD ALIGN=LEFT WIDTH=81>\n");
    print($row[1]."\n");
    print("</TD>\n");
    print("<TD ALIGN=LEFT WIDTH=81>\n");
    print($row[2]."\n");
    print("</TD>\n");
    /*
		id	type_seance
		1	CM
		2	TD
		3	TDm
		4	TP
		5	Examen
    */
    $resultHeuresCM=mysql_query("SELECT sum(nb_heures) from assurer WHERE id_professeur=".$row[0]." AND id_type_seance=1");
    $resultHeuresTD=mysql_query("SELECT sum(nb_heures) from assurer WHERE id_professeur=".$row[0]." AND id_type_seance=2");
    $resultHeuresTDm=mysql_query("SELECT sum(nb_heures) from assurer WHERE id_professeur=".$row[0]." AND id_type_seance=3");
    $resultHeuresTP=mysql_query("SELECT sum(nb_heures) from assurer WHERE id_professeur=".$row[0]." AND id_type_seance=4");
    if($resultHeuresCM==false) $totalCM=0;
    else{
      $rowCM=mysql_fetch_row($resultHeuresCM);
      $totalCM=$rowCM[0];
      if($totalCM=="") $totalCM=0;
    }
    if($resultHeuresTD==false) $totalTD=0;
    else{
      $rowTD=mysql_fetch_row($resultHeuresTD);
      $totalTD=$rowTD[0];
      if($totalTD=="") $totalTD=0;
    }
    if($resultHeuresTDm==false) $totalTDm=0;
    else{
      $rowTDm=mysql_fetch_row($resultHeuresTDm);
      $totalTDm=$rowTDm[0];
      if($totalTDm=="") $totalTDm=0;
    }
    if($resultHeuresTP==false) $totalTP=0;
    else{
      $rowTP=mysql_fetch_row($resultHeuresTP);
      $totalTP=$rowTP[0];
      if($totalTP=="") $totalTP=0;
    }
    $totalEq=1.5*$totalCM+$totalTD+$totalTDm+(2/3)*$totalTP;
    $totalEqPage+=$totalEq;
    $totalEqDoc+=$totalEq;
    print("<TD ALIGN=RIGHT WIDTH=57>\n");
    if($totalCM-((int)($totalCM))!=0) printf("%01.2f\n",$totalCM);
    else printf("%01.0f\n",$totalCM);
    print("</TD>\n");
    print("<TD ALIGN=RIGHT WIDTH=57>\n");
    if($totalTD-((int)($totalTD))!=0) printf("%01.2f\n",$totalTD);
    else printf("%01.0f\n",$totalTD);
    print("</TD>\n");
    print("<TD ALIGN=RIGHT WIDTH=57>\n");
    if($totalTDm-((int)($totalTDm))!=0) printf("%01.2f\n",$totalTDm);
    else printf("%01.0f\n",$totalTDm);
    print("</TD>\n");
    print("<TD ALIGN=RIGHT WIDTH=57>\n");
    if($totalTP-((int)($totalTP))!=0) printf("%01.2f\n",$totalTP);
    else printf("%01.0f\n",$totalTP);
    print("</TD>\n");
    print("<TD ALIGN=RIGHT><B>\n");
    if($totalEq-((int)($totalEq))!=0) printf("%01.2f\n",$totalEq);
    else printf("%01.0f\n",$totalEq);
    print("</B>\n");
    print("</TD>\n");			
    $num_ligne++;
    $total_ligne++;
  }
  print ("<TR>\n");
  print("<TD colspan=\"6\" WIDTH=390 ALIGN=RIGHT>\n");
  print("<B>\n");
  if($numPages<$totalPages) { 
    print("Sous-total : \n");
    print("</B>\n");		
    print("</TD>\n");
    print("<TD WIDTH=91 ALIGN=RIGHT>\n");
    printf("%01.2f\n",$totalEqPage);
    print("</TD>\n");	
  }
  else {
    print ("<TR>\n");
    print("<TD colspan=\"6\" WIDTH=390 ALIGN=RIGHT>\n");
    print("<B>\n");
    print("Sous-total : \n");
    print("</B>\n");		
    print("</TD>\n");
    print("<TD WIDTH=91 ALIGN=RIGHT>\n");
    printf("%01.2f\n",$totalEqPage);
    print("</TD>\n");
    print("</tr>\n");
    print ("<TR>\n");
    print("<TD colspan=\"6\" WIDTH=390 ALIGN=RIGHT>\n");
    print("<B>\n");
    print("Total : \n");
    print("</B>\n");		
    print("</TD>\n");
    print("<TD WIDTH=91 ALIGN=RIGHT>\n");
    printf("%01.2f\n",$totalEqDoc);
    print("</TD>\n");
    print("</tr>\n");
  }
	
  print("</table>");
  print("<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>\n");
  print("<TR>\n");
  print("<TD WIDTH=471 ALIGN=RIGHT>\n");
  print("Page : ".$numPages."/".$totalPages);
  print("</TD>\n");
  print("</TABLE>\n");
  if ($numPages<$totalPages) print("<INPUT TYPE=SUBMIT VALUE=\"Suite\">\n");
  print("<INPUT TYPE=hidden name=\"totalEqDoc\" VALUE=\"$totalEqDoc\">\n");
  print("<INPUT TYPE=hidden name=\"total_ligne\" VALUE=\"$total_ligne\">\n");
  print("</FORM>\n");
  print("</BODY>\n</HTML>\n");
}
?>
Return current item: EmploiNet : a timetable web manager