Beispiel #1
0
				}
			}
			// Si on a 1 décalage, le cours fini au milieu du créneau suivant
			if ($decalage) {
				if (.5 == $tab_enseignement_final['heuredeb_dec'][$indiceSemaine]) {
					$finCours = 0;
					$cptSeq--;
					$eleveCourant['sequence'][$derSeq]['heureFin'] = $tableCreneau[intval (($cptSeq) / 2)]['heureFin'];
				} else {
					$finCours = intval (($tableCreneau[intval ($cptSeq / 2)]['heureFin'] - $tableCreneau[intval ($cptSeq / 2)]['heureDebut']) / 2);
					$eleveCourant['sequence'][$derSeq]['heureFin'] = $tableCreneau[intval ($cptSeq / 2)]['heureFin'] - $finCours;
				}
			}
			
			// Si on a 1 décalage et pas de cours sur le créneau, on a 1/2 heure d'étude
			if ($decalage && !RecupereEnseignementsIDEleve(($cpt+1), $jour, $login_e, $tab_enseignement_final, $periode)) {
				$eleveCourant['sequence'][$cptSeq]['duree'] = 'Etude';
				$cptSeq++;
				$decalage = 0;
			$cpt++;
			}
			
			$cpt++;
		} else {
			$eleveCourant['sequence'][$cptSeq]['duree'] = 'Etude';
			$cptSeq++ ;
			$eleveCourant['sequence'][$cptSeq]['duree'] = 'Etude';
			$cptSeq++ ;
			$cpt++;
		}
	}
