Skip to content
Extraits de code Groupes Projets
Valider d820d8da rédigé par Lucas BRIFFON's avatar Lucas BRIFFON
Parcourir les fichiers

print matchs

parent 0022f9ee
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -35,6 +35,7 @@ function fill_table($bdd){ ...@@ -35,6 +35,7 @@ function fill_table($bdd){
$bdd->query($sql); $bdd->query($sql);
$sql = "CREATE TABLE requests ( $sql = "CREATE TABLE requests (
ID int NOT NULL,
student int NOT NULL, student int NOT NULL,
teacher int NOT NULL, teacher int NOT NULL,
dispo varchar(20) NOT NULL, dispo varchar(20) NOT NULL,
......
...@@ -83,7 +83,7 @@ function inscription_student($bdd){ ...@@ -83,7 +83,7 @@ function inscription_student($bdd){
</div> </div>
</div> </div>
<div class="col-sm-1"> <div class="col-sm-2">
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="inlineCheckbox23" value="mercredi" name="mercredi"> <input class="form-check-input" type="checkbox" id="inlineCheckbox23" value="mercredi" name="mercredi">
<label class="form-check-label" for="inlineCheckbox23">Mercredi</label> <label class="form-check-label" for="inlineCheckbox23">Mercredi</label>
...@@ -97,7 +97,7 @@ function inscription_student($bdd){ ...@@ -97,7 +97,7 @@ function inscription_student($bdd){
</div> </div>
</div> </div>
<div class="col-sm-1"> <div class="col-sm-2">
<div class="form-check form-check-inline"> <div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="inlineCheckbox25" value="vendredi" name="vendredi"> <input class="form-check-input" type="checkbox" id="inlineCheckbox25" value="vendredi" name="vendredi">
<label class="form-check-label" for="inlineCheckbox25">Vendredi</label> <label class="form-check-label" for="inlineCheckbox25">Vendredi</label>
...@@ -314,16 +314,4 @@ function connection($bdd){ ...@@ -314,16 +314,4 @@ function connection($bdd){
<?php <?php
} }
function match($student, $userRepository) {
$matchs = match_script($student, $userRepository);
foreach($matchs as $match) {
$firstnameProf = $match["teacher"]->getFirstname();
$nameProf = $match["teacher"]->getName();
$subject = $match["subject"];
$dispo = $match["dispo"];
echo "Le professeur <b>$firstnameProf $nameProf</b> est disponible pour un cours de <b>$subject</b> le <b>$dispo</b>.</br>";
}
}
?> ?>
...@@ -14,54 +14,63 @@ include("/opt/lampp/htdocs/pima/head.php"); ...@@ -14,54 +14,63 @@ include("/opt/lampp/htdocs/pima/head.php");
if (isset($_SESSION['currentMail'])) { if (isset($_SESSION['currentMail'])) {
$students = $userRepository->fetchStudent(); $students = $userRepository->fetchStudent();
foreach($students as $student) { foreach($students as $student) {
if ($_SESSION['currentMail'] == $student->getMail()) { if ($_SESSION['currentMail'] != $student->getMail()) {
echo "<header><h2>Mes matchs</h2></header> <p>";
match($student, $userRepository);
echo "</p>";
}
}
}
if (isset($_POST['id'])) {
$students = $userRepository->fetchStudent();
foreach($students as $student) {
if ($_POST['id'] == $student->getID()) {
$firstname = $student->getFirstname();
$name = $student->getName();
echo "<header><h2>Mes matchs ($firstname $name)</h2></header> <p>";
match($student, $userRepository);
echo "</p>";
}
}
}
else {
?> ?>
<header><h2>Accès interdit</h2></header> <header><h2>Accès interdit</h2></header>
<p>Vous devez être authentifié⋅e en tant qu'élève pour avoir accès à cette page.</p> <p>Vous devez être authentifié⋅e en tant qu'élève pour avoir accès à cette page.</p>
<?php <?php
} }
?> else {
echo "<header><h2>Mes matchs</h2></header> <p>";
<!-- Formulaire pour tester l'affichage. Quand l'authentification sera faite, $matchs = match_script($student, $userRepository);
le supprimer et utiliser l'ID dans _SESSION au lieu de _POST --> $idMatch = 0;
<p>
<form action="matchs.php" method="post"> echo '<form action="/pima/student/matchs.php" method="post">';
foreach($matchs as $match) {
$firstnameProf = $match["teacher"]->getFirstname();
$nameProf = $match["teacher"]->getName();
$subject = $match["subject"];
$dispo = $match["dispo"];
$idMatch++;
?>
<div class="form-group form-row"> <div class="form-group form-row">
<label for="inputId" class="col-sm-2 col-form-label">Identifiant</label> <div class="form-check">
<div class="col-sm-10"> <input class="form-check-input" type="checkbox" id="checkbox<?php echo "$idMatch" ?>" value="match<?php echo "$idMatch" ?>" name="match<?php echo "$idMatch" ?>">
<input type='text' class="form-control" id="inputIde" name='id' placeholder="Identifiant"> <label class="form-check-label" for="checkbox<?php echo "$idMatch" ?>" style="font-weight: 300;">
<?php echo "Cours de <b>$subject</b> le <b>$dispo</b> par <b>$firstnameProf $nameProf</b>" ?>
</label>
</div> </div>
</div> </div>
<?php
}
?>
<div class="form-group form-row"> <div class="form-group form-row">
<div class="offset-sm-2"> <input type="submit" value="Demander">
<!-- <button type="submit">S'inscrire</button> -->
<input type="submit" value="Se connecter">
</div>
</div> </div>
</form> </form>
</p> </p>
<?php
/*if (isset($_POST['match1'])){
$firstname = $_POST['firstname'];
$name = $_POST['name'];
$type = "Student";
$mail = $_POST['mail'];
$mdp = $_POST['mdp'];
$sql = "INSERT INTO users(student, teacher, dispo, subject, accepted) values (?, ?, ?, ?, ?, ?)";
$bdd->prepare($sql)->execute([$firstname,$name,$type,$mail,$mdp]);
}*/
}
}
}
?>
</div> </div>
</div> </div>
</section> </section>
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter