function showAllOfficielPlancadre() { $list = selectAllOfficielPlanCadre(); if (!empty($list)) { echo "<table id='tab_recherche'>" . "<tr>" . "<th>Code du cours</th>" . "<th>Nom du cours</th>" . "<th>Code du programme</th>" . "<th>Nom du programme</th>" . "<th>État</th>" . "<th>Date de création</th>" . "<th>Date d'adoption</th>" . "<th>Télécharger</th>"; if (isset($_SESSION['user_type'])) { if ($_SESSION['user_type'] != "Élaborateur") { echo "<th>Validation</th>" . "<th>Adoption</th>"; } } echo "</tr>"; foreach ($list as $row) { $date_adoption = $row["DateAdoption"]; $document_link = makeLinkPlancadre($row); echo "<tr>" . "<td>" . $row["CodeCours"] . "</td>" . "<td>" . $row["NomCours"] . "</td>" . "<td>" . $row["CodeProgramme"] . "</td>" . "<td>" . $row["NomProgramme"] . "</td>"; if ($row["Officiel"] == 1) { echo "<td>Version officielle</td>"; } else { echo "<td>" . $row["Etat"] . "</td>"; } echo "<td>" . $row["DateAjout"] . "</td>"; $date_adoption = $row["DateAdoption"]; if (!isset($date_adoption)) { $date_adoption = "pas adopté"; } echo "<td>" . $date_adoption . "</td>" . "<td>" . $document_link . "</td>"; if (isset($_SESSION['user_type'])) { if ($_SESSION['user_type'] != "Élaborateur") { if ($row["Etat"] != "Validé" && $row["Etat"] != "Adopté") { echo "<td><a href ='../controller/controller_validate_plancadre.php?codecours=" . $row["CodeCours"] . "&versionplan=" . $row["No_PlanCadre"] . "'>Valider</a></td>"; echo "<td>//</td>"; } else { if ($row["Etat"] == "Validé") { echo "<td>Déjà validé</td>"; echo "<td><a href ='../controller/controller_adopt_plancadre.php?codecours=" . $row["CodeCours"] . "&versionplan=" . $row["No_PlanCadre"] . "'>Adopter</a></td>"; } else { if ($row["Etat"] == "Adopté") { echo "<td>//</td>"; echo "<td>Déjà adopté</td>"; } } } } } echo "</tr>"; } echo "</table>"; } else { echo "Aucun plan-cadre ne correspond à vos critères de recherche"; } }
function showPlanCadre() { $list = null; if (isset($_SESSION['recherche_code_programme'])) { // Il est nécessaire de traiter cette alternative au cas ou l'utilisateur veut réafficher // tous les plans-cadre après avoir cherché pour un programme en particulier, étant // donné que la page ne se réactualise pas toute seule // C'est aussi pour une question de "user friendly" // Rechercher toutes les versions de tous les plans-cadre if (isset($_SESSION['official_only']) && $_SESSION['official_only'] == "unchecked" && $_SESSION['recherche_code_programme'] == "Tous") { $list = selectAllPlanCadre(); } else { if (isset($_SESSION['official_only']) && $_SESSION['official_only'] == "checked" && $_SESSION['recherche_code_programme'] == "Tous") { $list = fetchAllPlanCadreOfficiel(1); } else { if (isset($_SESSION['official_only']) && $_SESSION['official_only'] == "checked") { $list = getPlanCadreOfficielProgram(1, $_SESSION['recherche_code_programme']); } else { $list = fetchPlanCadreProgram($_SESSION["recherche_code_programme"]); } } } } else { if (isset($_SESSION['official_only']) && $_SESSION['official_only'] == "checked") { $list = fetchAllPlanCadreOfficiel(1); } else { $list = selectAllPlanCadre(); } } // Génération de l'affichage du tableau if (!empty($list)) { echo "<table id='tab_recherche'>" . "<tr>" . "<th>Code du cours</th>" . "<th>Nom du cours</th>" . "<th>Code du programme</th>" . "<th>Nom du programme</th>" . "<th>État</th>" . "<th>Date de création</th>" . "<th>Date d'adoption</th>" . "<th>Télécharger</th>"; if (isset($_SESSION['user_type'])) { if ($_SESSION['user_type'] != "Élaborateur") { echo "<th>Validation</th>" . "<th>Adoption</th>"; } } echo "<th>Élaborateur</th>"; echo "</tr>"; foreach ($list as $row) { $date_adoption = $row["DateAdoption"]; $document_link = makeLinkPlancadre($row); echo "<tr>" . "<td>" . $row["CodeCours"] . "</td>" . "<td>" . $row["NomCours"] . "</td>" . "<td>" . $row["CodeProgramme"] . "</td>" . "<td>" . $row["NomProgramme"] . "</td>"; // Si le plan-cadre est officiel, alors on l'indique if ($row["Officiel"] == 1) { echo "<td>Version officielle</td>"; } else { echo "<td>" . $row["Etat"] . "</td>"; } echo "<td>" . $row["DateAjout"] . "</td>"; $date_adoption = $row["DateAdoption"]; if (!isset($date_adoption)) { $date_adoption = "pas adopté"; } echo "<td>" . $date_adoption . "</td>" . "<td>" . $document_link . "</td>"; if (isset($_SESSION['user_type'])) { // Si on n'est pas élaborateur, alors on ne peut pas valider/adopter un plan-cadre if ($_SESSION['user_type'] != "Élaborateur") { if ($row["Etat"] != "Validé" && $row["Etat"] != "Adopté") { echo "<td><a href ='../controller/controller_validate_plancadre.php?codecours=" . $row["CodeCours"] . "&versionplan=" . $row["No_PlanCadre"] . "'>Valider</a></td>"; echo "<td>//</td>"; } else { if ($row["Etat"] == "Validé") { echo "<td>Déjà validé</td>"; echo "<td><a href ='../controller/controller_adopt_plancadre.php?codecours=" . $row["CodeCours"] . "&versionplan=" . $row["No_PlanCadre"] . "'>Adopter</a></td>"; } else { if ($row["Etat"] == "Adopté") { echo "<td>//</td>"; echo "<td>Déjà adopté</td>"; } } } } } echo "<td>" . $row["Prenom"] . " " . $row["Nom"] . "</td>"; echo "</tr>"; } echo "</table>"; } else { echo "Aucun plan-cadre ne correspond à vos critères de recherche"; } }