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>"; } } } } }
/** Fonction qui affiche un tableau representant une feuille d'absence. * Parcour tous les cours de la periode passe en paremetre selon le * groupe passe en parametre. * */ function tableau() { /* Selon la methode de passage de parametre POST ou GET on recupere le groupe et la date passee en parametre. */ if (isset($_POST['groupe'])) { if (strpos($_POST['groupe'], ':') !== FALSE) { $groupe = urldecode(explode(":", $_POST['groupe'])[1]); $promo = explode(":", $_POST['groupe'])[0]; } else { // header("location:index.php"); $groupe = $_POST['groupe']; $promo = $_POST['groupe']; } $date = $_POST["date"]; } else { if (strpos($_GET['ics'], ':') !== FALSE) { $groupe = urldecode(explode(":", $_GET['ics'])[1]); $promo = explode(":", urldecode($_GET['ics']))[0]; } else { // header("location:index.php"); $groupe = $_GET['ics']; $promo = $_GET['ics']; } $date = $_GET["semaine"]; } /* On instancie un DAO afin de recuperer les donnees*/ $dao = new Dao(); // var_dump($group); $dao->setICS($groupe); // Indique pour quelle groupe. $dao->getCours(); // Le DAO recupere les cours associe a partir de l'ics. /* Calcul des dates*/ $tmpdate = new DateTime(); $tmpdate->setISOdate("2016", $date); $periode = $tmpdate->format("y-m-d"); $periodeObject = new DateTime($periode . " 08:00:00"); $tabMod = array(); $tabEtu = array(array()); $tabjours = array("Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi"); $tabDate["Lundi"] = new DateTime($periode); $tabDate["Mardi"] = $tabDate["Lundi"]->add(new DateInterval('P1D')); $tabDate["Mercredi"] = $tabDate["Lundi"]->add(new DateInterval('P2D')); $tabDate["Jeudi"] = $tabDate["Lundi"]->add(new DateInterval('P3D')); $tabDate["Vendredi"] = $tabDate["Lundi"]->add(new DateInterval('P4D')); /* Recupere tous les cours*/ foreach ($dao->getCoursDate($periode) as $cours) { array_push($tabMod, $cours->getMatiere()); } /* recupere les etudiants*/ $tabEtu = $dao->getEtudiants($promo, $groupe); /* Affiche la table */ $html = ""; $html = $html . '<p>' . $groupe . '</br>' . $tmpdate->format("d-m-y") . '</p>'; $html = $html . '<body>'; $html = $html . '<table style="width:50%">'; $html = $html . '<tr class="trHead">'; $html = $html . '<th id="headEtu" ><div></div></th><th id="headEtu" ><div></div></th>'; foreach ($tabMod as $mod) { $html = $html . '<th class="rotate" ><div><span>' . $mod . '</span></div></th>'; } $html = $html . ' </tr>'; $html = $html . ' <tr><th>Nom</th><th>Prenom</th>'; $i = 0; foreach ($tabjours as $jour) { $tmp = new DateTime($periodeObject->format('y-m-d h:i:s')); $tmp->add(new DateInterval('P' . $i . 'D')); $nbDate = $dao->getCoursDateJournee($tmp->format('y-m-d h:i:s')); $html = $html . '<th colspan="' . count($nbDate) . '" class="jour">' . $jour . '</th>'; $i = $i + 1; } $html = $html . ' </tr>'; $j = 0; foreach ($tabEtu as $etu) { if ($j % 2 == 1) { $html = $html . '<tr> <td class="etu">' . $etu[0] . '</td>' . '<td class="etu">' . $etu[1] . '</td>'; } else { $html = $html . '<tr class="gris"> <td class="etu" >' . $etu[0] . '</td>' . '<td class="etu">' . $etu[1] . '</td>'; } for ($i = 0; $i < count($tabMod); $i++) { $html = $html . '<td></td>'; } $j++; $html = $html . '</tr>'; } $html = $html . '<tr > <td colspan=2 id="nbAbs" >Nombre d\'absences</td>'; foreach ($tabMod as $mod) { $html = $html . '<td class="sign" ></td>'; } $html = $html . '</tr>'; $html = $html . '<tr> <td colspan=2 id="sign"> Signature</td>'; foreach ($tabMod as $mod) { $html = $html . '<td class="sign" ></td>'; } $html = $html . '</tr>'; $html = $html . '</table>'; $html = $html . '</body>'; $html = $html . '</page>'; $html = $html . '</html>'; echo $html; }