Ejemplo n.º 1
0
 function genererJourGroupe($jour, $groupe)
 {
     //Récupère les cours du jour du groupe (x+x.1 et x.2)
     $cours = $this->dao->getGroupeSousGroupe($jour->format("Y-m-d h:i:s"), $groupe);
     $coursG2 = $this->dao->getCoursDateJourneeSousGroupeBis($jour->format("Y-m-d h:i:s"), $groupe);
     $html = "";
     if ($groupe != "0") {
         $cours = array_merge($cours, $this->dao->getGroupeSousGroupe($jour->format("Y-m-d h:i:s"), "0"));
     } else {
         return "";
     }
     //On range les tableaux
     sort($cours);
     sort($coursG2);
     //On définit la date du cour précédent
     $date_cour_precedent = new DateTime($jour->format("Y-m-d H:i:s"));
     $date_cour_precedent->setTime(9, 0, 0);
     //Pour chaque cour du groupe X et X.1
     foreach ($cours as $uncour) {
         //Si une différence de temps entre le cour précédent et $uncour
         if (diffCoursDate($date_cour_precedent, $uncour->getDateDeb()) > 0) {
             $html .= $this->vue->genererEspaceCour(diffCoursDate($date_cour_precedent, $uncour->getDateDeb()), $this->dao->getTailleRowspan($uncour));
         }
         //On affiche le cour
         $html .= $this->vue->genererUnCour($uncour);
         $date_cour_precedent = $uncour->getDateFin();
     }
     $html .= "</tr>";
     //Si il y a des cours du groupe X.2
     if (!empty($coursG2)) {
         $html .= "<tr>";
         //On récupère la date du cour précédent
         $date_cour_precedent = $this->dao->getCourPrecedent($coursG2[0]);
         //Pour chaque cours
         foreach ($coursG2 as $uncour) {
             $date_cour_precedent = $this->dao->getCourPrecedent($uncour);
             if (diffCoursDate($date_cour_precedent, $uncour->getDateDeb()) > 0) {
                 // echo $uncour->getProf()." ".$date_cour_precedent->format("Y-m-d H:i:s")."<br>";
                 $html .= $this->vue->genererEspaceCour(diffCoursDate($date_cour_precedent, $uncour->getDateDeb()), $this->dao->getTailleRowspan($uncour));
             }
             //On affiche le cour
             $html .= $this->vue->genererUnCour($uncour);
             $date_cour_precedent = $uncour->getDateFin();
         }
         $html .= "</tr>";
     } else {
         $html .= "<tr></tr>";
     }
     return $html;
 }
