Design "Équipe" et "Problème"

This commit is contained in:
Yohann 2019-09-25 23:20:05 +02:00
parent 6bb27034ce
commit 7a585e33e1
3 changed files with 98 additions and 59 deletions

View File

@ -1,45 +1,70 @@
<?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/>
Problème : <a href="/probleme/<?= $team->getProblem() ?>"><?= $team->getProblem() ?></a><br/>
<?php
if ($team->getEncadrantId() !== null) {
$encadrant = User::fromId($team->getEncadrantId());
$id = $encadrant->getId();
echo "Encadrant : <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><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 "Participant $i : <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
}
?>
Autorise Animath à diffuser les vidéos : <?= $team->allowPublish() ? "oui" : "non" ?>
<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>Problème :</strong> <a href="/probleme/<?= $team->getProblem() ?>"><?= $team->getProblem() ?></a>
</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
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 />";
}
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 />";
}
?>
</div>
<div class="alert alert-info">
<strong>Autorise Animath à diffuser les vidéos :</strong> <?= $team->allowPublish() ? "oui" : "non" ?>
</div>
<?php
if ($_SESSION["role"] == Role::ADMIN) { ?>
<hr />
<hr/>
<form method="POST">
<label for="other_teams">L'équipe va recevoir les questions des équipes suivantes (merci d'en sélectionner exactement 2) :</label>
<select id="other_teams" name="other_teams[]" multiple>
<?php
/** @var Team $other_team */
foreach ($other_teams as $other_team) {
if ($other_team->getId() == $team->getId())
continue;
<div class="form-group row">
<div class="form-group col-md-12">
<label for="other_teams">L'équipe va recevoir les questions des équipes suivantes (merci d'en
sélectionner
exactement 2) :</label>
<select class="custom-select" id="other_teams" name="other_teams[]" multiple>
<?php
/** @var Team $other_team */
foreach ($other_teams as $other_team) {
if ($other_team->getId() == $team->getId())
continue;
$team_name = $other_team->getName() . " (" . $other_team->getTrigram() . ")";
$team_id = $other_team->getId();
echo "<option value=\"$team_id\" " . (in_array($other_team->getId(), $team->getVideoTeamIds()) ? "selected" : "") . ">$team_name</option>\n";
}
?>
</select>
<input type="submit" name="update_video_teams" value="Mettre à jour" />
$team_name = $other_team->getName() . " (" . $other_team->getTrigram() . ")";
$team_id = $other_team->getId();
echo "<option value=\"$team_id\" " . (in_array($other_team->getId(), $team->getVideoTeamIds()) ? "selected" : "") . ">$team_name</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-group row">
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="update_video_teams"
value="Mettre à jour"/>
</div>
</form>
<?php } ?>
@ -50,15 +75,16 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
<?php printDocuments($documents) ?>
<form method="POST">
<input type="submit" name="download_zip" value="Télécharger l'archive"/>
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="download_zip"
value="Télécharger l'archive"/>
</form>
<?php if ($team->getValidationStatus() == ValidationStatus::WAITING && $_SESSION["role"] == Role::ADMIN) { ?>
<hr />
<hr/>
<form method="POST">
<input type="submit" name="validate" value="Valider l'équipe"/>
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="validate" value="Valider l'équipe"/>
</form>
<?php
<?php
}
require_once "footer.php" ?>

View File

@ -10,6 +10,14 @@
<!-- Bootstrap -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<style>
ul .deroule {
display: none;
}
li:hover ul.deroule {display:block;}
</style>
</head>
<body>
@ -69,6 +77,15 @@
<?php } ?>
<?php } ?>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<li>
Liste des problèmes
<ul class="deroule">
<li><a href="/probleme/1">Problème 1</a></li>
<li><a href="/probleme/2">Problème 2</a></li>
<li><a href="/probleme/3">Problème 3</a></li>
<li><a href="/probleme/4">Problème 4</a></li>
</ul>
</li>
<li class="nav-item active"><a class="nav-link" href="/ajouter-admin">
Ajouter un administrateur</a>
</li>

View File

@ -1,30 +1,26 @@
<?php require_once "header.php" ?>
<?php
if ($has_error)
echo "<h2>Erreur : $error_message</h2>";
?>
<h2>Problème <?= $problem ?></h2>
<div class="mt-4 mb-4">
<h2 class="display-3">Problème <?= $problem ?></h2>
</div>
<hr/>
<h2>Équipes inscrites pour ce problème :</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 scope="col">
Équipe
</th>
<th style="border: 1px solid black; text-align: center">
<th scope="col">
Trigramme
</th>
<th style="border: 1px solid black; text-align: center">
<th scope="col">
Date d'inscription
</th>
<th style="border: 1px solid black; text-align: center">
<th scope="col">
État de validation de l'inscription
</th>
</tr>
@ -35,17 +31,17 @@ if ($has_error)
foreach ($teams as $team) {
?>
<tr>
<td style="border: 1px solid black; text-align: center">
<th scope="row">
<?php
if (isset($_SESSION["role"]) && $_SESSION["role"] == Role::ADMIN)
echo "<a href=\"/equipe/" . $team->getTrigram() . "\">" . $team->getName() . "</a>";
else
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>
</th>
<td><?= $team->getTrigram() ?></td>
<td><?= formatDate($team->getInscriptionDate()) ?></td>
<td><?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?></td>
</tr>
<?php
}
@ -53,16 +49,16 @@ if ($has_error)
</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>