<?
// ***************************************************************************************************
// ************************************** Suppression d'un cours *************************************
// ***************************************************************************************************
$n = count($id_promotion);
print("<table align=center border=0 cellspacing=0 cellpading=0 width=700 bgcolor=\"#ffcc33\">\n");
print("<tr>\n");
// Liste des promotions
print(" <td valign=top width=100 nowrap rowspan=2><font size=3><i>Promotion :</i></font></td>\n");
print(" <td width=250 rowspan=2 valign=top>\n");
include("../../Liste/liste_promotion.php");
print(" </td>\n");
// Liste des groupes associes a la promotion selectionnee
print(" <td valign=top width=100 nowrap><font size=3><i>Groupe :</i></font></td>\n");
print(" <td valign=top width=250>\n");
include("../../Liste/liste_groupe.php");
print(" </td>\n");
print(" </tr>\n");
// Periode
print(" <tr>\n");
print(" <td valign=top width=100 nowrap><font size=3><i>Période :</i></font></td>\n");
print(" <td valign=top width=250>\n");
include("../../Liste/liste_periode.php");
print(" </td>\n");
print(" </tr>\n");
// Semaine
print(" <tr>\n");
print(" <td colspan=4 align=center>\n");
include("../../Liste/liste_semaine.php");
print(" </td>\n");
print(" </tr>\n");
print(" <tr>\n");
if(isset($id_promotion[0]) && isset($s_semaine) && isset($id_periode))
{
print("<td colspan=\"2\" align=center><a href=\"choix_modif.php3?id_session=$id_session&user_type=$user_type&user_id=$user_id\">Autres modifications</a></td>\n");
print("<td colspan=\"2\" align=center><a href=\"javascript:document.form1.choice.value=1;document.form1.submit();\">Supprimer</a></td>\n");
}
else
{
print("<td colspan=\"4\" align=center><a href=\"choix_modif.php3?id_session=$id_session&user_type=$user_type&user_id=$user_id\">Autres modifications</a></td>\n");
}
print(" </tr>");
print("</table><br>\n");
// Affichage de l'emploi du temps
if(isset($id_promotion[0]) && isset($s_semaine) && isset($id_periode) && $id_promotion[0]!=-1 && $s_semaine!=-1 && $id_periode!=-1)
{
// Variables
$x_jour = array("Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi");
$NombreDeNiveau=0;
$request = "SELECT distinct(p.id_planifie), m.nom as nom_matiere, p.id_type_seance, p.id_professeur, p.id_salle, p.heure_debut, p.heure_fin, p.jour_semaine
FROM planifie p, planifiepromotion pp, planifiegroupe pg, matiere m
WHERE p.semaine = $s_semaine
AND p.id_matiere=m.id_matiere";
$where_suite="";
if ($id_groupe!=-1)
$where_suite=" AND pg.id_groupe=$id_groupe AND p.id_planifie=pg.id_planifie";
else
$where_suite=" AND pp.id_promotion=$id_promotion[0] AND p.id_planifie=pp.id_planifie";
$groupby=" GROUP BY p.jour_semaine,p.heure_debut";
$request=$request.$where_suite.$groupby;
$result = mysql_query($request);
$nb=mysql_num_rows($result); // Nombre de cours prévu
print("<script language=\"JavaScript\">\n");
print("document.form1.tableau1.value=''\n;");
print("</script>\n\n");
// Il y a au moins un cours prévu
if($nb>0)
{
print("<p align=center><b><i>Choisissez le(s) cours à supprimer ...</i></b><p><p>");
// Tableau
print("<table width=620 border=1 CELLSPACING=0 align=center bordercolor=black >\n");
print("<tr align=center>\n");
print("<td bgcolor=#C0C0C0><b>-</td>\n");
print("<td bgcolor=#C0C0C0><b>Sélection</td>\n");
print("<td bgcolor=#C0C0C0><b>Matière</td>\n");
print("<td bgcolor=#C0C0C0><b>Type</td>\n");
print("<td bgcolor=#C0C0C0><b>Professeur</td>\n");
print("<td bgcolor=#C0C0C0><b>Salle</td>\n");
print("<td bgcolor=#C0C0C0><b>Heure début</td>\n");
print("<td bgcolor=#C0C0C0><b>Heure fin</td>\n");
print("<td bgcolor=#C0C0C0><b>Jour</td>\n");
print("</tr>\n");
// Affichage du tableau de cours
while ($un_cours=mysql_fetch_array($result))
{
$NombreDeNiveau ++;
$request_type="SELECT t.type FROM typeseance t WHERE t.id_type_seance=".$un_cours[2];
$result_type=mysql_query($request_type);
$un_type=mysql_fetch_row($result_type);
$nb_type=mysql_num_rows($result_type);
$request_professeur="SELECT p.nom FROM professeur p WHERE p.id_professeur=".$un_cours["id_professeur"];
$result_professeur=mysql_query($request_professeur);
$un_prof=mysql_fetch_row($result_professeur);
$nb_prof=mysql_num_rows($result_professeur);
$request_salle="SELECT s.numero FROM salle s WHERE s.id_salle=".$un_cours["id_salle"];
$result_salle=mysql_query($request_salle);
$une_salle=mysql_fetch_row($result_salle);
$nb_salle=mysql_num_rows($result_salle);
print("<script language=\"JavaScript\">\n");
print(" document.form1.tableau1.value='0'+document.form1.tableau1.value\n;");
print("</script>\n\n");
print("<tr align=center>\n");
print("<td bgcolor=#C0C0C0> $NombreDeNiveau </td>\n");
print("<td> <a href=\"javascript:changerImage('ImageSelection$NombreDeNiveau');modifierChaineMult($NombreDeNiveau-1,$nb);\" ><IMG SRC=\"img/ellipse.gif\" NAME=\"ImageSelection$NombreDeNiveau\" border=0 border=no></a> </td>\n");
print("<input type=\"hidden\" name=\"ValId[$NombreDeNiveau]\" value=\"$un_cours[0]\">\n");
print("<td>".$un_cours["nom_matiere"]."</td>\n");
if ($nb_type==0)
print("<td>/</td>\n");
else
print("<td>".$un_type[0]."</td>\n");
if ($nb_prof==0)
print("<td>/</td>\n");
else
print("<td>".$un_prof[0]."</td>\n");
if ($nb_salle==0)
print("<td>/</td>\n");
else
print("<td>".$une_salle[0]."</td>\n");
print("<td>".$un_cours["heure_debut"]."</td>\n");
print("<td>".$un_cours["heure_fin"]."</td>\n");
print("<td>".$x_jour[$un_cours["jour_semaine"]]."</td>\n");
print("</tr>\n");
}
print("</table>\n");
}
// Pas de cours programmé cette semaine
else
print("<h2 align=center><b>Aucun cours n'est prévu cette semaine</b></h2>\n");
}
print("</form>\n");
?>