summaryrefslogtreecommitdiff
path: root/Views/Includes/incl_table_myMission.php
diff options
context:
space:
mode:
Diffstat (limited to 'Views/Includes/incl_table_myMission.php')
-rw-r--r--Views/Includes/incl_table_myMission.php158
1 files changed, 0 insertions, 158 deletions
diff --git a/Views/Includes/incl_table_myMission.php b/Views/Includes/incl_table_myMission.php
deleted file mode 100644
index de071b1..0000000
--- a/Views/Includes/incl_table_myMission.php
+++ /dev/null
@@ -1,158 +0,0 @@
-<?php
-// ****************************************************************************
-// Description: Tableau correspondant aux missions effectuées par l'utilisateur.
-// ****************************************************************************
-// Import des textes en fonction de la langue définie dans la variable "lang" de la session.
-require_once(dirname(__FILE__)."/".$_SESSION["lang"]."/text.php");
-// Import des en-tête des tables.
-require_once(dirname(__FILE__)."/".$_SESSION["lang"]."/table.php");
-// Import des metodes de la base de donnée pour les recherches.
-require_once(dirname(__FILE__)."/../../Database/meth_dbsearch.php");
-require_once(dirname(__FILE__)."/../../Database/meth_dbmission.php");
-// Instanciation de la bdd avec les méthodes de recherche.
-$dbsearch = new DbSearch;
-$dbmission = new DbMission;
-
-// TODO: commenter
-// Recherches des missions avec l'id de l'utilisateur actuellement connecté.
-switch ($_SESSION["userStatus"]) {
- case 1:
- $result = $dbmission->get_mission_by_pro_id($_SESSION["userId"]);
- for ($i = 0; $i < count($result); $i++) {
- $result[$i]["jobCategoryId"] = $dbsearch->get_job_category_by_id($result[$i]["jobCategoryId"]);
- }
- break;
- case 2:
- $result = $dbmission->get_mission_by_client_id($_SESSION["userId"]);
- for ($i = 0; $i < count($result); $i++) {
- $result[$i]["jobCategoryId"] = $dbsearch->get_job_category_by_id($result[$i]["jobCategoryId"]);
- }
- break;
- default:
- break;
-}
-
-$missionStatus = [
- "pending" => [],
- "ongoing" => [],
- "completed" => []
-];
-
-for ($i = 0; $i < count($result); $i++) {
- if (!$result[$i]["acceptedByPro"]
- ) {
- array_push($missionStatus["pending"], $result[$i]);
- } elseif (!$result[$i]["validatedByPro"]
- || !$result[$i]["validatedByClient"]
- ) {
- array_push($missionStatus["ongoing"], $result[$i]);
- } else {
- array_push($missionStatus["completed"], $result[$i]);
- }
-}
-
-echo(' <!-- Separateur -->
- <div class="separator"></div>
- <!-- Mes missions -->
- <div id="myMission">
- <div id="missionButtons">
- <button onclick="show(\'pendingTable\')"><h2>'.$text[basename(__FILE__, ".php")]["pendingMission"].'</h2></button>
- <button onclick="show(\'ongoingTable\')"><h2>'.$text[basename(__FILE__, ".php")]["ongoingMission"].'</h2></button>
- <button onclick="show(\'completedTable\')"><h2>'.$text[basename(__FILE__, ".php")]["completedMission"].'</h2></button>
- </div>'.PHP_EOL);
-
-// tableau 3 pending
-echo(' <table id="pendingTable">
- <!-- En-tête -->
- <tr>'.PHP_EOL);
-foreach($header["pendingMissions"] as $columnHeader) {
- echo(" <th>".$columnHeader."</th>".PHP_EOL);
-}
-echo(" </tr>".PHP_EOL);
-foreach ($missionStatus["pending"] as $rows) {
- echo(' <!-- Missions -->
- <tr>
- <td><pre>'.$rows["date"].'</pre></td>
- <td><pre>'.$rows["lastname"].'</pre></td>
- <td><pre>'.$rows["jobCategoryId"][0]["jobCategoryName".ucwords($_SESSION["lang"])].'</pre></td>
- <td><pre>'.$rows["subject"].'</pre></td>');
- if ($_SESSION["userId"] == $rows["proId"]) {
- echo(' <td class="noBorder" >
- <form action="/Wrapper/wrapper.php" method="post">
- <input type="hidden" name="acceptedMissionId" value="'.$rows["missionId"].'">
- <input type="submit" value="'.$text[basename(__FILE__, ".php")]["accept"].'">
- </form>
- </td>');
- }
- echo(' </tr>'.PHP_EOL);
-}
-echo(' </table>');
-
-// tableau 4 ongoing
-echo(' <table id="ongoingTable">
- <!-- En-tête -->
- <tr>'.PHP_EOL);
-foreach($header["ongoingMissions"] as $columnHeader) {
- echo(" <th>".$columnHeader."</th>".PHP_EOL);
-}
-echo(" </tr>".PHP_EOL);
-foreach ($missionStatus["ongoing"] as $rows) {
- echo(' <!-- Missions -->
- <tr>
- <td><pre>'.$rows["acceptedByPro"].'</pre></td>
- <td><pre>'.$rows["lastname"].'</pre></td>
- <td><pre>'.$rows["jobCategoryId"][0]["jobCategoryName".ucwords($_SESSION["lang"])].'</pre></td>
- <td><pre>'.$rows["subject"].'</pre></td>
- <td><pre>'.$rows["validatedByClient"].'</pre></td>
- <td><pre>'.$rows["validatedByPro"].'</pre></td>');
- if (!$rows["validatedByClient"] && $_SESSION["userStatus"] == 2
- || (!$rows["validatedByPro"] && $_SESSION["userStatus"] == 1)
- ) {
- echo(' <td class="noBorder" >
- <form action="/Wrapper/wrapper.php" method="post">
- <input type="hidden" name="validatedMissionId" value="'.$rows["missionId"].'">
- <input type="submit" value="'.$text[basename(__FILE__, ".php")]["validate"].'">
- </form>
- </td>');
- }
- echo(' </tr>'.PHP_EOL);
-}
-echo(' </table>');
-
-// tableau 5 completed
-echo(' <table id="completedTable">
- <!-- En-tête -->
- <tr>'.PHP_EOL);
-foreach($header["completedMissions"] as $columnHeader) {
- echo(" <th>".$columnHeader."</th>".PHP_EOL);
-}
-echo(" </tr>".PHP_EOL);
-foreach ($missionStatus["completed"] as $rows) {
- echo(' <!-- Missions -->
- <tr>
- <td><pre>'.$rows["date"].'</pre></td>
- <td><pre>'.$rows["acceptedByPro"].'</pre></td>
- <td><pre>'.$rows["validatedByClient"].'</pre></td>
- <td><pre>'.$rows["validatedByPro"].'</pre></td>
- <td><pre>'.$rows["lastname"].'</pre></td>
- <td><pre>'.$rows["jobCategoryId"][0]["jobCategoryName".ucwords($_SESSION["lang"])].'</pre></td>
- <td><pre>'.$rows["subject"].'</pre></td>');
- if ($rows["review"]) {
- echo('<td><pre>'.$rows["review"].'</pre></td>');
- } else {
- echo('<td><pre>N/A</pre></td>');
- }
- if ($rows["note"]) {
- echo('<td><pre>'.$rows["note"].'</pre></td>');
- } else {
- echo('<td><pre>N/A</pre></td>');
- }
- echo('</tr>'.PHP_EOL);
-}
-echo(' </table>
-<!-- Espace vide si le tableau est petit -->
-<div class="spacer"></div>');
-
-// fin
-echo(' </div>'.PHP_EOL);
-?> \ No newline at end of file