Redesign du site

This commit is contained in:
Yohann D'ANELLO 2019-12-19 13:02:01 +01:00
parent a368dfbead
commit 7db606e6eb
30 changed files with 1122 additions and 942 deletions

View File

@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="WebServers">
<option name="servers">
<webServer id="3455bbbe-7983-4ac6-b2f8-7e6c650508e4" name="inscription.tfjm.org" url="https://inscription.tfjm.org">
<fileTransfer host="tfjm.org" port="22" accessType="SFTP" authAgent="true">
<advancedOptions>
<advancedOptions dataProtectionLevel="Private" passiveMode="true" shareSSLContext="true" />
</advancedOptions>
<option name="port" value="22" />
</fileTransfer>
</webServer>
</option>
</component>
</project>

View File

@ -1,8 +1,47 @@
html, body {
height: 100%;
margin: 0;
}
:root {
--navbar-height: 32px;
}
.container {
min-height: 78%;
}
.inner {
margin: 20px;
}
.alert {
text-align: justify;
}
footer .alert {
text-align: center;
}
#navbar-logo {
height: var(--navbar-height);
display: block;
}
}
ul .deroule {
display: none;
position: absolute;
background: #f8f9fa !important;
list-style-type: none;
padding: 20px;
z-index: 42;
}
li:hover ul.deroule {
display:block;
}
a.nav-link:hover {
background-color: #d8d9da;
}

View File

@ -38,9 +38,9 @@ $ROUTES["^equipe/([A-Z]{3})/?$"] = ["server_files/controllers/equipe.php", "trig
$ROUTES["^file/([a-z0-9]{64})/?$"] = ["server_files/controllers/view_file.php", "file_id"];
$ROUTES["^informations/([0-9]*)/.*?$"] = ["server_files/controllers/informations.php", "id"];
$ROUTES["^inscription/?$"] = ["server_files/controllers/inscription.php"];
$ROUTES["^mon_compte/?$"] = ["server_files/controllers/mon_compte.php"];
$ROUTES["^mon_equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
$ROUTES["^mon_equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
$ROUTES["^mon-compte/?$"] = ["server_files/controllers/mon_compte.php"];
$ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
$ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
$ROUTES["^rejoindre_equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
$ROUTES["^solutions/?$"] = ["server_files/controllers/solutions.php"];
$ROUTES["^solutions_orga/?$"] = ["server_files/controllers/solutions_orga.php"];

View File

@ -5,6 +5,7 @@ class SchoolClass
const SECONDE = 0;
const PREMIERE = 1;
const TERMINALE = 2;
const ADULT = 3;
public static function getTranslatedName($class) {
switch ($class) {
@ -12,8 +13,12 @@ class SchoolClass
return "Seconde ou inférieur";
case self::PREMIERE:
return "Première";
default:
case self::TERMINALE:
return "Terminale";
case self::ADULT:
return "Adulte";
default:
return null;
}
}
@ -23,8 +28,12 @@ class SchoolClass
return "SECONDE";
case self::PREMIERE:
return "PREMIERE";
default:
case self::TERMINALE:
return "TERMINALE";
case self::ADULT:
return "ADULT";
default:
return null;
}
}
@ -34,8 +43,12 @@ class SchoolClass
return self::SECONDE;
case "PREMIERE":
return self::PREMIERE;
default:
case "TERMINALE":
return self::TERMINALE;
case "ADULT":
return self::ADULT;
default:
return null;
}
}
}

View File

