Design pages "Rejoindre une équipe" et "Informations"

This commit is contained in:
galaxyoyo 2019-09-25 00:57:41 +02:00
parent 615f2da9a4
commit 371605d265
5 changed files with 56 additions and 37 deletions

View File

@ -7,7 +7,7 @@ $id = $_GET["id"];
$user = User::fromId($id); $user = User::fromId($id);
if ($_SESSION["role"] != Role::ADMIN) { if ($_SESSION["role"] != Role::ADMIN) {
if ($user->getId() != $_SESSION["user_id"] && ($user->getTeamId() == null || $user->getTeamId() != $_SESSION["user"]->getTeamId())) if ($user->getId() != $_SESSION["user_id"])
require_once "server_files/403.php"; require_once "server_files/403.php";
} }

View File

@ -115,8 +115,7 @@ function canValidate(Team $team)
function printDocuments($documents) function printDocuments($documents)
{ {
global $URL_BASE; echo "<div class=\"alert alert-info\">\n";
foreach ($documents as $document) { foreach ($documents as $document) {
$file_id = $document->getFileId(); $file_id = $document->getFileId();
$user = User::fromId($document->getUserId()); $user = User::fromId($document->getUserId());
@ -124,8 +123,9 @@ function printDocuments($documents)
$first_name = $user->getFirstName(); $first_name = $user->getFirstName();
$name = DocumentType::getTranslatedName($document->getType()); $name = DocumentType::getTranslatedName($document->getType());
$version = $document->getVersion(); $version = $document->getVersion();
echo "$name de $first_name $surname (version $version) : <a href=\"/file/$file_id\">Télécharger</a><br />"; echo "$name de $first_name $surname (version $version) : <a href=\"/file/$file_id\"><strong>Télécharger</strong></a><br />\n";
} }
echo "</div>\n";
} }
function getZipFile($problem, $team_id = -1) function getZipFile($problem, $team_id = -1)

View File

@ -1,22 +1,33 @@
<?php require_once "header.php" ?> <?php require_once "header.php" ?>
<h1><?= $user->getFirstName() . " " . $user->getSurname() ?></h1> <div class="mt-4 mb-4">
<h1 class="display-4"><?= $user->getFirstName() . " " . $user->getSurname() ?></h1>
</div>
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?> <?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
Équipe : <?= $team === null ? "Pas d'équipe" : "<a href=\"/equipe/" . $team->getTrigram() . "\">" . $team->getName() . " (" . $team->getTrigram() . ")</a>" ?><br /> <div class="alert alert-info">
<strong>Équipe :</strong> <?= $team === null ? "Pas d'équipe" : "<a href=\"/equipe/" . $team->getTrigram() . "\">"
. $team->getName() . " (" . $team->getTrigram() . ")</a>" ?>
</div>
<?php } ?> <?php } ?>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?> <?php if ($user->getRole() == Role::PARTICIPANT) { ?>
Lycée : <?= $user->getSchool() ?><br /> <div class="alert alert-info">
Classe : <?= SchoolClass::getTranslatedName($user->getClass()) ?><br /> <strong>Lycée :</strong> <?= $user->getSchool() ?><br />
<strong>Classe :</strong> <?= SchoolClass::getTranslatedName($user->getClass()) ?>
</div>
<?php } elseif ($user->getDescription() != "") { ?> <?php } elseif ($user->getDescription() != "") { ?>
Description : <?= $user->getDescription() ?><br /> <div class="alert alert-info">
<strong>Description :</strong> <?= $user->getDescription() ?>
</div>
<?php } <?php }
echo "<hr />"; echo "<hr />";
if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?> if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<h2>Autorisations</h2> <div class="mt-4 mb-4">
<h1 class="display-5">Autorisation de droit à l'image :</h1>
</div>
<?php <?php
printDocuments($documents); printDocuments($documents);
} }

View File

@ -26,14 +26,22 @@ require_once "header.php";
if ($team->getEncadrantId() !== null) { if ($team->getEncadrantId() !== null) {
$encadrant = User::fromId($team->getEncadrantId()); $encadrant = User::fromId($team->getEncadrantId());
$id = $encadrant->getId(); $id = $encadrant->getId();
echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />"; if ($_SESSION["role"] == Role::ADMIN)
echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName()
. " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
else
echo "<strong>Encadrant :</strong> " . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "<br />";
} }
for ($i = 1; $i <= 5; ++$i) { for ($i = 1; $i <= 5; ++$i) {
if ($team->getParticipants()[$i - 1] == NULL) if ($team->getParticipants()[$i - 1] == NULL)
continue; continue;
$participant = User::fromId($team->getParticipants()[$i - 1]); $participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId(); $id = $participant->getId();
echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />"; if ($_SESSION["role"] == Role::ADMIN)
echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName()
. " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
else
echo "<strong>Participant $i :</strong> " . $participant->getFirstName() . " " . $participant->getSurname() . "<br />";
} }
?> ?>
@ -93,8 +101,9 @@ require_once "header.php";
<button class="btn btn-secondary btn-lg btn-block">Modifier mon équipe</button> <button class="btn btn-secondary btn-lg btn-block">Modifier mon équipe</button>
</a> </a>
<?php } ?> <?php } ?>
<hr/> <hr/><div class="mt-4 mb-4">
<h2>Autorisation de droit à l'image</h2> <h1 class="display-5">Autorisation de droit à l'image</h1>
</div>
<?php <?php
printDocuments($documents); printDocuments($documents);

View File

@ -1,32 +1,31 @@
<?php <?php
require_once "header.php" ; require_once "header.php" ; ?>
if (isset($join_team) && !$has_error) { ?> <div class="mt-4 mb-4">
Vous avez bien rejoint l'équipe <?= $_SESSION["team"]->getName() ?> ! <h1 class="display-4">Rejoindre une équipe</h1>
</div>
<?php if (isset($join_team) && !$has_error) { ?>
<div class="alert alert-success">
Vous avez bien rejoint l'équipe <?= $_SESSION["team"]->getName() ?> !
</div>
<?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?> <?php } elseif(date("Y-m-d H:i:s") >= $CONFIG->getInscriptionDate()) { ?>
<h2>La date limite d'inscription est dépassée.</h2> <div class="alert alert-danger">
La date limite d'inscription est dépassée.
</div>
<?php } else { ?> <?php } else { ?>
<?php if ($has_error) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
<form method="POST"> <form method="POST">
<table > <div class="form-row">
<tbody> <div class="form-group col-md-12">
<tr> <label for="access_code">Code d'accès :</label>
<td style="width: 30%;"> <input class="form-control" type="text" id="access_code" name="access_code" pattern="[A-Za-z0-9]{6}" required/>
<label for="access_code">Code d'accès :</label> </div>
</td> </div>
<td style="width: 70%;">
<input type="text" id="access_code" name="access_code" /> <div class="form-group row">
</td> <input class="btn btn-primary btn-lg btn-block" name="join_team" type="submit" value="Rejoindre l'équipe"/>
</tr> </div>
<tr>
<td colspan="2">
<input name="join_team" type="submit" value="Rejoindre l'équipe" />
</td>
</tr>
</tbody>
</table>
</form> </form>
<?php } ?> <?php } ?>