Ejemplo n.º 1
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>";
                 }
             }
         }
     }
 }