diff options
Diffstat (limited to 'Views/Includes/incl_index_search.php')
| -rw-r--r-- | Views/Includes/incl_index_search.php | 129 |
1 files changed, 80 insertions, 49 deletions
diff --git a/Views/Includes/incl_index_search.php b/Views/Includes/incl_index_search.php index a0e0be4..ac107b7 100644 --- a/Views/Includes/incl_index_search.php +++ b/Views/Includes/incl_index_search.php @@ -23,65 +23,96 @@ echo(' <!-- Form de recherche --> // Si l'index est chargé avec des données dans la variable "search" de la session, // c'est qu'une recherche à été effectuée, on affiche alors le contenu de cette recherche en tableau. if (isset($_SESSION["search"])) { - echo("<table><tr>"); + echo("<table>"); // Si la variable isResearch est vrai, c'est une rechreche. if ($_SESSION["search"]["isResearch"]) { - foreach ($header[1] as $header) { - echo("<th><pre>".$header."</pre></th>"); - } - // Sinon c'est un "Plus d'info". - } else { - foreach ($header[2] as $header) { - echo("<th><pre>".$header."</pre></th>"); - } - } - // On affiche le résultat de la recherche ou du "Plus d'info". - echo("</tr>"); - foreach ($_SESSION["search"]["result"] as $rows) { echo("<tr>"); - foreach ($rows as $key => $value) { - if ($key !== "id") { - if ($key !== "star") { - echo("<td><pre>".$value."</pre></td>"); - } else { - if ($value) { - echo('<td>'); - $missingStar = 5 - $value; - for ($i = 0; $i < $value; $i++) { - echo('<i class="fa fa-star star checked"></i>'); - } - if ($missingStar) { - for ($i = 0; $i < $missingStar; $i++) { - echo('<i class="fa fa-star star unchecked"></i>'); - } - } - } else { - echo('<td>N/A'); + for ($i = 0; $i < count($header["search"]); $i++) { + echo("<th><pre>".$header["search"][$i]."</pre></th>"); + } + echo("</tr>"); + foreach ($_SESSION["search"]["result"] as $result) { + echo("<tr>"); + echo("<td><pre>".$result["lastname"]."</pre></td>"); + echo("<td><pre>".$result["firstname"]."</pre></td>"); + // jobs + if (count($result["jobs"]) > 0) { + $jobsName = array(); + for ($i = 0; $i < count($result["jobs"]); $i++) { + array_push($jobsName, $result["jobs"][$i]["jobCategoryName".ucwords($_SESSION["lang"])]); + } + echo("<td><pre>".join(", ", $jobsName)."</pre></td>"); + } else { + echo('<td>N/A</td>'); + } + echo("<td><pre>".$result["capability"]."</pre></td>"); + echo("<td><pre>".$result["numberOfMissions"]."</pre></td>"); + echo("<td><pre>".$result["note"]."</pre></td>"); + // I'm a star !! + if ($result["star"]) { + echo('<td>'); + $missingStar = 5 - $result["star"]; + for ($i = 0; $i < $result["star"]; $i++) { + echo('<i class="fa fa-star star checked"></i>'); + } + if ($missingStar) { + for ($i = 0; $i < $missingStar; $i++) { + echo('<i class="fa fa-star star unchecked"></i>'); } - echo("</td>"); } + echo("</td>"); + } else { + echo('<td>N/A</td>'); } - } - // Si c'est une recherche on ajoute le bouton plus d'info, - // pour plus d'info avec une recherche par ID. - if ($_SESSION["search"]["isResearch"]) { + // Si c'est une recherche on ajoute le bouton plus d'info, + // pour plus d'info avec une recherche par Id. echo('<td class="noBorder" > - <form action="/Wrapper/wrapper.php" method="post"> - <input type="hidden" name="searchInfo" value="'.$rows["userId"].'"> - <input type="submit" value="'.$text[basename(__FILE__, ".php")]["moreInfo"].'"> - </form> - </td>'); + <form action="/Wrapper/wrapper.php" method="post"> + <input type="hidden" name="moreInfoProId" value="'.$result["userId"].'"> + <input type="submit" value="'.$text[basename(__FILE__, ".php")]["moreInfo"].'"> + </form> + </td>'); + echo("</tr>"); } - echo("</tr>"); + echo("</table>"); + // Sinon c'est un "Plus d'info". + } else { + echo("<tr>"); + for ($i = 0; $i < count($header["moreInfos"]); $i++) { + echo("<th><pre>".$header["moreInfos"][$i]."</pre></th>"); + } + echo('</tr> + <tr> + <td><pre>'.$_SESSION["search"]["result"][0]["lastname"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["firstname"].'</pre></td>'); + // jobs + if (count($_SESSION["search"]["result"][0]["jobs"]) > 0) { + $jobsName = array(); + for ($i = 0; $i < count($_SESSION["search"]["result"][0]["jobs"]); $i++) { + array_push($jobsName, $_SESSION["search"]["result"][0]["jobs"][$i]["jobCategoryName".ucwords($_SESSION["lang"])]); + } + echo("<td><pre>".join(", ", $jobsName)."</pre></td>"); + } else { + echo('<td>N/A</td>'); + } + echo(' <td><pre>'.$_SESSION["search"]["result"][0]["degree"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["capability"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["description"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["phoneNumber"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["adress"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["zipCode"].'</pre></td> + <td><pre>'.$_SESSION["search"]["result"][0]["city"].'</pre></td> + </tr> + </table> + <form action="/Wrapper/wrapper.php" method="post"> + <input type="hidden" name="mandateProId" value="'.$_SESSION["search"]["result"][0]["userId"].'"> + <input type="submit" value="'.$text[basename(__FILE__, ".php")]["mandate"].'"> + </form>'); } - echo('<!-- Espace vide si le tableau est petit --> -</table> -<div class="spacer"></div>'.PHP_EOL); -} else { - echo(' <!-- Espace vide --> - <div class="spacer"></div>'.PHP_EOL); } -echo(' </div>'); +echo(' <!-- Espace vide si le tableau est petit --> + <div class="spacer"></div> + </div>'); // On supprime la variable de recherche si elle existe. unset($_SESSION["search"]); ?>
\ No newline at end of file |