@ -3,12 +3,12 @@
if (!isset($_SESSION["role"]) || ($_SESSION["role"] != Role::PARTICIPANT && $_SESSION["role"] != Role::ENCADRANT))
require_once "server_files/403.php";
$tournaments_response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `date_inscription` > CURRENT_DATE AND `year` = '$YEAR';");
$tournaments_response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `date_inscription` > CURRENT_TIMESTAMP AND `year` = $YEAR;");
$has_error = false;
$error_message = null;
if (isset($_POST["submitted"])) {
if (isset($_POST["add_team"])) {
$new_team = new NewTeam($_POST);
try {
$new_team->makeVerifications();

View File

@ -3,7 +3,7 @@
$has_error = false;
$error_message = null;
if (isset($_POST["submitted"]) && !isset($_SESSION["user_id"])) {
if (isset($_POST["login"]) && !isset($_SESSION["user_id"])) {
$logging_in_user = new LoggingInUser($_POST);
try {
$logging_in_user->makeVerifications();

View File

@ -4,5 +4,11 @@ unset($_SESSION["user_id"]);
session_destroy();
require_once "server_files/views/header.php";
echo "<h2>Déconnexion réussie !</h2>";
?>
<div class="alert alert-success">
Déconnexion réussie !
</div>
<?php
require_once "server_files/views/footer.php";

View File

@ -9,7 +9,7 @@ $user = $_SESSION["user"];
$has_error = false;
$error_message = null;
if (isset($_POST["submitted"])) {
if (isset($_POST["update_account"])) {
$my_account = new MyAccount($_POST);
try {
$my_account->makeVerifications();
@ -21,7 +21,7 @@ if (isset($_POST["submitted"])) {
}
}
if (isset($_POST["submitted_password"])) {
if (isset($_POST["update_password"])) {
$new_password = new NewPassword($_POST);
try {
$new_password->makeVerifications();
@ -63,8 +63,10 @@ class MyAccount
$keys = ["email", "surname", "first_name", "birth_date", "gender", "address", "postal_code", "city", "country", "phone_number",
"school", "class", "responsible_name", "responsible_phone", "responsible_email", "description"];
if ($this->user->getRole() == Role::PARTICIPANT)
$this->class = SchoolClass::fromName($this->class);
if ($this->user->getRole() != Role::PARTICIPANT)
$this->class = SchoolClass::fromName(strtoupper($this->class));
else
$this->class = SchoolClass::ADULT;
foreach ($keys as $key)
$this->$key = $this->$key != null && $this->$key != "" ? $this->$key : $this->user->$key;

View File

@ -134,7 +134,7 @@ class MyTeam
$_SESSION["tournament"] = $this->tournament;
header("Location: $URL_BASE/mon_equipe");
header("Location: $URL_BASE/mon-equipe");
}
}

View File

@ -6,7 +6,7 @@ if (isset($_SESSION["team"]) || !isset($_SESSION["user"]) || ($_SESSION["role"]
$has_error = false;
$error_message = null;
if (isset($_POST["submitted"])) {
if (isset($_POST["join_team"])) {
$join_team = new JoinTeam($_POST);
try {
$join_team->makeVerifications();
@ -47,6 +47,8 @@ class JoinTeam
public function joinTeam()
{
global $team;
$user = $_SESSION["user"];
$user->setTeamId($this->team->getId());
@ -56,7 +58,7 @@ class JoinTeam
else
$this->team->setParticipant($this->min_null_index, $user->getId());
$_SESSION["team"] = $this->team;
$team = $_SESSION["team"] = $this->team;
$tournament = $_SESSION["tournament"] = Tournament::fromId($this->team->getTournamentId());
Mailer::sendJoinTeamMail($user, $this->team, $tournament);

View File

@ -36,7 +36,7 @@ class SaveSolution
public function __construct()
{
$this->file = $_FILES["document"];
$this->file = $_FILES["solution"];
$this->problem = htmlspecialchars($_POST["problem"]);
}

View File

@ -33,8 +33,8 @@ class SaveSynthesis
public function __construct()
{
$this->file = $_FILES["document"];
$this->dest = DestType::fromName(strtoupper(htmlspecialchars($_POST["problem"])));
$this->file = $_FILES["synthese"];
$this->dest = DestType::fromName(strtoupper(htmlspecialchars($_POST["dest"])));
}
public function makeVerifications()

View File

@ -1,56 +1,53 @@
<?php
require_once "header.php";
?>
if (isset($new_team) && !$has_error) { ?>
Votre équipe a bien été créée ! Voici le code d'accès à transmettre aux autres membres de votre équipe : <strong><?= $new_team->access_code ?></strong>
<div class="mt-4 mb-4">
<h1 class="display-4">Ajouter une équipe</h1>
</div>
<?php if (isset($new_team) && !$has_error) { ?>
<div class="alert alert-success">
Votre équipe a bien été créée ! Voici le code d'accès à transmettre aux autres membres de votre équipe :
<strong><?= $new_team->access_code ?></strong>
</div>
<?php } elseif ($_SESSION["team"] != NULL) { ?>
<h2>Vous êtes déjà dans une équipe.</h2>
<div class="alert alert-danger">
Vous êtes déjà dans une équipe.
</div>
<?php } else { ?>
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
<form method="POST">
<div class="form-row">
<div class="form-group col-md-6">
<label for="name">Nom (<em>Pas de caractères spéciaux</em>) :</label>
<input class="form-control" type="text" id="name" name="name" pattern="[A-Za-zÀ-ÿ ]+"
value="<?php if (isset($new_team)) echo $new_team->name ?>" required/>
</div>
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" />
</td>
</tr>
<tr>
<td>
<label for="trigram">Trigramme :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="trigram" name="trigram" />
</td>
</tr>
<tr>
<td>
<label for="tournament_id">Tournoi :</label>
</td>
<td>
<select style="width: 100%;" id="tournament_id" name="tournament_id">
<?php
while (($data = $tournaments_response->fetch()) !== FALSE) {
echo "<option value=\"" . $data["id"] . "\">" . $data["name"] . "</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" value="Ajouter une équipe" />
</td>
</tr>
</tbody>
</table>
</form>
<div class="form-group col-md-6">
<label for="trigram">Trigramme (<em>identifiant unique à trois lettres de l'équipe</em>) :</label>
<input class="form-control" type="text" id="trigram" name="trigram"
value="<?php if (isset($new_team)) echo $new_team->trigram ?>" pattern="[A-Z]{3}" maxlength="3" required/>
</div>
</div>
<div class="form-group row">
<label for="tournament_id">Tournoi :</label>
<select id="tournament_id" name="tournament_id" class="custom-select">
<option value="0">Choisir un tournoi ...</option>
<?php
while (($data = $tournaments_response->fetch()) !== FALSE) {
echo "<option value=\"" . $data["id"] . "\">" . $data["name"] . "</option>\n";
}
?>
</select>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="add_team" type="submit" value="Ajouter une équipe"/>
</div>
</form>
<?php } ?>
<?php require_once "footer.php" ?>

View File

@ -1,57 +1,43 @@
<?php
require_once "header.php";
?>
if (isset($orga)) {
if ($has_error) {
echo "<h2>Erreur : " . $error_message . "</h2>";
} else {
echo "<h2>Organisateur ajouté avec succès ! Ses identifiants ont été transmis par mail.</h2>";
}
} ?>
<div class="mt-4 mb-4">
<h1 class="display-4">Ajouter un organisateur</h1>
</div>
<?php if (isset($orga) && !$has_error) { ?>
<div class="alert alert-success">
Organisateur ajouté avec succès ! Ses identifiants ont été transmis par mail.
</div>
<?php } ?>
<form method="POST">
<input type="hidden" name="submitted" value="true"/>
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="surname">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="surname" name="surname"/>
</td>
</tr>
<tr>
<td>
<label for="first_name">Prénom :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="first_name" name="first_name"/>
</td>
</tr>
<tr>
<td>
<label for="email">Email :</label>
</td>
<td>
<input style="width: 100%;" type="email" id="email" name="email"/>
</td>
</tr>
<tr>
<td>
<label for="admin">Compte administrateur :</label>
</td>
<td>
<input style="width: 100%;" type="checkbox" id="admin" name="admin"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" value="Ajouter un organisateur"/>
</td>
</tr>
</tbody>
</table>
<div class="form-row">
<div class="form-group col-md-6">
<label for="surname">Nom :</label>
<input class="form-control" type="text" id="surname" name="surname"
value="<?php if (isset($orga)) echo $orga->surname ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="first_name">Prénom :</label>
<input class="form-control" type="text" id="first_name" name="first_name"
value="<?php if (isset($orga)) echo $orga->first_name ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
value="<?php if (isset($orga)) echo $orga->email ?>" required/>
</div>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="add_admin" type="submit" value="Ajouter un administrateur" />
</div>
</form>
<?php require_once "footer.php" ?>

View File

@ -1,127 +1,111 @@
<?php
require_once "header.php";
?>
if (isset($tournament)) {
if ($has_error) {
echo "<h2>Erreur : " . $error_message . "</h2>";
}
else {
echo "<h2>Tournoi de " . htmlspecialchars($_POST["name"]) . " ajouté avec succès !</h2>";
}
}?>
<div class="mt-4 mb-4">
<h1 class="display-4">Ajouter un tournoi</h1>
</div>
<?php
/** @var NewTournament $tournament */
if (isset($tournament) && !$has_error) { ?>
<div class="alert alert-success">
Tournoi de <?= $tournament->name ?> ajouté avec succès !
</div>
<?php } ?>
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" required />
</td>
</tr>
<tr>
<td>
<label for="organizers">Organisateurs :</label>
</td>
<td>
<select style="width: 100%;" id="organizers" name="organizers[]" multiple size="4" required>
<?php
while (($data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $data["id"] . "\">" . $data["first_name"] . " " . $data["surname"] . "</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td>
<label for="size">Nombre d'équipes :</label>
</td>
<td>
<input style="width: 100%;" type="number" id="size" name="size" min="3" max="12" value="6" required />
</td>
</tr>
<tr>
<td>
<label for="place">Lieu :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="place" name="place" required />
</td>
</tr>
<tr>
<td>
<label for="price">Prix par participant</label>
</td>
<td>
<input style="width: 100%;" type="number" id="price" name="price" min="0" max="50" value="21" required />
</td>
</tr>
<tr>
<td>
<label for="date_start">Dates :</label>
</td>
<td>
Du <input style="width: 45%;" type="date" id="date_start" name="date_start" required /> au <!--suppress HtmlFormInputWithoutLabel -->
<input style="width: 45%;" type="date" id="date_end" name="date_end" required />
</td>
</tr>
<tr>
<td>
<label for="date_inscription">Date limite d'inscription :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" required />
<!--suppress HtmlFormInputWithoutLabel -->
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" required />
</td>
</tr>
<tr>
<td>
<label for="date_solutions">Date limite pour rendre les solutions :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" required />
<!--suppress HtmlFormInputWithoutLabel -->
<input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" required />
</td>
</tr>
<tr>
<td>
<label for="date_syntheses">Date limite pour rendre les notes de synthèse :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_syntheses" name="date_syntheses" required />
<!--suppress HtmlFormInputWithoutLabel -->
<input style="width: 49%;" type="time" id="time_syntheses" name="time_syntheses" required />
</td>
</tr>
<tr>
<td>
<label for="description">Description :</label>
</td>
<td>
<textarea style="width: 100%;" name="description" id="description" required></textarea>
</td>
</tr>
<tr>
<td>
<label for="final">Ce tournoi est la finale nationale :</label>
</td>
<td>
<input style="width: 100%;" type="checkbox" id="final" name="final" />
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" value="Ajouter un tournoi" />
</td>
</tr>
</tbody>
</table>
<div class="form-row">
<div class="form-group col-md-6">
<label for="name">Nom du tournoi :</label>
<input class="form-control" type="text" id="name" name="name" pattern="[A-Za-zÀ-ÿ ]+"
value="<?php if (isset($tournament)) echo $tournament->name ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="place">Lieu :</label>
<input class="form-control" type="text" id="place" name="place"
value="<?php if (isset($tournament)) echo $tournament->place ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="organizers">Organisateurs :</label>
<select style="width: 100%;" id="organizers" name="organizers[]" multiple size="4" class="custom-select" required>
<?php
while (($data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $data["id"] . "\">" . $data["first_name"] . " " . $data["surname"] . "</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="size">Nombre d'équipes :</label>
<input class="form-control" type="number" id="size" name="size"
value="<?php if (isset($tournament)) echo $tournament->size; else echo 6; ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="price">Prix par participant :</label>
<input class="form-control" type="number" id="price" name="price"
value="<?php if (isset($tournament)) echo $tournament->price; else echo 0; ?>" required/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-6">
<label for="date_start">Début du tournoi :</label>
<input class="form-control" type="date" id="date_start" name="date_start"
value="<?= isset($tournament) ? substr($tournament->getStartDate(), 0, 10) : date('Y-m-d') ?>"/>
</div>
<div class="form-group col-md-6">
<label for="date_end">Fin du tournoi :</label>
<input class="form-control" type="date" id="date_end" name="date_end"
value="<?= isset($tournament) ? substr($tournament->getEndDate(), 0, 10) : date('Y-m-d') ?>"/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-4">
<label for="date_inscription">Date limite d'inscription :</label>
<input class="form-control" type="date" id="date_inscription" name="date_inscription"
value="<?= isset($tournament) ? substr($tournament->getInscriptionDate(), 0, 10) : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_inscription" name="time_inscription"
value="<?= isset($tournament) ? substr($tournament->getInscriptionDate(), 11, 5) : date('H:i') ?>"/>
</div>
<div class="form-group col-md-4">
<label for="date_solutions">Date limite de remise des solutions :</label>
<input class="form-control" type="date" id="date_solutions" name="date_solutions"
value="<?= isset($tournament) ? substr($tournament->getSolutionsDate(), 0, 10) : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_solutions" name="time_solutions"
value="<?= isset($tournament) ? substr($tournament->getSolutionsDate(), 11, 5) : date('H:i') ?>"/>
</div>
<div class="form-group col-md-4">
<label for="date_syntheses">Date limite de remise des notes de synthèse :</label>
<input class="form-control" type="date" id="date_syntheses" name="date_syntheses"
value="<?= isset($tournament) ? substr($tournament->getSynthesesDate(), 0, 10) : date('Y-m-d') ?>"/>
<input class="form-control" type="time" id="time_syntheses" name="time_syntheses"
value="<?= isset($tournament) ? substr($tournament->getSynthesesDate(), 11, 5) : date('H:i') ?>"/>
</div>
</div>
<div class="form-group row">
<div class="form-group col-md-12">
<label for="description">Description :</label>
<textarea class="form-control" id="description" name="description"><?= isset($tournament) ? $tournament->getDescription() : "" ?></textarea>
</div>
</div>
<label for="final">Ce tournoi est la finale nationale :</label>
<input type="checkbox" id="final" name="final" /><br /><br />
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="add_tournament" type="submit" value="Ajouter un tournoi" />
</div>
</form>
<?php require_once "footer.php" ?>

View File

@ -1,64 +1,65 @@
<?php
require_once "header.php";
if (isset($error_message) && $error_message === FALSE) {
if (!$has_error) {
if (isset($recuperate_account))
echo "<div class=\"alert alert-success\">Le mail de récupération de mot de passe a bien été envoyé.</div>";
else if (isset($reset_password))
echo "<div class=\"alert alert-warning\">Le mail de récupération de mot de passe a bien été envoyé.</div>";
elseif (isset($reset_password) && isset($_POST["password"]))
echo "<div class=\"alert alert-success\">Le mot de passe a bien été changé. Vous pouvez désormais vous connecter.</div>";
else if (isset($_GET["confirmation-mail"]))
elseif (isset($_GET["confirmation-mail"]))
echo "<div class=\"alert alert-success\">Le mail a bien été renvoyé.</div>";
else if (isset($logging_in_user))
else if (isset($logging_in_user)) {
echo "<div class=\"alert alert-success\">Connexion réussie !</div>";
} else if (isset($_SESSION["user_id"])) { ?>
<div class="alert alert-danger">Vous êtes déjà connecté !</div>
<?php } else { ?>
require_once "footer.php";
} else if (isset($_SESSION["user_id"])) {
echo "<div class=\"alert alert-danger\">Vous êtes déjà connecté !</div>";
require_once "footer.php";
}
}
<?php if (isset($_GET["mdp_oublie"])) { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Réinitialisation du mot de passe</h1>
<label for="email">E-mail associée au compte :</label>
<input type="email" class="form-control" id="email" name="email"/>
</div>
<input class="btn btn-lg btn-primary" type="submit" name="forgotten_password"
value="Envoyer l'e-mail de récupération"/>
</form>
<?php } elseif (isset($_GET["reset_password"])) { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<input type="hidden" name="token" value="<?= $_GET["token"] ?>"/>
<div class="form-group">
<label for="password">Nouveau mot de passe :</label>
<input type="password" id="password" name="password" class="form-control" />
</div>
<div class="form-group">
<label for="confirm_password">Confirmer le mot de passe :</label>
<input type="password" id="confirm_password" name="confirm_password" class="form-control" />
</div>
<input type="submit" name="reset_password" class="btn btn-block btn-primary"
value="Changer le mot de passe"/>
</form>
<?php } elseif (isset($_GET["confirmation-mail"])) { ?>
<?php } else { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<hr class="mt-2 mb-4"/>
<input type="hidden" name="submitted" value="true"/>
<div class="form-group">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
value="<?php if (isset($email)) echo $email ?>"/>
</div>
<div class="form-group">
<label for="password">Mot de passe :</label>
<input class="form-control" type="password" id="password" name="password"/>
</div>
<input class="btn btn-primary btn-block" type="submit" value="Se connecter"/>
</form>
<div class="alert">
<a href="/connexion/mdp_oublie">Mot de passe oublié ?</a>
if (isset($_GET["mdp_oublie"])) { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Réinitialisation du mot de passe</h1>
<label for="email">E-mail associée au compte :</label>
<input type="email" class="form-control" id="email" name="email" required/>
<input class="btn btn-lg btn-primary btn-block" type="submit" name="forgotten_password"
value="Envoyer l'e-mail de récupération"/>
</form>
<?php } elseif (isset($reset_password) && $reset_password->user != null && ($has_error || !isset($_POST["password"]))) { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<input type="hidden" name="token" value="<?= $_GET["token"] ?>"/>
<div class="form-group">
<label for="password">Nouveau mot de passe :</label>
<input type="password" id="password" name="password" class="form-control" required/>
</div>
<?php } ?>
<div class="form-group">
<label for="confirm_password">Confirmer le mot de passe :</label>
<input type="password" id="confirm_password" name="confirm_password" class="form-control" required/>
</div>
<input type="submit" name="reset_password" class="btn btn-block btn-primary"
value="Changer le mot de passe"/>
</form>
<?php } elseif (isset($_GET["confirmation-mail"])) { ?>
<?php } else { ?>
<form method="POST" class="jumbotron mt-5">
<h1 class="display-4">Connexion</h1>
<hr class="mt-2 mb-4"/>
<div class="form-group">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
value="<?php if (isset($email)) echo $email ?>" required/>
</div>
<div class="form-group">
<label for="password">Mot de passe :</label>
<input class="form-control" type="password" id="password" name="password" required/>
</div>
<input class="btn btn-primary btn-block" name="login" type="submit" value="Se connecter"/>
</form>
<div class="alert">
<!--suppress HtmlUnknownTarget -->
<a href="/connexion/mdp-oublie">Mot de passe oublié ?</a>
</div>
<?php } ?>
<?php require_once "footer.php" ?>
<?php require_once "footer.php" ?>

View File

@ -1,30 +1,63 @@
<?php require_once "header.php" ?>
<h2>Informations sur l'équipe</h2>
<div class="mt-4 mb-4">
<h1 class="display-4">Informations sur l'équipe</h1>
</div>
Nom de l'équipe : <?= $team->getName() ?><br/>
Trigramme : <?= $team->getTrigram() ?><br/>
Tournoi : <a href="<?= "/tournoi/" . $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team->getEncadrants()[$i - 1] == NULL)
continue;
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "Encadrant $i : <a href=\"/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
for ($i = 1; $i <= 6; ++$i) {
if ($team->getParticipants()[$i - 1] == NULL)
continue;
$participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId();
echo "Participant $i : <a href=\"/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
if ($team->isSelectedForFinal()) {
$final_name = $FINAL->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"/tournoi/$final_name\">finale nationale</a>.</strong>";
}
?>
<div class="alert alert-info">
<strong>Nom de l'équipe :</strong> <?= $team->getName() ?>
</div>
<div class="alert alert-info">
<strong>Trigramme :</strong> <?= $team->getTrigram() ?>
</div>
<div class="alert alert-info">
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<label for="tournament">Tournoi :</label>
<form method="POST">
<select class="custom-select" id="tournament" name="select_tournament" onchange="this.form.submit()">
<option value="0">Pas de tournoi sélectionné</option>
<?php
foreach (Tournament::getAllTournaments(false, true) as $t) { ?>
<option value="<?= $t->getId() ?>" <?= $team->getTournamentId() == $t->getId() ? "selected" : "" ?>>
<?= $t->getName() ?>
</option>
<?php } ?>
</select>
</form>
<?php } else { ?>
<strong>Tournoi :</strong> <a href="<?= "/tournoi/" . $tournament->getName() ?>">
<?= $team->getTournamentId() == 0 ? "Pas de tournoi choisi" : $tournament->getName() ?>
</a>
<?php } ?>
</div>
<div class="alert alert-<?= $team->getValidationStatus() == ValidationStatus::VALIDATED ? "success" : ($team->getValidationStatus() == ValidationStatus::WAITING ? "warning" : "danger") ?>">
<strong>Validation de l'équipe
:</strong> <?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?>
</div>
<div class="alert alert-info">
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team->getEncadrants()[$i] == NULL)
continue;
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
for ($i = 1; $i <= 6; ++$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 ($team->isSelectedForFinal()) {
$final_name = $FINAL->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"/tournoi/$final_name\">finale nationale</a>.</strong>";
}
?>
</div>
<hr/>
@ -33,31 +66,49 @@ if ($team->isSelectedForFinal()) {
<?php printDocuments($documents) ?>
<form method="POST">
<input style="width: 100%;" type="submit" name="download_zip" value="Télécharger l'archive"/>
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="download_zip" value="Télécharger l'archive"/>
</form>
<?php if ($team->isSelectedForFinal()) { ?>
<hr/>
<h2>Autorisations pour la finale</h2>
<?php printDocuments($documents_final) ?>
<?php printDocuments($documents_final) ?>
<form method="POST">
<input type="hidden" name="final" value="true" />
<input style="width: 100%;" type="submit" name="download_zip" value="Télécharger l'archive"/>
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="download_zip_final" value="Télécharger l'archive"/>
</form>
<?php } ?>
<?php if ($team->getValidationStatus() == ValidationStatus::WAITING && $_SESSION["role"] == Role::ADMIN) { ?>
<form method="POST">
<input style="width: 100%;" type="submit" name="validate" value="Valider l'équipe"/>
<div class="form-group row">
<label for="message">Message à adresser à l'équipe :</label>
<textarea class="form-control" id="message" name="message"></textarea>
</div>
<div class="form-group">
<div class="form-group row col-mod-6">
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="unvalidate"
value="Refuser l'équipe"/>
<input type="submit" class="btn btn-primary btn-lg btn-block" name="validate" value="Valider l'équipe"/>
</div>
</div>
</form>
<?php
<?php
}
if (!$team->isSelectedForFinal() && $_SESSION["role"] == Role::ADMIN) { ?>
if (!$team->isSelectedForFinal() && $team->getValidationStatus() == ValidationStatus::VALIDATED && $_SESSION["role"] == Role::ADMIN) { ?>
<hr/>
<form method="POST">
<input style="width: 100%;" type="submit" name="select" value="Sélectionner pour la finale nationale"/>
</form>
<?php } ?>
<?php }
if ($team->getValidationStatus() == ValidationStatus::NOT_READY && $_SESSION["role"] == Role::ADMIN) { ?>
<hr/>
<form method="POST">
<input type="submit" class="btn btn-primary btn-lg btn-block" name="delete_team" value="Supprimer l'équipe"
style="background-color: #ff2e34"/>
</form>
<?php }?>
<?php require_once "footer.php" ?>

View File

@ -1,4 +1,18 @@
<div class="mt-4 mb-4">
</div>
</div>
<footer>
<hr/>
<div class="container.fluid">
<div class="alert alert-light inner">
<em>Ce site a été conçu pour Animath, avec amour et passion. Il est récent et il est possible que
certaines pages ne fonctionnent pas correctement. Si vous remarquez des bugs, merci de les signaler à
l'adresse <a href="mailto:contact@tfjm.org">contact@tfjm.org</a>.</em><br/>
© <?= $YEAR ?> Tournoi Français des Jeunes Mathématiciennes et Mathématiciens
</div>
</div>
</footer>
</body>
</html>
<?php exit() ?>

View File

@ -1,12 +1,14 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<meta name="google-site-verification" content="pCj5PNYVI9sAMZm8T9qoSjRrcXnEPj7tI07hBBfii04" />
<meta charset="UTF-8">
<meta name="description" content="Inscrivez-vous pour le TFJM² <?= $YEAR ?> !">
<meta name="keywords" content="TFJM,TFJM²,Tournoi,Français,Jeunes,Mathématiciennes,Mathématiciens">
<meta name="author" content="Yohann D'ANELLO (yohann.danello[at]animath.fr)">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Site d'inscription pour le TFJM² <?= $YEAR ?></title>
<link rel="stylesheet" type="text/css" href="/style.css"/>
<link REL="shortcut icon" href="/favicon.ico"/>
<link rel="stylesheet" type="text/css" href="/style.css">
<link REL="shortcut icon" href="/favicon.ico">
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
@ -17,7 +19,7 @@
<div class="container.fluid bg-light">
<nav class="navbar navbar-expand-lg navbar-light">
<div class="container">
<a class="navbar-brand" href="/">
<a class="navbar-brand" href="https://tfjm.org/">
<img src="/logo.svg" alt="Logo TFJM²" id="navbar-logo">
</a>
<ul class="navbar-nav mr-auto">
@ -29,7 +31,7 @@
</li>
<?php if (isset($_SESSION["user_id"])) { ?>
<li class="nav-item active">
<a class="nav-link" href="/mon_compte">Mon compte</a>
<a class="nav-link" href="/mon-compte">Mon compte</a>
</li>
<?php if ($_SESSION["role"] == Role::ENCADRANT || $_SESSION["role"] == Role::PARTICIPANT) { ?>
<?php if ($_SESSION["team"] == NULL) { ?>
@ -41,7 +43,7 @@
</li>
<?php } else { ?>
<li class="nav-item active">
<a class="nav-link" href="/mon_equipe">Mon équipe</a>
<a class="nav-link" href="/mon-equipe">Mon équipe</a>
</li>
<?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED || true) { ?>
<li class="nav-item active">
@ -83,20 +85,25 @@
<a class="nav-link" href="/inscription">Inscription</a>
</li>
<?php } else { ?>
<?php
if ($_SESSION["role"] != Role::ADMIN) {
echo "<li><a class=\"nav-link\" href=\"?be-admin=1\">Devenir administrateur</a></li>\n";
}
if ($_SESSION["role"] != Role::ORGANIZER) {
echo "<li><a class=\"nav-link\" href=\"?be-organizer=1\">Devenir organisateur</a></li>\n";
}
if ($_SESSION["role"] != Role::PARTICIPANT) {
echo "<li><a class=\"nav-link\" href=\"?be-participant=1\">Devenir participant</a></li>\n";
}
if ($_SESSION["role"] != Role::ENCADRANT) {
echo "<li><a class=\"nav-link\" href=\"?be-encadrant=1\">Devenir encadrant</a></li>\n";
}
?>
<li class="nav-item active">
<a class="nav-link">Changer de point de vue</a>
<ul class="deroule">
<?php
if ($_SESSION["role"] != Role::ADMIN) {
echo "<li><a class=\"nav-link\" href=\"?be-admin=1\">Devenir administrateur</a></li>\n";
}
if ($_SESSION["role"] != Role::ORGANIZER) {
echo "<li><a class=\"nav-link\" href=\"?be-organizer=1\">Devenir organisateur</a></li>\n";
}
if ($_SESSION["role"] != Role::PARTICIPANT) {
echo "<li><a class=\"nav-link\" href=\"?be-participant=1\">Devenir participant</a></li>\n";
}
if ($_SESSION["role"] != Role::ENCADRANT) {
echo "<li><a class=\"nav-link\" href=\"?be-encadrant=1\">Devenir encadrant</a></li>\n";
}
?>
</ul>
</li>
<li class="nav-item active">
<a class="nav-link" href="/deconnexion">Déconnexion</a>
</li>
@ -106,4 +113,13 @@
</div>
<div class="container">
<div class="container">
<div class="mt-4 mb-4">
</div>
<?php
if (isset($has_error) && $has_error) { ?>
<div class="alert alert-danger">
<strong>Erreur :</strong> <?= $error_message ?>
</div>
<?php }

View File

@ -5,7 +5,7 @@
<div class="jumbotron bg-white">
<div class="row">
<h1 class="display-3">
Bienvenue sur le site d'inscription au <a href="https://tfjm.org">TFJM^2</a> !
Bienvenue sur le site d'inscription au <a href="https://tfjm.org">𝕋𝔽𝕁𝕄<sup>2</sup></a> !
</h1>
<h2 class="display-4 text-muted">
Le Tournoi Français des Jeunes Mathématiciens et Mathématiciennes

View File

@ -1,15 +1,87 @@
<?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 (!$has_error) {
if (isset($_POST["kick"])) { ?>
<div class="alert alert-success">
La personne a bien été exclue de l'équipe !
</div>
<?php } elseif (isset($attribute_team)) { ?>
<div class="alert alert-success">
La personne a bien rejoint l'équipe !
</div>
<?php }
}
?>
<div class="alert alert-info">
<strong>Rôle :</strong> <?= Role::getTranslatedName($user->getRole()) ?>
</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>" ?>
<?php if ($team == null) { ?>
<form method="POST">
<div class="form-group row">
<div class="form-group col-md-12">
<label for="team">Attribuer une équipe :</label>
<select class="custom-select" id="team" name="team">
<option value="no_team">Choisir une équipe ...</option>
<?php
/** @var Team $t */
foreach (Team::getAllTeams(true) as $t) {
if ($t->getValidationStatus() != ValidationStatus::NOT_READY)
continue;
$team_name = $t->getName() . " (" . $t->getTrigram() . "), "
. ($t->getTournamentId() == 0 ? "pas de tournoi choisi" : "tournoi " . Tournament::fromId($t->getTournamentId())->getName());
$team_id = $t->getId();
echo "<option value=\"$team_id\">$team_name</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-group row">
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="attribute_team"
value="Affecter dans une équipe"/>
</div>
</form>
<?php } elseif ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<form method="POST">
<input type="hidden" name="kick"/>
<a href="#" onclick="this.parentNode.submit()">Virer de l'équipe</a>
</form>
<?php } ?>
</div>
<?php } ?>
Date de naissance : <?= formatDate($user->getBirthDate()) ?><br />
Sexe : <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
Adresse : <?= $user->getAddress() . ", " . $user->getPostalCode() . " " . $user->getCity() . ($user->getCountry() == "France" ? "" : ", " . $user->getCountry()) ?><br />
Adresse e-mail : <a href="mailto:<?= $user->getEmail() ?>"><?= $user->getEmail() ?></a><br />
Numéro de téléphone : <?= $user->getPhoneNumber() ?><br />
<div class="alert alert-info">
<strong>Date de naissance :</strong> <?= formatDate($user->getBirthDate()) ?><br />
</div>
<div class="alert alert-info">
<strong>Sexe :</strong> <?= $user->getGender() == "M" ? "Masculin" : "Féminin" ?><br />
</div>
<div class="alert alert-info">
<strong>Adresse :</strong> <?= $user->getAddress() . ", " . $user->getPostalCode() . " " . $user->getCity() . ($user->getCountry() == "France" ? "" : ", " . $user->getCountry()) ?><br />
</div>
<div class="alert alert-info">
<strong>Adresse e-mail :</strong> <a href="mailto:<?= $user->getEmail() ?>"><?= $user->getEmail() ?></a><br />
</div>
<div class="alert alert-info">
<strong>Numéro de téléphone :</strong> <?= $user->getPhoneNumber() ?><br />
</div>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
Lycée : <?= $user->getSchool() ?><br />

View File

@ -1,8 +1,5 @@
<?php
require_once "header.php";
if ($has_error)
echo "<div class=\"alert alert-danger\">Erreur : " . $error_message . "</div>";
?>
<div class="mt-4 mb-4">
@ -14,15 +11,16 @@ if ($has_error)
if (isset($user) && !$has_error) {
?>
<div class="alert alert-success">
Votre inscription est validée ! Merci désormais de confirmer votre boîte mail pour valider votre adresse.
Vous êtes bien inscrit ! Merci désormais de confirmer votre boîte mail pour valider votre adresse. Pensez à vérifier
vos courriers indésirables.
</div>
<?php } else if (isset($_SESSION["user_id"])) { ?>
<div class="alert alert-success">Vous êtes déjà connecté !</div>
<div class="alert alert-danger">
Vous êtes déjà connecté !
</div>
<?php } else { ?>
<form method="POST">
<input type="hidden" name="submitted" value="true"/>
<div class="form-group row">
<label for="role">Rôle :</label>
<select id="role" name="role" onchange="selectRole()" class="custom-select">
@ -163,7 +161,7 @@ if (isset($user) && !$has_error) {
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" type="submit" value="S'inscrire"/>
<input class="btn btn-primary btn-lg btn-block" name="register" type="submit" value="S'inscrire"/>
</div>
</form>

View File

@ -1,178 +1,249 @@
<?php
require_once "header.php";
?>
if ($has_error)
echo "<h2>Erreur : " . $error_message . "</h2>";
<div class="mt-4 mb-4">
<h1 class="display-4">Mon compte</h1>
</div>
elseif (isset($my_account) || isset($new_password)) {
?>
<h2>Votre compte a bien été mis à jour !</h2>
<?php
if (isset($my_account) && $user->getEmail() != $my_account->email) {
echo "Votre adresse mail a bien été changée. Veuillez vérifier votre boîte mail pour valider votre nouvelle adresse, vous en aurez besoin pour vous reconnecter.";
}
?>
<?php if (!$has_error && isset($send_document)) { ?>
<div class="alert alert-success">
Le fichier a été correctement envoyé !
</div>
<?php } ?>
<form method="POST">
<input type="hidden" name="submitted" value="true"/>
<table style="width: 100%">
<tr>
<td style="width: 30%"><label for="email">E-mail :</label></td>
<td style="width: 70%"><?= $user->getEmail() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="email" id="email" name="email"/></td>
</tr>
<tr>
<td><label for="surname">Nom :</label></td>
<td><?= $user->getSurname() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="surname" name="surname"/></td>
</tr>
<tr>
<td><label for="firstname">Prénom :</label></td>
<td><?= $user->getFirstName() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="firstname" name="firstname"/></td>
</tr>
<tr>
<td><label for="birth_date">Date de naissance :</label></td>
<td><?= formatDate($user->getBirthDate()) ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="date" id="birth_date" name="birth_date"/></td>
</tr>
<tr>
<td><label for="gender">Sexe :</label></td>
<td><input type="radio" id="male" name="gender" value="M" <?php if ($user->getGender() == "M") echo "checked" ?> /><label for="male">Homme</label>
<input type="radio" id="female" name="gender" value="F" <?php if ($user->getGender() == "F") echo "checked" ?> /><label for="female">Femme</label></td>
</tr>
<tr>
<td><label for="address">Adresse :</label></td>
<td><?= $user->getAddress() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="address" name="address"/></td>
</tr>
<tr>
<td><label for="postal_code">Code postal :</label></td>
<td><?= $user->getPostalCode() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="number" id="postal_code" name="postal_code" min="1000" max="95999"/></td>
</tr>
<tr>
<td><label for="city">Ville :</label></td>
<td><?= $user->getCity() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="city" name="city"/></td>
</tr>
<tr>
<td><label for="country">Pays :</label></td>
<td><?= $user->getCountry() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="country" name="country"/></td>
</tr>
<tr>
<td><label for="phone_number">Numéro de téléphone :</label></td>
<td><?= $user->getPhoneNumber() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="phone_number" name="phone_number"/></td>
</tr>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
<tr>
<td><label for="school">Établissement dans lequel l'élève étudie :</label></td>
<td><?= $user->getSchool() ?></td>
</tr>
<tr>
<td colspan="2"><input style="width: 100%" type="text" id="school" name="school"/></td>
</tr>
<tr>
<td><label for="class">Classe :</label></td>
<td><select style="width: 100%" id="class" name="class">
<option value="terminale" <?php if ($user->getClass() == SchoolClass::TERMINALE) echo "selected" ?>><?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?></option>
<option value="premiere" <?php if ($user->getClass() == SchoolClass::PREMIERE) echo "selected" ?>><?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?></option>
<option value="seconde" <?php if ($user->getClass() == SchoolClass::SECONDE) echo "selected" ?>><?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?></option>
</select></td>
</tr>
<tr>
<td>
<label for="responsible_name">Nom du responsable légal :</label>
</td>
<td>
<?= $user->getResponsibleName() ?>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="text" id="responsible_name" name="responsible_name" />
</td>
</tr>
<tr>
<td>
<label for="responsible_phone">Téléphone du responsable légal :</label>
</td>
<td>
<?= $user->getResponsiblePhone() ?>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%" type="text" id="responsible_phone" name="responsible_phone" />
</td>
</tr>
<tr>
<td>
<label for="responsible_email">Email du responsable légal :</label>
</td>
<td>
<?= $user->getResponsibleEmail() ?>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%" type="email" id="responsible_email" name="responsible_email" />
</td>
</tr>
<?php } else { ?>
<tr>
<td><label for="description">Description :</label></td>
<td><textarea style="width: 100%" id="description" name="description"><?= $user->getDescription() ?></textarea></td>
</tr>
<?php } ?>
<tr>
<td colspan="2"><input type="submit" style="width: 100%" value="Mettre à jour mes données"/></td>
</tr>
</table>
</form>
<?php
if (!$has_error && (isset($my_account) || isset($new_password))) {
?>
<div class="alert alert-success">
Votre compte a bien été mis à jour !
</div>
<?php
if (isset($my_account) && $user->getEmail() != $my_account->email) { ?>
<div class="alert alert-info">
Votre adresse mail a bien été changée. Veuillez vérifier votre boîte mail pour valider votre nouvelle
adresse, vous en aurez besoin pour vous reconnecter.
</div>
<?php } ?>
<?php } ?>
<div style="padding: 20px"></div>
<form method="POST">
<form method="POST">
<input type="hidden" name="submitted_password" value="true"/>
<table style="width: 100%">
<tr>
<td style="width: 30%"><label for="old_password">Ancien mot de passe :</label></td>
<td style="width: 70%"><input style="width: 100%" type="password" id="old_password" name="old_password"/></td>
</tr>
<tr>
<td><label for="new_password">Nouveau mot de passe :</label></td>
<td><input style="width: 100%" type="password" id="new_password" name="new_password"/></td>
</tr>
<tr>
<td><label for="confirm_password">Confirmer le mot de passe :</label></td>
<td><input style="width: 100%" type="password" id="confirm_password" name="confirm_password"/></td>
</tr>
<tr>
<td colspan="2"><input type="submit" style="width: 100%" value="Mettre à jour mon mot de passe"/></td>
</tr>
</table>
</form>
<div class="form-row">
<div class="form-group col-md-6">
<label for="surname">Nom :</label>
<input class="form-control" type="text" id="surname" name="surname"
value="<?= $user->getSurname() ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="first_name">Prénom :</label>
<input class="form-control" type="text" id="first_name" name="first_name"
value="<?= $user->getFirstName() ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="email">E-mail :</label>
<input class="form-control" type="email" id="email" name="email"
value="<?= $user->getEmail() ?>"
required/>
</div>
<div class="form-group col-md-6">
<label for="phone_number">Numéro de téléphone :</label>
<input class="form-control" type="text" id="phone_number" name="phone_number"
value="<?= $user->getPhoneNumber() ?>"/>
</div>
</div>
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<div class="form-row">
<div class="form-group col-md-6">
<label for="gender" class="mr-2">Sexe :</label>
<br/>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="male" name="gender" value="M"
required <?= $user->getGender() == "M" ? "checked" : "" ?> />
<label for="male" class="custom-control-label">Homme</label>
</div>
<div class="custom-control custom-radio custom-control-inline">
<input type="radio" class="custom-control-input" id="female" name="gender" value="F"
required <?= $user->getGender() == "F" ? "checked" : "" ?> />
<label for="female" class="custom-control-label">Femme</label>
</div>
</div>
<div class="form-group col-md-6">
<label for="birth_date">Date de naissance :</label>
<input class="form-control" type="date" id="birth_date" name="birth_date"
value="<?= $user->getBirthDate() ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-5">
<label for="address">Adresse :</label>
<input class="form-control" type="text" id="address" name="address"
value="<?= $user->getAddress() ?>"/>
</div>
<div class="form-group col-md-2">
<label for="postal_code">Code postal :</label>
<input class="form-control" type="number" id="postal_code" name="postal_code"
value="<?= $user->getPostalCode() ?>" min="1000"
max="95999" required/>
</div>
<div class="form-group col-md-3">
<label for="city">Ville :</label>
<input class="form-control" type="text" id="city" name="city"
value="<?= $user->getCity() ?>"/>
</div>
<div class="form-group col-md-2">
<label for="country">Pays :</label>
<input class="form-control" type="text" id="country" name="country"
value="<?= $user->getCountry() ?>" required/>
</div>
</div>
<?php } ?>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
<div class="form-row">
<div class="form-group col-md-6">
<label id="school_label" for="school">Établissement dans lequel l'élève étudie :</label>
<input class="form-control" type="text" id="school" name="school"
value="<?= $user->getSchool() ?>"/>
</div>
<div class="form-group col-md-6">
<label id="class_label" for="class">Classe :</label>
<select id="class" name="class" class="custom-select">
<option value="terminale" <?= $user->getClass() == SchoolClass::TERMINALE ? "selected" : "" ?>>
<?= SchoolClass::getTranslatedName(SchoolClass::TERMINALE) ?>
</option>
<option value="premiere" <?= $user->getClass() == SchoolClass::PREMIERE ? "selected" : "" ?>>
<?= SchoolClass::getTranslatedName(SchoolClass::PREMIERE) ?>
</option>
<option value="seconde" <?= $user->getClass() == SchoolClass::SECONDE ? "selected" : "" ?>>
<?= SchoolClass::getTranslatedName(SchoolClass::SECONDE) ?>
</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label id="responsible_name_label" for="responsible_name">Nom du responsable légal :</label>
<input class="form-control" type="text" id="responsible_name" name="responsible_name"
value="<?= $user->getResponsibleName() ?>"/>
</div>
<div class="form-group col-md-4">
<label id="responsible_phone_label" for="responsible_phone">Téléphone du responsable légal :</label>
<input class="form-control" type="text" id="responsible_phone" name="responsible_phone"
value="<?= $user->getResponsiblePhone() ?>"/>
</div>
<div class="form-group col-md-4">
<label id="responsible_email_label" for="responsible_email">Email du responsable légal :</label>
<input class="form-control" type="text" id="responsible_email" name="responsible_email"
value="<?= $user->getResponsibleEmail() ?>"/>
</div>
</div>
<?php } else { ?>
<div class="form-group row">
<label id="description_label" for="description">Activité professionnelle :</label>
<textarea class="form-control" id="description"
name="description"><?= $user->getDescription() ?></textarea>
</div>
<?php } ?>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="update_account" type="submit" value="Mettre à jour mes données" />
</div>
</form>
<div style="padding: 20px"></div>
<form method="POST">
<div class="form-row">
<div class="form-group col-md-4">
<label for="old_password">Ancien mot de passe :</label>
<input class="form-control" type="password" id="old_password" name="old_password" required/>
</div>
<div class="form-group col-md-4">
<label for="new_password">Nouveau mot de passe :</label>
<input class="form-control" type="password" id="new_password" name="new_password" required/>
</div>
<div class="form-group col-md-4">
<label for="confirm_password">Confirmer le mot de passe :</label>
<input class="form-control" type="password" id="confirm_password" name="confirm_password" required/>
</div>
</div>
<div class="form-group row">
<input class="btn btn-secondary btn-lg btn-block" type="submit" name="update_password"
value="Mettre à jour mon mot de passe"/>
</div>
</form>
<?php if (isset($_SESSION["team"]) && $user->getRole() == Role::PARTICIPANT) {
$not_validated = $_SESSION["team"]->getValidationStatus() == ValidationStatus::NOT_READY;
?>
<hr/>
<div class="mt-4 mb-4">
<h1 class="display-5">Mes autorisations</h1>
</div>
<?php if ($not_validated) { ?>
<em>Ces documents peut être modifiés tant que l'équipe n'est pas validée.</em>
<div class="alert alert-info">
<strong>Modèle d'autorisation de droit à l'image :</strong>
<a href="/Autorisation de droit à l'image - majeur.pdf">majeur</a> - <a
href="/Autorisation de droit à l'image - mineur.pdf">mineur</a>
</div>
<?php } ?>
<?php printDocuments($documents); ?>
<?php if ($not_validated) { ?>
<form method="POST" enctype="multipart/form-data">
<div class="form-row">
<div class="form-group col-md-12">
<label for="type">Type de document</label>
<select class="custom-select" id="type" name="type">
<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
<option value="parental_consent">Autorisation parentale</option>
<?php } ?>
<option value="photo_consent">Autorisation de droit à l'image</option>
<option value="sanitary_plug">Fiche sanitaire</option>
</select>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="document">Fichier :</label>
<input class="form-control" type="file" id="document" name="document" required/>
</div>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" type="submit" name="send_document"
value="Envoyer le document"/>
</div>
</form>
<?php } ?>
<?php } ?>
<?php require_once "footer.php" ?>

View File

@ -1,161 +1,133 @@
<?php
require_once "header.php";
if ($has_error)
echo "<h2>Erreur : " . $error_message . "</h2>";
elseif (isset($send_document))
echo "<h2>Le fichier a été correctement envoyé !</h2>";
?>
<h2>Informations sur l'équipe</h2>
<div class="mt-4 mb-4">
<h1 class="display-4">Mon équipe</h1>
</div>
<div class="alert alert-info">
<strong>Nom de l'équipe :</strong> <?= $team->getName() ?>
</div>
<div class="alert alert-info">
<strong>Trigramme :</strong> <?= $team->getTrigram() ?>
</div>
<div class="alert alert-info">
<strong>Tournoi :</strong>
<?= $tournament == null ? "Pas de tournoi attribué" : "<a href=\"/tournoi/" . $tournament->getName() . "\">" . $tournament->getName() . "</a>" ?>
</div>
<div class="alert alert-info">
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team->getEncadrants()[$i] == NULL)
continue;
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "<strong>Encadrant $i :</strong> <a href=\"/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
for ($i = 1; $i <= 6; ++$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=\"/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
?>
</div>
<div class="alert alert-info">
Code d'accès : <strong><?= $team->getAccessCode() ?></strong>
</div>
Nom de l'équipe : <?= $team->getName() ?><br/>
Trigramme : <?= $team->getTrigram() ?><br/>
Tournoi : <a href="<?= $tournament->getName() ?>"><?= $tournament->getName() ?></a><br/>
<?php
for ($i = 1; $i <= 2; ++$i) {
if ($team->getEncadrants()[$i] == NULL)
continue;
$encadrant = User::fromId($team->getEncadrants()[$i - 1]);
$id = $encadrant->getId();
echo "Encadrant $i : <a href=\"/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />";
}
for ($i = 1; $i <= 6; ++$i) {
if ($team->getParticipants()[$i - 1] == NULL)
continue;
$participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId();
echo "Participant $i : <a href=\"/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
?>
Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
<?php if ($team->isSelectedForFinal()) {
$final_name = $FINAL->getName();
echo "<strong>Équipe sélectionnée pour la <a href=\"/tournoi/$final_name\">finale nationale</a>.</strong><br />";
echo "<div class=\"alert aler-success\">Équipe sélectionnée pour la <a href=\"/tournoi/$final_name\">finale nationale</a>.</div>";
} ?>
<?php if (isset($_GET["modifier"])) { ?>
<form method="POST">
<input type="hidden" name="team_edit" value="true"/>
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $team->getName() ?>"/>
</td>
</tr>
<tr>
<td>
<label for="trigram">Trigramme :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="trigram" name="trigram"
value="<?= $team->getTrigram() ?>"/>
</td>
</tr>
<tr>
<td>
<label for="tournament">Tournoi :</label>
</td>
<td>
<select style="width: 100%;" id="tournament" name="tournament_id">
<?php
foreach ($tournaments as $tournament)
echo "<option value=\"" . $tournament->getId() . "\">" . $tournament->getName() . "</option>\n";
?>
</select>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" value="Modifier l'équipe"/>
</td>
</tr>
</tbody>
</table>
<div class="form-row">
<div class="form-group col-md-6">
<label for="name">Nom :</label>
<input class="form-control" type="text" id="name" name="name" pattern="[A-Za-zÀ-ÿ ]+"
value="<?= $team->getName() ?>" required/>
</div>
<div class="form-group col-md-6">
<label for="trigram">Trigramme :</label>
<input class="form-control" type="text" id="trigram" name="trigram"
value="<?= $team->getTrigram() ?>" pattern="[A-Z]{3}" maxlength="3" required/>
</div>
</div>
<div class="form-group row">
<label for="tournament">Tournoi :</label>
<select id="tournament" name="tournament_id" class="custom-select">
<option value="0">Choisir un tournoi ...</option>
<?php
foreach ($tournaments as $tournament)
echo "<option value=\"" . $tournament->getId() . "\" "
. ($tournament->getId() == $team->getTournamentId() ? "selected" : "") . ">"
. $tournament->getName() . "</option>\n";
?>
</select>
</div>
<div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="team_edit" type="submit"
value="Modifier l'équipe"/>
</div>
</form>
<?php } else { ?>
<?php if ($_SESSION["team_validation_status"] == ValidationStatus::NOT_READY) { ?>
<!--suppress HtmlUnknownTarget -->
<a href="/mon_equipe/modifier">Modifier mon équipe</a>
<?php } ?>
<hr/>
<h2>Mes autorisations</h2>
<?php
printDocuments($documents);
if ($team->isSelectedForFinal()) { ?>
<hr/>
<h2>Mes autorisations pour la finale</h2>
<?php
printDocuments($documents_final);
}
if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<hr />
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<table style="width: 100%;">
<tbody>
<tr>
<td>
<label for="type">Type de document :</label>
</td>
<td>
<select style="width: 100%;" id="type" name="type">
<?php if ($_SESSION["user"]->getBirthDate() > strval($YEAR - 18) . substr($tournament->getStartDate(), 4)) { ?>
<option value="parental_consent">Autorisation parentale</option>
<?php } ?>
<option value="photo_consent">Autorisation de droit à l'image</option>
<option value="sanitary_plug">Fiche sanitaire</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="file">Fichier :</label>
</td>
<td>
<input style="width: 100%;" type="file" id="file" name="document"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="send_document" value="Envoyer le document"/>
</td>
</tr>
</tbody>
</table>
</form>
<a href="/mon-equipe/modifier">
<button class="btn btn-secondary btn-lg btn-block">Modifier mon équipe</button>
</a>
<?php } ?>
<?php if ($team->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
<hr/>
<table style="width: 100%;">
<tr>
<td style="width: 50%;">
<form method="post">
<input style="width: 100%;" type="submit" name="leave_team" value="Quitter l'équipe"/>
</form>
</td>
<?php
$can_validate = canValidate($team, $tournament);
if ($can_validate) { ?>
<td style="width: 50%;">
<form method="post">
<input style="width: 100%;" type="submit" name="request_validation"
value="Demander la validation"/>
</form>
</td>
<?php } ?>
</tr>
</table>
<form method="POST">
<input class="btn btn-primary btn-lg btn-block" type="submit" name="leave_team" style="background-color: #ff2e34"
value="Quitter l'équipe"/>
</form>
<?php
$can_validate = canValidate($team, $tournament);
if ($can_validate) { ?>
<hr />
<form method="post">
<label for="engage">Je m'engage à participer à l'intégralité des Correspondances</label>
<input type="checkbox" name="engage" id="engage" required/>
<div class="alert alert-warning">
<strong>Attention !</strong> Une fois votre équipe validée, vous ne pourrez plus modifier le nom
de l'équipe, le trigramme, le problème sur lequel vous souhaitez travailler ou la composition de l'équipe.
</div>
<input class="btn btn-primary btn-lg btn-block" type="submit" name="request_validation"
value="Demander la validation"/>
</form>
<?php } else { ?>
<hr />
<div class="alert alert-warning">
Pour demander à valider votre équipe, vous devez avoir au moins un encadrant, trois participants,
choisi un problème et soumis une autorisation de droit à l'image par participant.
</div>
<?php } ?>
<?php }
elseif ($team->getValidationStatus() == ValidationStatus::WAITING) { ?>
<div class="alert alert-warning">
Votre équipe est en attente de validation.
</div>
<?php } ?>
<hr />
<h2>Autorisations de l'équipe</h2>
<?php printDocuments($documents); ?>
<?php } ?>
<?php require_once "footer.php" ?>

View File

@ -1,32 +1,34 @@
<?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 <?= $team->getName() ?> !
</div>
<?php } else { ?>
<?php if ($has_error) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
<?php if ($_SESSION["role"] == Role::ENCADRANT && sizeof($_SESSION["teams"]) > 0) { ?>
<div class="alert alert-warning">
Vous êtes déjà inscrit dans une équipe. Vous pouvez toutefois encadrer plusieurs équipes.
</div>
<?php } ?>
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="access_code">Code d'accès :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="access_code" name="access_code" />
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" value="Rejoindre l'équipe" />
</td>
</tr>
</tbody>
</table>
</form>
<form method="POST">
<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 } ?>

View File

@ -1,47 +1,34 @@
<?php
require_once "header.php";
if ($has_error) {
echo "<h2>Erreur : " . $error_message . "</h2>";
} elseif (isset($save_solution)) {
echo "<h2>Le fichier a été correctement envoyé !</h2>";
}
?>
if (!$has_error && isset($save_solution)) { ?>
<div class="alert alert-success">
Le fichier a été correctement envoyé !
</div>
<?php } ?>
<?php if (date("yyyy-mm-dd") < $tournament->getSolutionsDate()) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<table style="width: 100%;">
<tbody>
<tr>
<td>
<label for="problem">Problème :</label>
</td>
<td>
<select style="width: 100%;" id="problem" name="problem">
<?php
for ($i = 1; $i <= 9; ++$i) {
echo "<option value=\"$i\">$i</option>\n";
}
?>
</select>
</td>
</tr>
<tr>
<td>
<label for="file">Fichier :</label>
</td>
<td>
<input type="file" id="file" name="solution"/>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="send_solution" value="Envoyer"/>
</td>
</tr>
</tbody>
</table>
<div class="form-row">
<div class="form-group col-md-6">
<label for="problem">Problème :</label>
<select class="custom-select" id="problem" name="problem">
<?php
for ($i = 1; $i <= 9; ++$i) {
echo "<option value=\"$i\">$i</option>\n";
}
?>
</select>
</div>
<div class="form-group col-md-6">
<label for="file">Fichier :</label>
<input class="form-control" type="file" id="file" name="solution"/>
</div>
</div>
<input class="btn btn-lg btn-primary btn-block" type="submit" name="send_solution" value="Envoyer" />
</form>
<?php } ?>
@ -55,7 +42,7 @@ foreach ($solutions as $sol) {
$file_id = $sol->getFileId();
$problem = $sol->getProblem();
$version = $sol->getVersion();
echo "Problème $problem (Version $version) : <a href=\"/file/$file_id\">Télécharger</a><br />";
echo "<div class=\"alert alert-info\"><strong>Problème $problem</strong> (Version $version) : <a href=\"/file/$file_id\">Télécharger</a></div>\n";
}
if ($team->isSelectedForFinal()) { ?>
@ -68,7 +55,7 @@ if ($team->isSelectedForFinal()) { ?>
$file_id = $sol->getFileId();
$problem = $sol->getProblem();
$version = $sol->getVersion();
echo "Problème $problem (Version $version) : <a href=\"/file/$file_id\">Télécharger</a><br />";
echo "<div class=\"alert alert-info\"><strong>Problème $problem</strong> (Version $version) : <a href=\"/file/$file_id\">Télécharger</a></div>\n";
}
}

View File

@ -1,7 +1,12 @@
<?php
require_once "server_files/views/header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Solutions</h1>
</div>
<?php
foreach ($tournaments as $tournament) {
echo "<h1>Tournoi de " . $tournament->getName() . "</h1>\n";
$sols = $tournament->getAllSolutions();
@ -13,13 +18,13 @@ foreach ($tournaments as $tournament) {
$team = Team::fromId($sol->getTeamId());
$team_name = $team->getName();
$team_trigram = $team->getTrigram();
echo "Problème n°$problem de l'équipe $team_name ($team_trigram), version $version : <a href=\"/file/$file_id\">Télécharger</a><br />";
echo "<div class=\"alert alert-info\"><strong>Problème n°$problem de l'équipe $team_name</strong> ($team_trigram), version $version : <a href=\"/file/$file_id\">Télécharger</a></div>";
}
echo "<form method=\"POST\">\n";
echo "<input type=\"hidden\" name=\"tournament\" value=\"" . $tournament->getId() . "\" />\n";
echo "<input style=\"width: 100%\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
echo "</form><hr />\n";
echo "<input class=\"btn btn-lg btn-primary btn-block\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
echo "</form>\n";
}
require_once "server_files/views/footer.php";

View File

@ -1,52 +1,38 @@
<?php
require_once "header.php";
if (date("yyyy-mm-dd") < $tournament->getSolutionsDate()) {
echo "<h3>Il est trop tôt pour se préoccuper des notes de synthèse, attendez le tirage des poules.</h3>";
echo "<div class=\"alert alert-danger\"><h4>Il est trop tôt pour se préoccuper des notes de synthèse, attendez le tirage des poules.</h4></div>";
require_once "server_files/views/footer.php";
}
if (isset($error_message)) {
if ($error_message !== false) {
echo "<h2>Erreur : " . $error_message . "</h2>";
}
else {
echo "<h2>Le fichier a été correctement envoyé !</h2>";
}
}?>
if (isset($save_synthesis) && !$has_error) { ?>
<div class="alert alert-success">
Le fichier a été correctement envoyé !
</div>
<?php } ?>
<?php if (date("yyyy-mm-dd") < $tournament->getSynthesesDate()) { ?>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
<table style="width: 100%;">
<tbody>
<tr>
<td>
<label for="dest">Destination de la note de synthèse :</label>
</td>
<td>
<select style="width: 100%;" id="dest" name="dest">
<option value="opposant">Opposant</option>
<option value="rapporteur">Rapporteur</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="file">Fichier :</label>
</td>
<td>
<input type="file" id="file" name="synthese" />
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="send_synthesis" value="Envoyer" />
</td>
</tr>
</tbody>
</table>
</form>
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/>
<div class="form-row">
<div class="form-group col-md-6">
<label for="dest">Destination de la note de synthèse :</label>
<select class="custom-select" id="dest" name="dest">
<option value="opposant">Opposant</option>
<option value="rapporteur">Rapporteur</option>
</select>
</div>
<div class="form-group col-md-6">
<label for="file">Fichier :</label>
<input class="form-control" type="file" id="file" name="synthese" />
</div>
</div>
<input class="btn btn-lg btn-primary btn-block" type="submit" name="send_synthesis" value="Envoyer" />
</form>
<?php } ?>
<div style="padding: 20px"></div>
@ -59,7 +45,7 @@ foreach ($syntheses as $synthesis) {
$file_id = $synthesis->getFileId();
$dest = $synthesis->getDest();
$version = $synthesis->getVersion();
echo "Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . " (version $version) : <a href=\"/file/$file_id\">Télécharger</a><br />";
echo "<div class=\"alert alert-info\"><strong>Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . "</strong> (version $version) : <a href=\"/file/$file_id\">Télécharger</a></div>";
}
if ($team->isSelectedForFinal()) { ?>
@ -72,7 +58,7 @@ if ($team->isSelectedForFinal()) { ?>
$file_id = $synthesis->getFileId();
$dest = $synthesis->getDest();
$version = $synthesis->getVersion();
echo "Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . " (version $version) : <a href=\"/file/$file_id\">Télécharger</a><br />";
echo "<div class=\"alert alert-info\"><strong>Note de synthèse pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . "</strong> (version $version) : <a href=\"/file/$file_id\">Télécharger</a></div>";
}
}

View File

@ -1,7 +1,12 @@
<?php
require_once "server_files/views/header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Notes de synthèse</h1>
</div>
<?php
/** @var Tournament $tournament */
foreach ($tournaments as $tournament) {
echo "<h1>Tournoi de " . $tournament->getName() . "</h1>\n";
@ -14,14 +19,14 @@ foreach ($tournaments as $tournament) {
$team = Team::fromId($synthesis->getTeamId());
$team_name = $team->getName();
$team_trigram = $team->getTrigram();
echo "Note de synthèse de l'équipe $team_name ($team_trigram) pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur")
. ", version $version : <a href=\"/file/$file_id\">Télécharger</a><br />";
echo "<div class=\"alert alert-info\"><strong>Note de synthèse de l'équipe $team_name ($team_trigram) pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur")
. "</strong>, version $version : <a href=\"/file/$file_id\">Télécharger</a></div>";
}
echo "<form method=\"POST\">\n";
echo "<input type=\"hidden\" name=\"tournament\" value=\"" . $tournament->getId() . "\" />\n";
echo "<input style=\"width: 100%\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
echo "</form><hr />\n";
echo "<input class=\"btn btn-lg btn-primary btn-block\" type=\"submit\" name=\"download_zip\" value=\"Télécharger l'archive\" />\n";
echo "</form>\n";
}
require_once "server_files/views/footer.php";

View File

@ -1,43 +1,57 @@
<?php require_once "header.php" ?>
<?php
if ($has_error)
echo "<h2>Erreur : $error_message</h2>";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Tournoi de <?= $tournament->getName() ?></h1>
</div>
<h2>Tournoi de <?= $tournament->getName() ?></h2>
<strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
<?php
$s = "";
/** @var User $orga */
foreach ($orgas as $orga) {
$orga_id = $orga->getId();
$orga_name = $orga->getFirstName() . " " . $orga->getSurname();
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN)
$s .= "<a href=\"/informations/$orga_id/$orga_name\">$orga_name</a>";
else
$s .= $orga_name;
$s .= ", ";
}
echo substr($s, 0, -2);
?>
<br />
<strong>Nombre d'équipes maximal :</strong> <?= $tournament->getSize() ?><br />
<strong>Lieu :</strong> <?= $tournament->getPlace() ?><br />
<strong>Prix par partipant :</strong> <?= $tournament->getPrice() == 0 ? "Gratuit" : $tournament->getPrice() . "" ?><br />
<strong>Dates :</strong> Du <?= formatDate($tournament->getStartDate()) ?> au <?= formatDate($tournament->getEndDate()) ?><br />
<strong>Clôture des inscriptions :</strong> <?= formatDate($tournament->getInscriptionDate(), true) ?><br />
<strong>Date limite d'envoi des solutions :</strong> <?= formatDate($tournament->getSolutionsDate(), true) ?><br />
<strong>Date limite d'envoi des notes de synthèse :</strong> <?= formatDate($tournament->getSynthesesDate(), true) ?><br />
<strong>Description :</strong> <?= $tournament->getDescription() ?><br />
<div class="alert alert-info">
<strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
<?php
$s = "";
/** @var User $orga */
foreach ($orgas as $orga) {
$orga_id = $orga->getId();
$orga_name = $orga->getFirstName() . " " . $orga->getSurname();
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN)
$s .= "<a href=\"/informations/$orga_id/$orga_name\">$orga_name</a>";
else
$s .= $orga_name;
$s .= ", ";
}
echo substr($s, 0, -2);
?>
</div>
<div class="alert alert-info">
<strong>Nombre d'équipes maximal :</strong> <?= $tournament->getSize() ?>
</div>
<div class="alert alert-info">
<strong>Lieu :</strong> <?= $tournament->getPlace() ?>
</div>
<div class="alert alert-info">
<strong>Prix par partipant :</strong> <?= $tournament->getPrice() == 0 ? "Gratuit" : $tournament->getPrice() . "" ?>
</div>
<div class="alert alert-info">
<strong>Dates :</strong> Du <?= formatDate($tournament->getStartDate()) ?> au <?= formatDate($tournament->getEndDate()) ?>
</div>
<div class="alert alert-info">
<strong>Clôture des inscriptions :</strong> <?= formatDate($tournament->getInscriptionDate(), true) ?>
</div>
<div class="alert alert-info">
<strong>Date limite d'envoi des solutions :</strong> <?= formatDate($tournament->getSolutionsDate(), true) ?>
</div>
<div class="alert alert-info">
<strong>Date limite d'envoi des notes de synthèse :</strong> <?= formatDate($tournament->getSynthesesDate(), true) ?>
</div>
<div class="alert alert-info">
<strong>Description :</strong> <?= $tournament->getDescription() ?>
</div>
<?php
if ($tournament->isFinal())
echo "<strong>Ce tournoi est la finale nationale du TFJM² 2020.</strong><br />";
echo "<div class=\"alert alert-info\">\n\t<strong>Ce tournoi est la finale nationale du TFJM² 2020.</strong>\n</div>\n";
?>
<?php if (!isset($_GET["modifier"]) && ($_SESSION["role"] == Role::ADMIN || $_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))) { ?>
<a href="/tournoi/<?= $tournament->getName() ?>/modifier">Éditer le tournoi</a>
<a href="/tournoi/<?= $tournament->getName() ?>/modifier"><button class="btn btn-secondary btn-lg btn-block">Éditer le tournoi</button></a>
<?php } ?>
@ -46,19 +60,19 @@ if ($tournament->isFinal())
<h2>Équipes inscrites à ce tournoi :</h2>
<table style="border: 1px solid black; width: 100%;">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th style="border: 1px solid black; text-align: center">
<th>
Équipe
</th>
<th style="border: 1px solid black; text-align: center">
<th>
Trigramme
</th>
<th style="border: 1px solid black; text-align: center">
<th>
Date d'inscription
</th>
<th style="border: 1px solid black; text-align: center">
<th>
État de validation de l'inscription
</th>
</tr>
@ -69,7 +83,7 @@ if ($tournament->isFinal())
foreach ($teams as $team) {
?>
<tr>
<td style="border: 1px solid black; text-align: center">
<td>
<?php
if (isset($_SESSION["role"]) && ($_SESSION["role"] == Role::ADMIN || ($_SESSION["role"] == Role::ORGANIZER && $tournament->organize($_SESSION["user_id"]))))
echo "<a href=\"/equipe/" . $team->getTrigram() . "\">" . $team->getName(). "</a>";
@ -77,9 +91,9 @@ if ($tournament->isFinal())
echo $team->getName();
?>
</td>
<td style="border: 1px solid black; text-align: center"><?= $team->getTrigram() ?></td>
<td style="border: 1px solid black; text-align: center"><?= formatDate($team->getInscriptionDate()) ?></td>
<td style="border: 1px solid black; text-align: center"><?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?></td>
<td><?= $team->getTrigram() ?></td>
<td><?= formatDate($team->getInscriptionDate()) ?></td>
<td><?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?></td>
</tr>
<?php
}
@ -87,16 +101,16 @@ if ($tournament->isFinal())
</tbody>
<tfoot>
<tr>
<th style="border: 1px solid black; text-align: center">
<th>
Équipe
</th>
<th style="border: 1px solid black; text-align: center">
<th>
Trigramme
</th>
<th style="border: 1px solid black; text-align: center">
<th>
Date d'inscription
</th>
<th style="border: 1px solid black; text-align: center">
<th>
État de validation de l'inscription
</th>
</tr>
@ -108,111 +122,83 @@ if ($tournament->isFinal())
else {
?>
<form method="POST">
<input type="hidden" name="submitted" value="true" />
<table style="width: 100%;">
<tbody>
<tr>
<td style="width: 30%;">
<label for="name">Nom :</label>
</td>
<td style="width: 70%;">
<input style="width: 100%;" type="text" id="name" name="name" value="<?= $tournament->getName() ?>" required />
</td>
</tr>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<tr>
<td>
<label for="organizers">Organisateur :</label>
</td>
<td>
<select style="width: 100%;" id="organizers" name="organizers[]" multiple size="4" required>
<?php
while (($orga_data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $orga_data["id"] . "\" " . ($tournament->organize($orga_data["id"]) ? "selected" : "")
. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
}
?>
</select>
</td>
</tr>
<?php } ?>
<tr>
<td>
<label for="size">Nombre d'équipes :</label>
</td>
<td>
<input style="width: 100%;" type="number" id="size" name="size" min="3" max="12" value="<?= $tournament->getSize() ?>" required />
</td>
</tr>
<tr>
<td>
<label for="place">Lieu :</label>
</td>
<td>
<input style="width: 100%;" type="text" id="place" name="place" value="<?= $tournament->getPlace() ?>" required />
</td>
</tr>
<tr>
<td>
<label for="price">Prix par participant</label>
</td>
<td>
<input style="width: 100%;" type="number" id="price" name="price" min="0" max="50" value="<?= $tournament->getPrice() ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_start">Dates :</label>
</td>
<td>
Du <input style="width: 45%;" type="date" id="date_start" name="date_start" value="<?= $tournament->getStartDate() ?>" required />
au <input style="width: 45%;" type="date" id="date_end" name="date_end" value="<?= $tournament->getEndDate() ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_inscription">Date limite d'inscription :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_inscription" name="date_inscription" value="<?= substr($tournament->getInscriptionDate(), 0, 10) ?>" required />
<input style="width: 49%;" type="time" id="time_inscription" name="time_inscription" value="<?= substr($tournament->getInscriptionDate(), 11) ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_solutions">Date limite pour rendre les solutions :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_solutions" name="date_solutions" value="<?= substr($tournament->getSolutionsDate(), 0, 10) ?>" required />
<input style="width: 49%;" type="time" id="time_solutions" name="time_solutions" value="<?= substr($tournament->getSolutionsDate(),11) ?>" required />
</td>
</tr>
<tr>
<td>
<label for="date_syntheses">Date limite pour rendre les notes de synthèse :</label>
</td>
<td>
<input style="width: 49%;" type="date" id="date_syntheses" name="date_syntheses"
value="<?= substr($tournament->getSynthesesDate(), 0, 10) ?>" required/>
<input style="width: 49%;" type="time" id="time_syntheses" name="time_syntheses"
value="<?= substr($tournament->getSynthesesDate(), 11) ?>" required/>
</td>
</tr>
<tr>
<td>
<label for="description">Description :</label>
</td>
<td>
<textarea style="width: 100%;" name="description" id="description" required><?= $tournament->getDescription() ?></textarea>
</td>
</tr>
<tr>
<td colspan="2">
<input style="width: 100%;" type="submit" name="edit_tournament" value="Modifier le tournoi" />
</td>
</tr>
</tbody>
</table>
<div class="form-row">
<label for="name">Nom :</label>
<input class="form-control" type="text" id="name" name="name" value="<?= $tournament->getName() ?>" required/>
</div>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<div class="form-row">
<label for="organizers">Organisateur·s :</label>
<select class="custom-select" id="organizers" name="organizers[]" multiple size="4" required>
<?php
while (($orga_data = $orgas_response->fetch()) !== FALSE) {
echo "<option value=\"" . $orga_data["id"] . "\" " . ($tournament->organize($orga_data["id"]) ? "selected" : "")
. ">" . $orga_data["first_name"] . " " . $orga_data["surname"] . "</option>\n";
}
?>
</select>
</div>
<?php } ?>
<div class="form-row">
<div class="form-group col-md-4">
<label for="size">Nombre d'équipes :</label>
<input class="form-control" type="number" id="size" name="size" min="3" max="12" value="<?= $tournament->getSize() ?>" required/>
</div>
<div class="form-group col-md-4">
<label for="place">Lieu :</label>
<input class="form-control" type="text" id="place" name="place" value="<?= $tournament->getPlace() ?>" required/>
</div>
<div class="form-group col-md-4">
<label for="price">Prix par participant</label>
<input class="form-control" type="number" id="price" name="price" min="0" max="50" value="<?= $tournament->getPrice() ?>" required />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="date_start">Date de début de tournoi :</label>
<input class="form-control" type="date" id="date_start" name="date_start" value="<?= $tournament->getStartDate() ?>" required />
</div>
<div class="form-group col-md-6">
<label for="date_end">Date de fin de tournoi :</label>
<input class="form-control" type="date" id="date_end" name="date_end" value="<?= $tournament->getEndDate() ?>" required />
</div>
</div>
<div class="form-row">
<div class="form-group col-md-4">
<label for="date_inscription">Date limite d'inscription :</label>
<input class="form-control" type="date" id="date_inscription" name="date_inscription" value="<?= substr($tournament->getInscriptionDate(), 0, 10) ?>" required />
<input class="form-control" type="time" id="time_inscription" name="time_inscription" value="<?= substr($tournament->getInscriptionDate(), 11) ?>" required />
</div>
<div class="form-group col-md-4">
<label for="date_solutions">Date limite pour rendre les solutions :</label>
<input class="form-control" type="date" id="date_solutions" name="date_solutions" value="<?= substr($tournament->getSolutionsDate(), 0, 10) ?>" required />
<input class="form-control" type="time" id="time_solutions" name="time_solutions" value="<?= substr($tournament->getSolutionsDate(),11) ?>" required />
</div>
<div class="form-group col-md-4">
<label for="date_syntheses">Date limite pour rendre les notes de synthèse :</label>
<input class="form-control" type="date" id="date_syntheses" name="date_syntheses"
value="<?= substr($tournament->getSynthesesDate(), 0, 10) ?>" required/>
<input class="form-control" type="time" id="time_syntheses" name="time_syntheses"
value="<?= substr($tournament->getSynthesesDate(), 11) ?>" required/>
</div>
</div>
<div class="form-row">
<div class="form-group col-md-12">
<label for="description">Description :</label>
<textarea class="form-control" name="description" id="description" required><?= $tournament->getDescription() ?></textarea>
</div>
</div>
<input class="btn btn-primary btn-lg btn-block" type="submit" name="edit_tournament" value="Modifier le tournoi" />
</form>
<?php } ?>