Ejemplo n.º 2
0
 function affiche2()
 {
     $dao = new Dao();
     $grp = explode(":", $_POST['groupe'])[1];
     $dao->setICS(urldecode($grp));
     $dao->getCours();
     $precedent = $_POST['date'] - 1;
     $suivant = $_POST['date'] + 1;
     $groupe_decode = urldecode($grp);
     $crenaux = ["8:00 - 9:00", "9:00 - 10:00", "10:00 - 11:00", "11:00 - 12:00", "12:00 - 13:00", "13:00 - 14:00", "14:00 - 15:00", "15:00 - 16:00", "16:00 - 17:00", "17:00 - 18:00", "18:00 - 19:00"];
     $jour = ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi"];
     include 'static/edtHead.html';
     $html = "\n\n<div class=edt id=tableEdt ><h1 text-align=center>" . $groupe_decode . " Semaine " . $_POST['date'] . "</h1>\n\n\n<table id=boutons>\n<tr>\n<form method=post  action=index.php>\n<td>\n\n\t<input type=hidden name=groupe value=" . urlencode(urldecode($grp)) . " />\n\t<input type=hidden name=date value=" . $precedent . " />\n\t<input type=hidden name=edt value=true />\n\t<input class=suiv_pre type=submit value='Semaine Precedenteeeeeeeee' />\n\n<td/>\n\n<td>\n\n\t<input type=hidden name=groupe value=" . urlencode(urldecode($grp)) . " />\n\t<input type=hidden name=date value=" . $suivant . " />\n\t<input type=hidden name=edt value=true />\n\t<input class=suiv_pre type=submit value='Semaine Suivante' />\n\n<td/>\n<td>\n<a href=index.php?ics=" . urlencode($_POST['groupe']) . "&semaine=" . $_POST['date'] . " target=_blank> <input class=suiv_pre type=button value=FeuilleAbsence> </a>\n<td/>\n</form>\n<tr/>\n</table>\n\n\n\n\n\n\n<table class=tg><tr><th class=tg-c3cn>Heures</th>";
     for ($i = 0; $i < 11; $i++) {
         $html .= "<th class=tg-c3cn colspan=6>" . $crenaux[$i] . "</th> ";
     }
     $html .= "</tr>";
     for ($j = 0; $j < 5; $j++) {
         $tab_courzero = array();
         $journee = new DateTime();
         $journee->setISOdate("2016", $_POST['date']);
         $journee->setTime(8, 0, 0);
         //$courpre = new DateTime("2016-02-15 08:00:00");
         //Noé
         $nbGroupes = count($dao->getGroupes($dao->getCoursDate($journee->format("Y-m-d h:i:s"))));
         if (isset($dao->getGroupes($dao->getCoursDate($journee->format("Y-m-d h:i:s")))[0]) && $dao->getGroupes($dao->getCoursDate($journee->format("Y-m-d h:i:s")))[0]->getNumero() == "1") {
             $nbGroupes++;
         }
         //
         $html .= "<td class=tg-c3cn rowspan=" . ($nbGroupes * 2 - 1) . ">" . $jour[$j] . "</td>";
         foreach ($dao->getGroupes($dao->getCoursDate($journee->format("Y-m-d h:i:s"))) as $ungroupe) {
             // echo $ungroupe->getNumero();
             $journee = new DateTime();
             $journee->setISOdate("2016", $_POST['date']);
             $journee->setTime(8, 0, 0);
             $courpre = new DateTime();
             $courpre->setISOdate("2016", $_POST['date']);
             $courpre->setTime(9, 0, 0);
             if ($j > 0) {
                 $cours = $dao->getGroupeSousGroupe($journee->add(new DateInterval("P" . $j . "D"))->format("Y-m-d h:i:s"), $ungroupe->getNumero());
                 $coursG2 = $dao->getCoursDateJourneeSousGroupeBis($journee->format("Y-m-d h:i:s"), $ungroupe->getNumero());
                 $courpre = $courpre->add(new DateInterval("P" . $j . "D"));
             } else {
                 $cours = $dao->getGroupeSousGroupe($journee->format("Y-m-d h:i:s"), $ungroupe->getNumero());
                 $coursG2 = $dao->getCoursDateJourneeSousGroupeBis($journee->format("Y-m-d h:i:s"), $ungroupe->getNumero());
             }
             $cours = array_merge($cours, $tab_courzero);
             sort($cours);
             sort($coursG2);
             if ($ungroupe->getNumero() == "0") {
                 $tab_courzero = $cours;
             } else {
                 $html .= "<tr>";
                 foreach ($cours as $c) {
                     if ($c->getTypeCour() == "TP") {
                         $class = "tg-y0wm rowspan=1";
                     } else {
                         if ($c->getTypeCour() == "TD") {
                             $class = "td rowspan=2";
                         } else {
                             if ($c->getTypeCour() == "DS=TD") {
                                 $class = "ds rowspan=2";
                             } else {
                                 if ($c->getTypeCour() == "Cours") {
                                     $class = "amphi rowspan=2";
                                 } else {
                                     $class = "tg-4wtr rowspan=1";
                                 }
                             }
                         }
                     }
                     //var_dump($dao->getCoursDateJourneeSousGroupe($journee->format("Y-m-d h:i:s"), "1"));
                     if (diffCoursDate($courpre, $c->getDateDeb()) > 0) {
                         $html .= "<td class=tg-jbrh colspan=" . diffCoursDate($courpre, $c->getDateDeb()) . " width=" . diffCoursDate($courpre, $c->getDateDeb()) . "0></td>";
                     }
                     $html .= "<td class=" . $class . " colspan=" . $c->getDureeToInt() . " width=" . $c->getDureeToInt() . "><div class=nom_matiere>" . $c->getMatiere() . "</div> <div class=prof >" . $c->getProf() . "</div> \n <div class=salle >" . $c->getSalle() . "</div>\n</td>";
                     $courpre = $c->getDateFin();
                 }
                 $html .= "</tr>";
                 if (!empty($coursG2)) {
                     $courpre = $dao->getCourPrecedent($coursG2[0]);
                     $html .= "<tr>";
                     foreach ($coursG2 as $c2) {
                         if ($c2->getTypeCour() == "TP") {
                             $class = "tg-y0wm";
                         } else {
                             if ($c2->getTypeCour() == "TD") {
                                 $class = "td rowspan=2";
                             } else {
                                 if ($c2->getTypeCour() == "Cours") {
                                     $class = "amphi rowspan=2";
                                 } else {
                                     $class = "tg-4wtr rowspan=2";
                                 }
                             }
                         }
                         if (diffCoursDate($courpre, $c2->getDateDeb()) > 0) {
                             $html .= "<td class=tg-jbrh colspan=" . diffCoursDate($courpre, $c2->getDateDeb()) . " width=" . diffCoursDate($courpre, $c2->getDateDeb()) . "0></td>";
                         }
                         $html .= "<td class=" . $class . " colspan=" . $c2->getDureeToInt() . " width=" . $c2->getDureeToInt() . "><div class=nom_matiere>" . $c2->getMatiere() . "</div> <div class=prof >" . $c2->getProf() . "</div> \n <div class=salle >" . $c2->getSalle() . "</div>\n</td>";
                         $courpre = $c2->getDateFin();
                     }
                     $html .= "</tr>";
                 } else {
                     $html .= "<tr></tr>";
                 }
             }
         }
     }
 }