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

View File

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

View File

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