From bc4d63163835e2034282866009f9ca5579180e7d Mon Sep 17 00:00:00 2001 From: Killian <killian.delarue@gmail.com> Date: Fri, 6 Dec 2019 12:25:32 +0100 Subject: [PATCH] update print_request --- htdocs/connection/connection.php | 1 + htdocs/match_script.php | 20 ++++++++++++++++---- htdocs/requests/requests.php | 4 +++- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/htdocs/connection/connection.php b/htdocs/connection/connection.php index 340faef..6d4e614 100644 --- a/htdocs/connection/connection.php +++ b/htdocs/connection/connection.php @@ -37,6 +37,7 @@ include("/opt/lampp/htdocs/pima/head.php"); $_SESSION['currentFirstname'] = $firstname; $_SESSION['currentMail'] = $mail; $_SESSION['currentType'] = $user->getType(); + $_SESSION['currentRequest'] = $user->getRequest(); } } diff --git a/htdocs/match_script.php b/htdocs/match_script.php index 2cdfb98..82d0d42 100644 --- a/htdocs/match_script.php +++ b/htdocs/match_script.php @@ -45,12 +45,24 @@ function match_script($student, $userRepository){ #} } -function print_requests($userRepository){ - $requests = $userRepository->getRequest(); +function print_requests($requests){ + + $noRequest = true; foreach($requests as $r){ - $m = "test "; - echo "$m "; + $subject = $r->subject; + $student = $r->student; + $dispo = $r->dispo; + $accepted = $r->accepted; + + if (!$accepted){ + echo "<p>Vous avez une demande de $student pour un cours de $subject le $dispo</p>"; + $noRequest = false; + } + } + + if ($noRequest){ + echo "<p>Vous n'avez aucune demande</p>"; } } diff --git a/htdocs/requests/requests.php b/htdocs/requests/requests.php index e0b6875..e5f4130 100644 --- a/htdocs/requests/requests.php +++ b/htdocs/requests/requests.php @@ -15,7 +15,9 @@ include("/opt/lampp/htdocs/pima/head.php"); </header> <p> - <php print_requests($userRepository); ?> + <?php + $r = $_SESSION['currentRequest']; + print_requests($r); ?> </p> </article> </div> -- GitLab