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);
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";
}

View File

@ -115,8 +115,7 @@ function canValidate(Team $team)
function printDocuments($documents)
{
global $URL_BASE;
echo "<div class=\"alert alert-info\">\n";
foreach ($documents as $document) {
$file_id = $document->getFileId();
$user = User::fromId($document->getUserId());
@ -124,8 +123,9 @@ function printDocuments($documents)
$first_name = $user->getFirstName();
$name = DocumentType::getTranslatedName($document->getType());
$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)

View File

@ -1,22 +1,33 @@
<?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) { ?>
É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 if ($user->getRole() == Role::PARTICIPANT) { ?>
Lycée : <?= $user->getSchool() ?><br />
Classe : <?= SchoolClass::getTranslatedName($user->getClass()) ?><br />
<div class="alert alert-info">
<strong>Lycée :</strong> <?= $user->getSchool() ?><br />
<strong>Classe :</strong> <?= SchoolClass::getTranslatedName($user->getClass()) ?>
</div>
<?php } elseif ($user->getDescription() != "") { ?>
Description : <?= $user->getDescription() ?><br />
<div class="alert alert-info">
<strong>Description :</strong> <?= $user->getDescription() ?>
</div>
<?php }
echo "<hr />";
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
printDocuments($documents);
}

View File

@ -26,14 +26,22 @@ require_once "header.php";
if ($team->getEncadrantId() !== null) {
$encadrant = User::fromId($team->getEncadrantId());
$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) {
if ($team->getParticipants()[$i - 1] == NULL)
continue;
$participant = User::fromId($team->getParticipants()[$i - 1]);
$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>
</a>
<?php } ?>
<hr/>
<h2>Autorisation de droit à l'image</h2>
<hr/><div class="mt-4 mb-4">
<h1 class="display-5">Autorisation de droit à l'image</h1>
</div>
<?php
printDocuments($documents);

View File

@ -1,32 +1,31 @@
<?php
require_once "header.php" ;
require_once "header.php" ; ?>
if (isset($join_team) && !$has_error) { ?>
Vous avez bien rejoint l'équipe <?= $_SESSION["team"]->getName() ?> !
<div class="mt-4 mb-4">
<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()) { ?>
<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 if ($has_error) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
<form method="POST">
<table >
<tbody>
<tr>
<td style="width: 30%;">
<label for="access_code">Code d'accès :</label>
</td>
<td style="width: 70%;">
<input type="text" id="access_code" name="access_code" />
</td>
</tr>
<tr>
<td colspan="2">
<input name="join_team" type="submit" value="Rejoindre l'équipe" />
</td>
</tr>
</tbody>
</table>
<div class="form-row">
<div class="form-group col-md-12">
<label for="access_code">Code d'accès :</label>
<input class="form-control" type="text" id="access_code" name="access_code" pattern="[A-Za-z0-9]{6}" required/>
</div>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="join_team" type="submit" value="Rejoindre l'équipe"/>
</div>
</form>
<?php } ?>