Beispiel #2
0
function ConstruireEDTEleveDuJour($login_eleve, $period, $jour)
{
    $table_data = array();
    $tab_cours = array();
    $type_edt = "eleve";
    $req_jours = mysqli_query($GLOBALS["mysqli"], "SELECT jour_horaire_etablissement FROM horaires_etablissement WHERE ouvert_horaire_etablissement = 1") or die(mysqli_error($GLOBALS["mysqli"]));
    $jour_sem_tab = array();
    $entetes = ConstruireEnteteEDT();
    while (!isset($entetes['entete'][$jour])) {
        $jour--;
    }
    $jour_sem_tab[$jour] = $entetes['entete'][$jour];
    $tab_data['entete'][$jour] = $entetes['entete'][$jour];
    $req_id_creneaux = mysqli_query($GLOBALS["mysqli"], "SELECT id_definie_periode FROM edt_creneaux\r\n\t\t\t\t\t\t\t    WHERE type_creneaux != 'pause'") or die(mysqli_error($GLOBALS["mysqli"]));
    $nbre_lignes = mysqli_num_rows($req_id_creneaux);
    if ($nbre_lignes == 0) {
        $nbre_lignes = 1;
    }
    if ($nbre_lignes > 10) {
        $nbre_lignes = 10;
    }
    $tab_data['nb_creneaux'] = $nbre_lignes;
    $index_box = 0;
    $erreur = false;
    while (isset($jour_sem_tab[$jour])) {
        $tab_id_creneaux = retourne_id_creneaux();
        $j = 0;
        $elapse_time = 0;
        while (isset($tab_id_creneaux[$j]) and !$erreur) {
            $nb_rows = RecupereEnseignementsIDEleve($j, $jour_sem_tab[$jour], $login_eleve, $tab_cours, $period);
            //echo "nb de cours = ".$nb_rows."<br/>";
            // ========================================== créneau vide
            if ($nb_rows == 0) {
                $delay = 2 - $elapse_time % 2;
                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $delay, "cadre", "");
                $elapse_time += $delay;
            } else {
                if ($nb_rows == 1) {
                    // ---- Le cours a lieu en semaine A ou B
                    if ($tab_cours['id_semaine'][0] != '0') {
                        $duree_max = $tab_cours['duree'][0];
                        $heuredeb_dec = $tab_cours['heuredeb_dec'][0];
                        // ========= études des cas n°2 , 6 et 7
                        if ($duree_max == 1 || ($duree_max == 2 and $heuredeb_dec == 0)) {
                            if ($heuredeb_dec == 0 and $elapse_time % 2 != 0) {
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                $elapse_time++;
                            } else {
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule2", "", "");
                                if ($duree_max == 1 and $heuredeb_dec != 0) {
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                    $elapse_time++;
                                }
                                $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][0], $tab_cours['id_aid'][0], $tab_cours['id_semaine'][0], $period);
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][0], "cellule" . $duree_max, $tab_cours['couleur'][0], $contenu);
                                $elapse_time += $duree_max;
                                if ($duree_max == 1 and $heuredeb_dec == 0) {
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                    $elapse_time++;
                                }
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule2", "", "");
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule2", "cadre", "");
                                RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                            }
                        } else {
                            $duree_max = DureeMax2ColonnesEleve($jour_sem_tab[$jour], $login_eleve, $tab_id_creneaux, $elapse_time, $tab_cours, $j, 0, 1, $period);
                            ConstruireColonneEleve($elapse_time, $tab_cours, 0, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, '0', $tab_data, $index_box, $period);
                            ConstruireColonneEleve($elapse_time, $tab_cours, 1, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, $tab_cours['id_semaine'][0], $tab_data, $index_box, $period);
                            $elapse_time += $duree_max;
                        }
                    } else {
                        // ======== étude du cas n°5
                        if ($tab_cours['heuredeb_dec'][0] != 0 and $elapse_time % 2 == 0) {
                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                            $elapse_time++;
                        }
                        // ======== étude du cas n°3
                        if ($tab_cours['heuredeb_dec'][0] == 0 and $elapse_time % 2 == 1 and $tab_cours['duree'][0] == 1) {
                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                            $elapse_time++;
                        } else {
                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][0], $tab_cours['id_aid'][0], "", $period);
                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][0], "cellule" . $tab_cours['duree'][0], $tab_cours['couleur'][0], $contenu);
                            $elapse_time += (int) $tab_cours['duree'][0];
                        }
                    }
                } else {
                    if ($nb_rows == 2) {
                        $duree1 = $tab_cours['duree'][0];
                        $heuredeb_dec1 = $tab_cours['heuredeb_dec'][0];
                        $id_semaine1 = $tab_cours['id_semaine'][0];
                        $duree2 = $tab_cours['duree'][1];
                        $heuredeb_dec2 = $tab_cours['heuredeb_dec'][1];
                        $id_semaine2 = $tab_cours['id_semaine'][1];
                        // ---- cas classique des alignements des cours de langues
                        // ---- les id_semaine sont identiques pour les deux cours : 0 0, A A ou B B.
                        // ---- cas non traités : génération des deux colonnes à partir de la notion de groupes
                        // ---- ici, on n'affiche qu'un créneau et si les cours sont de durées différentes, on
                        // ---- complète avec des créneaux vides.
                        if ($id_semaine1 == $id_semaine2) {
                            $elapse_time1 = $elapse_time;
                            if ($heuredeb_dec1 != 0 and $elapse_time1 % 2 == 0) {
                                $duree1++;
                            }
                            if ($heuredeb_dec2 != 0 and $elapse_time1 % 2 == 0) {
                                $duree2++;
                            }
                            if ($duree1 > $duree2) {
                                $duree_max = $duree1;
                            } else {
                                $duree_max = $duree2;
                            }
                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $duree_max, "", "");
                            if ($heuredeb_dec1 != 0 and $elapse_time1 % 2 == 0) {
                                RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                $elapse_time1++;
                            }
                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][0], $tab_cours['id_aid'][0], "", $period);
                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][0], "cellule" . $tab_cours['duree'][0], $tab_cours['couleur'][0], $contenu);
                            $elapse_time1 += (int) $tab_cours['duree'][0];
                            if ($elapse_time1 < $elapse_time + $duree_max) {
                                $time_left = $elapse_time + $duree_max - $elapse_time1;
                                RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $time_left, "cadre", "");
                                $elapse_time1++;
                            }
                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                            $elapse_time1 = $elapse_time;
                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $duree_max, "", "");
                            if ($heuredeb_dec2 != 0 and $elapse_time1 % 2 == 0) {
                                RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                $elapse_time1++;
                            }
                            $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][1], $tab_cours['id_aid'][1], "", $period);
                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][1], "cellule" . $tab_cours['duree'][1], $tab_cours['couleur'][1], $contenu);
                            $elapse_time1 += (int) $tab_cours['duree'][1];
                            if ($elapse_time1 < $elapse_time + $duree_max) {
                                $time_left = $elapse_time + $duree_max - $elapse_time1;
                                RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $time_left, "cadre", "");
                                $elapse_time1++;
                            }
                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                            $elapse_time += $duree_max;
                        } else {
                            // ========= étude des cas n°8 et n°9 et n°14 et n°15 et n°16 et 10
                            $duree_max = DureeMax2ColonnesEleve($jour_sem_tab[$jour], $login_eleve, $tab_id_creneaux, $elapse_time, $tab_cours, $j, 0, 1, $period);
                            ConstruireColonneEleve($elapse_time, $tab_cours, 0, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, '0', $tab_data, $index_box, $period);
                            //echo $tab_cours['id_semaine'][0];
                            ConstruireColonneEleve($elapse_time, $tab_cours, 1, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, $tab_cours['id_semaine'][0], $tab_data, $index_box, $period);
                            $elapse_time += $duree_max;
                        }
                    } else {
                        if ($nb_rows == 3) {
                            $duree1 = $tab_cours['duree'][0];
                            $heuredeb_dec1 = $tab_cours['heuredeb_dec'][0];
                            $id_semaine1 = $tab_cours['id_semaine'][0];
                            $duree2 = $tab_cours['duree'][1];
                            $heuredeb_dec2 = $tab_cours['heuredeb_dec'][1];
                            $id_semaine2 = $tab_cours['id_semaine'][1];
                            $duree3 = $tab_cours['duree'][2];
                            $heuredeb_dec3 = $tab_cours['heuredeb_dec'][2];
                            $id_semaine3 = $tab_cours['id_semaine'][2];
                            $tab_cas = EtudeDeCasTroisCours($tab_cours);
                            //echo $tab_cas['cas_detecte']."<br/>";
                            if ($tab_cas['cas_detecte'] >= 22 and $tab_cas['cas_detecte'] <= 30) {
                                $elapse_time1 = $elapse_time;
                                // ---- TODO : Calculer proprement $duree_max
                                if ($heuredeb_dec1 != 0 and $elapse_time1 % 2 == 0) {
                                    $duree1++;
                                }
                                if ($heuredeb_dec2 != 0 and $elapse_time1 % 2 == 0) {
                                    $duree2++;
                                }
                                if ($heuredeb_dec3 != 0 and $elapse_time1 % 2 == 0) {
                                    $duree3++;
                                }
                                if ($duree1 > $duree2) {
                                    $duree_max = $duree1;
                                } else {
                                    $duree_max = $duree2;
                                }
                                if ($duree3 > $duree_max) {
                                    $duree_max = $duree3;
                                }
                                // ---- la variable suivante est une mémoire pour savoir quel enregistrement utiliser.
                                $isFirstColUsed = false;
                                // ---- remplissage de la colonne 1/3
                                $res = ConstruireColonneEleveTiers($elapse_time, $tab_cours, 0, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, '0', $tab_data, $index_box, $isFirstColUsed, $period);
                                //if ($res > $elapse_time + $duree_max)
                                //{
                                //    $duree_max = $res - $elapse_time;
                                //}
                                // ---- remplissage de la colonne 2/3
                                $res = ConstruireColonneEleveTiers($elapse_time, $tab_cours, 1, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, '0', $tab_data, $index_box, $isFirstColUsed, $period);
                                //if ($res > $elapse_time + $duree_max)
                                //{
                                //    $duree_max = $res - $elapse_time;
                                //}
                                // ---- remplissage de la colonne 3/3
                                $res = ConstruireColonneEleveTiers($elapse_time, $tab_cours, 2, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $login_eleve, '0', $tab_data, $index_box, $isFirstColUsed, $period);
                                //if ($res > $elapse_time + $duree_max)
                                //{
                                //    $duree_max = $res - $elapse_time;
                                //}
                                $elapse_time += $duree_max;
                            } else {
                                if ($tab_cas['cas_detecte'] == 17) {
                                    $indice = $tab_cas['indice'];
                                    $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][$indice], $tab_cours['id_aid'][$indice], "", $period);
                                    RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][$indice], "cellule" . $tab_cours['duree'][$indice], $tab_cours['couleur'][$indice], $contenu);
                                    $elapse_time += (int) $tab_cours['duree'][$indice];
                                    $indice2 = ($indice + 1) % 3;
                                    $indice3 = ($indice + 2) % 3;
                                    $duree1 = $tab_cours['duree'][$indice2];
                                    $heuredeb_dec1 = $tab_cours['heuredeb_dec'][$indice2];
                                    $id_semaine1 = $tab_cours['id_semaine'][$indice2];
                                    $duree2 = $tab_cours['duree'][$indice3];
                                    $heuredeb_dec2 = $tab_cours['heuredeb_dec'][$indice3];
                                    $id_semaine2 = $tab_cours['id_semaine'][$indice3];
                                    if ($tab_cours['id_semaine'][$indice2] == $tab_cours['id_semaine'][$indice3]) {
                                        $elapse_time1 = $elapse_time;
                                        if ($heuredeb_dec1 != 0 and $elapse_time1 % 2 == 0) {
                                            $duree1++;
                                        }
                                        if ($heuredeb_dec2 != 0 and $elapse_time1 % 2 == 0) {
                                            $duree2++;
                                        }
                                        if ($duree1 > $duree2) {
                                            $duree_max = $duree1;
                                        } else {
                                            $duree_max = $duree2;
                                        }
                                        RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $duree_max, "", "");
                                        if ($heuredeb_dec1 != 0 and $elapse_time1 % 2 == 0) {
                                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                            $elapse_time1++;
                                        }
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][0], $tab_cours['id_aid'][0], "", $period);
                                        RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][0], "cellule" . $tab_cours['duree'][0], $tab_cours['couleur'][0], $contenu);
                                        $elapse_time1 += (int) $tab_cours['duree'][0];
                                        if ($elapse_time1 < $elapse_time + $duree_max) {
                                            $time_left = $elapse_time + $duree_max - $elapse_time1;
                                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $time_left, "cadre", "");
                                            $elapse_time1++;
                                        }
                                        RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        $elapse_time1 = $elapse_time;
                                        RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule" . $duree_max, "", "");
                                        if ($heuredeb_dec2 != 0 and $elapse_time1 % 2 == 0) {
                                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule1", "cadre", "");
                                            $elapse_time1++;
                                        }
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][1], $tab_cours['id_aid'][1], "", $period);
                                        RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][1], "cellule" . $tab_cours['duree'][1], $tab_cours['couleur'][1], $contenu);
                                        $elapse_time1 += (int) $tab_cours['duree'][1];
                                        if ($elapse_time1 < $elapse_time + $duree_max) {
                                            $time_left = $elapse_time + $duree_max - $elapse_time1;
                                            RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "vide", $tab_id_creneaux[$j], "", "", "cellule" . $time_left, "cadre", "");
                                            $elapse_time1++;
                                        }
                                        RemplirBox($elapse_time1, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        $elapse_time += $duree_max;
                                    } else {
                                        $duree_max = DureeMax2ColonnesClasse($jour_sem_tab[$jour], $id_classe, $tab_id_creneaux, $elapse_time, $tab_cours, $j, $indice2, $indice3, $period);
                                        ConstruireColonneClasse($elapse_time, $tab_cours, $indice2, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $id_classe, '0', $tab_data, $index_box, $period);
                                        ConstruireColonneClasse($elapse_time, $tab_cours, $indice3, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $id_classe, $tab_cours['id_semaine'][$indice2], $tab_data, $index_box, $period);
                                        $elapse_time += $duree_max;
                                    }
                                } else {
                                    if ($tab_cas['cas_detecte'] == 18) {
                                        $indice = $tab_cas['indice'];
                                        $indice2 = ($indice + 1) % 3;
                                        $indice3 = ($indice + 2) % 3;
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][$indice2], $tab_cours['id_aid'][$indice2], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][$indice2], "cellule" . $tab_cours['duree'][$indice2], $tab_cours['couleur'][$indice2], $contenu);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "conteneur", $tab_id_creneaux[$j], "", "", "demicellule1", "", "");
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][$indice3], $tab_cours['id_aid'][$indice3], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][$indice3], "cellule" . $tab_cours['duree'][$indice3], $tab_cours['couleur'][$indice3], $contenu);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "fin_conteneur", $tab_id_creneaux[$j], "", "", "", "", "");
                                        $elapse_time += (int) $tab_cours['duree'][$indice2];
                                        $contenu = ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][$indice], $tab_cours['id_aid'][$indice], "", $period);
                                        RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", $tab_cours['id_cours'][$indice], "cellule" . $tab_cours['duree'][$indice], $tab_cours['couleur'][$indice], $contenu);
                                        $elapse_time += (int) $tab_cours['duree'][$indice];
                                    } else {
                                        if ($tab_cas['cas_detecte'] == 19) {
                                            $indice = $tab_cas['indice'];
                                            $indice2 = ($indice + 1) % 3;
                                            $indice3 = ($indice + 2) % 3;
                                            if ($tab_cours['id_semaine'][$indice] == $tab_cours['id_semaine'][$indice2]) {
                                                $rang = $indice3;
                                            } else {
                                                $rang = $indice2;
                                            }
                                            $duree_max = DureeMax2ColonnesClasse($jour_sem_tab[$jour], $id_classe, $tab_id_creneaux, $elapse_time, $tab_cours, $j, $indice, $rang, $period);
                                            ConstruireColonneClasse($elapse_time, $tab_cours, $indice, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $id_classe, '0', $tab_data, $index_box, $period);
                                            ConstruireColonneClasse($elapse_time, $tab_cours, $rang, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $id_classe, $tab_cours['id_semaine'][$indice], $tab_data, $index_box, $period);
                                            $elapse_time += $duree_max;
                                        } else {
                                            if ($tab_cas['cas_detecte'] == 20 or $tab_cas['cas_detecte'] == 21) {
                                                $indice = $tab_cas['indice'];
                                                $indice2 = ($indice + 1) % 3;
                                                $indice3 = ($indice + 2) % 3;
                                                $duree_max = DureeMax2ColonnesClasse($jour_sem_tab[$jour], $id_classe, $tab_id_creneaux, $elapse_time, $tab_cours, $j, $indice2, $indice3, $period);
                                                ConstruireColonneClasse($elapse_time, $tab_cours, $indice2, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $id_classe, '0', $tab_data, $index_box, $period);
                                                ConstruireColonneClasse($elapse_time, $tab_cours, $indice3, $duree_max, $jour_sem_tab[$jour], $jour, $tab_id_creneaux, $j, $type_edt, $id_classe, $tab_cours['id_semaine'][$indice2], $tab_data, $index_box, $period);
                                                $elapse_time += $duree_max;
                                            } else {
                                                $erreur = true;
                                                echo "<div class= \"cadreInformation\">Erreur sur la génération de l'emploi du temps : " . $tab_cas['cas_detecte'] . "</div>";
                                            }
                                        }
                                    }
                                }
                            }
                        } else {
                            // ============= gloups ! 4 enseignements ou plus sur le même créneau
                            //
                            $contenu = "";
                            for ($z = 0; $z < $nb_rows; $z++) {
                                $contenu .= "<p>" . ContenuCreneau($tab_id_creneaux[$j], $jour_sem_tab[$jour], $type_edt, $tab_cours['id_groupe'][$z], $tab_cours['id_aid'][$z], "", $period) . "</p>";
                            }
                            // Normalement, l'ajout $tab_cours['id_groupe'][XXX] est inutile.
                            // On ne devrait pas avoir de collision d'id_dev pour un créneau sur un jour donné
                            //$id_div = "ens_".$tab_id_creneaux[$j]."_".$jour_sem_tab[$jour]."_".$id_groupe;
                            $id_div = "ens_" . $tab_id_creneaux[$j] . "_" . $jour_sem_tab[$jour] . "_" . $tab_cours['id_groupe'][0];
                            $case_tab = "<a href='#' onclick=\"afficher_div('" . $id_div . "','n',0,0);return false;\"><img src=\"../templates/" . NameTemplateEDT() . "/images/voir.png\" title=\"voir les cours\" alt=\"voir les cours\" /> </a>" . creer_div_infobulle($id_div, "Liste des enseignements", "#330033", $contenu, "#FFFFFF", 20, 0, "y", "n", "y", "n") . "\n";
                            RemplirBox($elapse_time, $tab_data[$jour], $index_box, "cours", $tab_id_creneaux[$j], "", "", "cellule2", "cadreRouge", $case_tab);
                            //RemplirBox($elapse_time,$tab_data[$jour], $index_box, "erreur", $tab_id_creneaux[$j], "none", "none", "cellule2", "cadreRouge", "C08");
                            $elapse_time += 2;
                        }
                    }
                }
            }
            $j = (int) ($elapse_time / 2);
        }
        $jour++;
        $index_box = 0;
    }
    return $tab_data;
}