diff --git a/htdocs/connection/connection.php b/htdocs/connection/connection.php index 6d4e614c36c05393a0bdf68690d568a18dda5e5a..075a78776d753d8cf5639587a0dad138e2679e9b 100644 --- a/htdocs/connection/connection.php +++ b/htdocs/connection/connection.php @@ -55,4 +55,4 @@ include("/opt/lampp/htdocs/pima/head.php"); </div> </div> </section> -<?php #include("/opt/lampp/htdocs/pima/footer.php"); ?> +<?php include("/opt/lampp/htdocs/pima/footer.php"); ?> diff --git a/htdocs/cours/cours.php b/htdocs/cours/cours.php new file mode 100644 index 0000000000000000000000000000000000000000..a49d1ca2da80df06d34b983e4e380c55bde20d5d --- /dev/null +++ b/htdocs/cours/cours.php @@ -0,0 +1,26 @@ +<?php +$title = 'Projet PIMA'; +include("/opt/lampp/htdocs/pima/head.php"); +?> +</head> + +<?php include("/opt/lampp/htdocs/pima/header.php"); ?> + +<section class="wrapper style1"> + <div class="container"> + <div id="content"> + <article> + <header> + <h2>Mes cours</h2> + </header> + + <p> + <?php + $r = $_SESSION['currentRequest']; + print_cours($users,$r,$bdd); ?> + </p> + </article> + </div> + </div> +</section> +<?php include("/opt/lampp/htdocs/pima/footer.php"); ?> \ No newline at end of file diff --git a/htdocs/data.php b/htdocs/data.php index 4fdb68568ca9f2b054fc2604025a85004effc22a..3668d2369eb32db9176bcaf461e875e9eba197a8 100644 --- a/htdocs/data.php +++ b/htdocs/data.php @@ -123,6 +123,8 @@ function fill_table($bdd){ #Remplissage de REQUESTS $sql = "INSERT INTO requests(student, teacher, dispo, subject, accepted) values (?, ?, ?, ?, ?)"; $bdd->prepare($sql)->execute([1, 8, 'Lundi', 'Math', 0]); + $sql = "INSERT INTO requests(student, teacher, dispo, subject, accepted) values (?, ?, ?, ?, ?)"; + $bdd->prepare($sql)->execute([2, 8, 'Lundi', 'Math', 1]); } function print_data($users){ diff --git a/htdocs/footer.php b/htdocs/footer.php index d19fc50566a9f57ec1c018ec066ad615ecdffc04..810b6022cec4df2ec2c3b37b21fa4dc7d32b285b 100644 --- a/htdocs/footer.php +++ b/htdocs/footer.php @@ -1,70 +1,5 @@ <div id="footer"> - <div class="container"> - <div class="row-arc"> - <section class="col-arc-3 col-arc-6-narrower col-arc-12-mobilep"> - <h3>Links to Stuff</h3> - <ul class="links"> - <li><a href="#">Mattis et quis rutrum</a></li> - <li><a href="#">Suspendisse amet varius</a></li> - <li><a href="#">Sed et dapibus quis</a></li> - <li><a href="#">Rutrum accumsan dolor</a></li> - <li><a href="#">Mattis rutrum accumsan</a></li> - <li><a href="#">Suspendisse varius nibh</a></li> - <li><a href="#">Sed et dapibus mattis</a></li> - </ul> - </section> - <section class="col-arc-3 col-arc-6-narrower col-arc-12-mobilep"> - <h3>More Links to Stuff</h3> - <ul class="links"> - <li><a href="#">Duis neque nisi dapibus</a></li> - <li><a href="#">Sed et dapibus quis</a></li> - <li><a href="#">Rutrum accumsan sed</a></li> - <li><a href="#">Mattis et sed accumsan</a></li> - <li><a href="#">Duis neque nisi sed</a></li> - <li><a href="#">Sed et dapibus quis</a></li> - <li><a href="#">Rutrum amet varius</a></li> - </ul> - </section> - <section class="col-arc-6 col-arc-12-narrower"> - <h3>Get In Touch</h3> - <form> - <div class="row-arc gtr-50"> - <div class="col-arc-6 col-arc-12-mobilep"> - <input type="text" name="name" id="name" placeholder="Name" /> - </div> - <div class="col-arc-6 col-arc-12-mobilep"> - <input type="email" name="email" id="email" placeholder="Email" /> - </div> - <div class="col-arc-12"> - <textarea name="message" id="message" placeholder="Message" rows="5"></textarea> - </div> - <div class="col-arc-12"> - <ul class="actions"> - <li><input type="submit" class="button alt" value="Send Message" /></li> - </ul> - </div> - </div> - </form> - </section> - </div> - </div> - - <!-- Icons --> - <ul class="icons"> - <li><a href="#" class="icon brands fa-twitter"><span class="label">Twitter</span></a></li> - <li><a href="#" class="icon brands fa-facebook-f"><span class="label">Facebook</span></a></li> - <li><a href="#" class="icon brands fa-github"><span class="label">GitHub</span></a></li> - <li><a href="#" class="icon brands fa-linkedin-in"><span class="label">LinkedIn</span></a></li> - <li><a href="#" class="icon brands fa-google-plus-g"><span class="label">Google+</span></a></li> - </ul> - - <!-- Copyright --> - <div class="copyright"> - <ul class="menu"> - <li>© Untitled. All rights reserved</li><li>Design: <a href="http://html5up.net">HTML5 UP</a></li> - </ul> - </div> - + </div> </div> diff --git a/htdocs/header.php b/htdocs/header.php index 50dfa8cd1c4753f898cea78a0d85026bb969ebf0..88b5145e40b64fd70307588c6e91702532c89e40 100644 --- a/htdocs/header.php +++ b/htdocs/header.php @@ -78,6 +78,15 @@ <a href="/pima/requests/requests.php">Mes demandes</a> </li> + <li + + <?php + if (basename(getcwd()) == 'cours') + echo 'class="current"'; + ?> > + <a href="/pima/cours/cours.php">Mes cours</a> + </li> + <?php } ?> <li diff --git a/htdocs/index.php b/htdocs/index.php index 956a3344f6c2ba1e00aad97d57102de60ce6f171..9c2c8dfc33ba37ca59f49c6b1b91bc0098952532 100644 --- a/htdocs/index.php +++ b/htdocs/index.php @@ -19,7 +19,14 @@ include("head.php"); if ($_SESSION['connected']){ $firstname = $_SESSION['currentFirstname']; $name = $_SESSION['currentName']; - echo "$firstname $name "; + echo "<p>Bienvenue $firstname $name</p>"; + } + + else{ + echo "<p>Bienvenue sur Adopte un prof</p> + <p>Ici vous pourrez contacter un professeur pour des cours particulier ou vous même proposer + des cours.</br> + Inscrivez-vous ou connecter-vous pour marcher sur le chemin de la reussite!</p>"; } if (isset($_POST['reset'])){ @@ -35,4 +42,4 @@ include("head.php"); </div> </div> </section> -<?php #include("footer.php"); ?> +<?php include("footer.php"); ?> diff --git a/htdocs/inscription/inscription_student.php b/htdocs/inscription/inscription_student.php index e8f19d833b590b055acdaef3f1bb6b8224b46ec2..fdd3478ce08cd2def7b0b77fc2079161cd4232eb 100644 --- a/htdocs/inscription/inscription_student.php +++ b/htdocs/inscription/inscription_student.php @@ -28,4 +28,4 @@ include("/opt/lampp/htdocs/pima/head.php"); </div> </section> -<?php #include("/opt/lampp/htdocs/pima/footer.php"); ?> +<?php include("/opt/lampp/htdocs/pima/footer.php"); ?> diff --git a/htdocs/match_script.php b/htdocs/match_script.php index f381933a110087d9532ffd48fb4028a22c256b9e..64e458f2b996e5d6c0b0376f2e488fdfe46d1349 100644 --- a/htdocs/match_script.php +++ b/htdocs/match_script.php @@ -39,4 +39,119 @@ function match_script($student, $userRepository){ #} } +function print_requests($users,$requests,$bdd){ + + $noRequest = true; + + + foreach($requests as $r){ + + if (isset($_POST['accept'])){ + echo "Demande acceptée"; + set_accepted($_POST['idTeacher'],$_POST['idStudent'],$bdd); + } + + else{ + + $subject = $r->subject; + $studentId = $r->student; + $teacherId = $r->teacher; + $dispo = $r->dispo; + $accepted = $r->accepted; + + + foreach ($users as $u){ + if ($u->getId() == $studentId){ + $studentName = $u->getName(); + $studentFirstname = $u->getFirstname(); + } + } + + if (!$accepted){ + echo "<p>Vous avez une demande de $studentFirstname $studentName pour un cours de $subject le $dispo</p>"; + $noRequest = false; + + echo "<form action='/pima/requests/requests.php' method='post'> + <div class='form-group form-row'> + <div class='offset-sm'> + <input type='hidden' value=$studentId name='idTeacher'> + <input type='hidden' value=$teacherId name='idStudent'> + <input type='submit' value='Accepter' name='accept'> + </div> + </div> + </form>"; + } + } + } + + + + if ($noRequest){ + echo "<p>Vous n'avez aucune demande</p>"; + } + + +} + +function print_cours($users,$requests,$bdd){ + + $noCours = true; + + + foreach($requests as $r){ + + if (isset($_POST['accept'])){ + echo "Demande acceptée"; + set_accepted($_POST['idTeacher'],$_POST['idStudent'],$bdd); + } + + else{ + + $subject = $r->subject; + $studentId = $r->student; + $teacherId = $r->teacher; + $dispo = $r->dispo; + $accepted = $r->accepted; + + + foreach ($users as $u){ + if ($u->getId() == $studentId){ + $studentName = $u->getName(); + $studentFirstname = $u->getFirstname(); + } + } + + if ($accepted){ + echo "<p>Vous avez un cours avec $studentFirstname $studentName pour un cours de $subject le $dispo</p>"; + $noCours = false; + + echo "<form action='/pima/requests/requests.php' method='post'> + <div class='form-group form-row'> + <div class='offset-sm'> + <input type='hidden' value=$studentId name='idTeacher'> + <input type='hidden' value=$teacherId name='idStudent'> + <input type='submit' value='Accepter' name='accept'> + </div> + </div> + </form>"; + } + } + } + + + + if ($noCours){ + echo "<p>Vous n'avez aucune demande</p>"; + } + + +} + +function set_accepted($idProf,$idStudent,$bdd){ + + $sql = "UPDATE pima SET accepted = ? WHERE teacher = $idProf"; + $bdd->prepare($sql)->execute([1]); + +} + ?> diff --git a/htdocs/requests/requests.php b/htdocs/requests/requests.php index 515093de341633c313d9e57f24d4ddf4003cc98b..17761e70c0cd00cfe8e33d798882771304dd5e13 100644 --- a/htdocs/requests/requests.php +++ b/htdocs/requests/requests.php @@ -23,4 +23,4 @@ include("/opt/lampp/htdocs/pima/head.php"); </div> </div> </section> -<?php #include("/opt/lampp/htdocs/pima/footer.php"); ?> +<?php include("/opt/lampp/htdocs/pima/footer.php"); ?> diff --git a/htdocs/student/matchs.php b/htdocs/student/matchs.php index f7939dfae5c85bf2d16b9d51a8ce69446547b24c..499066abea46757f8872d7760072ef98e9064942 100644 --- a/htdocs/student/matchs.php +++ b/htdocs/student/matchs.php @@ -54,7 +54,7 @@ include("/opt/lampp/htdocs/pima/head.php"); </div> </form> - + </p> <?php /*if (isset($_POST['match1'])){ @@ -74,3 +74,4 @@ include("/opt/lampp/htdocs/pima/head.php"); </div> </div> </section> +<?php include("/opt/lampp/htdocs/pima/footer.php"); ?> diff --git a/htdocs/tests.php b/htdocs/tests.php index 8ecda81ffce27234e0712f505e9a3e13a957f499..b9354cb57360d7ba16cc9528ab98b8c235beaae3 100644 --- a/htdocs/tests.php +++ b/htdocs/tests.php @@ -50,4 +50,4 @@ include("head.php"); </div> </section> -<?php #include("footer.php"); ?> +<?php include("footer.php"); ?>