Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yohann 2019-09-30 15:20:50 +02:00
commit e8340f2d2e
29 changed files with 800 additions and 580 deletions

View File

@ -6,3 +6,20 @@
height: var(--navbar-height); height: var(--navbar-height);
display: block; 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

@ -48,8 +48,10 @@ $ROUTES["^mon-compte/?$"] = ["server_files/controllers/mon_compte.php"];
$ROUTES["^mon-equipe/(diffusion-videos)/?$"] = ["server_files/controllers/mon_equipe.php", "publish_videos"]; $ROUTES["^mon-equipe/(diffusion-videos)/?$"] = ["server_files/controllers/mon_equipe.php", "publish_videos"];
$ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"]; $ROUTES["^mon-equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
$ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"]; $ROUTES["^mon-equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
$ROUTES["^mon-tournoi/?$"] = ["server_files/controllers/mon_tournoi.php"];
$ROUTES["^poser-questions-2$"] = ["server_files/controllers/poser_questions.php"]; $ROUTES["^poser-questions-2$"] = ["server_files/controllers/poser_questions.php"];
$ROUTES["^probleme/([1-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"]; $ROUTES["^probleme/([1-4])/?$"] = ["server_files/controllers/probleme.php", "probleme"];
$ROUTES["^profils-orphelins/?$"] = ["server_files/controllers/profils_orphelins.php"];
$ROUTES["^rejoindre-equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"]; $ROUTES["^rejoindre-equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
$ROUTES["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"]; $ROUTES["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"];
$ROUTES["^videos-solutions/?$"] = ["server_files/controllers/videos_solutions.php"]; $ROUTES["^videos-solutions/?$"] = ["server_files/controllers/videos_solutions.php"];

View File

@ -79,9 +79,9 @@ class Question
null, null,
null, null,
null]; null];
for ($_ = 0; $_ < 6; ++$_) { for ($i = 0; $i < 6; ++$i) {
$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `question`) VALUES (?, ?, ?, ?);"); $req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `number`, `question`) VALUES (?, ?, ?, ?, ?);");
$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $default_questions[$_]]); $req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, $default_questions[$i]]);
} }
return self::getQuestions($from, $to); return self::getQuestions($from, $to);
} }

View File

@ -73,7 +73,7 @@ class Team
public static function getAllTeams($problem) public static function getAllTeams($problem)
{ {
global $DB, $YEAR; global $DB, $YEAR;
$req = $DB->prepare("SELECT * FROM `teams` WHERE `problem` = ? AND `year` = $YEAR;"); $req = $DB->prepare("SELECT * FROM `teams` WHERE " . ($problem <= 0 ? "" : "`problem` = ? AND ") . "`year` = $YEAR;");
$req->execute([htmlspecialchars($problem)]); $req->execute([htmlspecialchars($problem)]);
$teams = []; $teams = [];
@ -96,7 +96,7 @@ class Team
$this->encadrant = $data["encadrant"]; $this->encadrant = $data["encadrant"];
$this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"]]; $this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"]];
$this->inscription_date = $data["inscription_date"]; $this->inscription_date = $data["inscription_date"];
$this->allow_publish = $data["allow_publish"]; $this->allow_publish = $data["allow_publish"] ? 1 : 0;
$this->validation_status = ValidationStatus::fromName($data["validation_status"]); $this->validation_status = ValidationStatus::fromName($data["validation_status"]);
$this->video_team_ids = [$data["video_team1"], $data["video_team2"]]; $this->video_team_ids = [$data["video_team1"], $data["video_team2"]];
$this->access_code = $data["access_code"]; $this->access_code = $data["access_code"];

View File

@ -54,7 +54,7 @@ class User
{ {
global $DB, $YEAR; global $DB, $YEAR;
$admins = []; $admins = [];
$req = $DB->query("SELECT * FROM `users` WHERE `year` = $YEAR;"); $req = $DB->query("SELECT * FROM `users` WHERE `role` = 'ADMIN' AND `year` = $YEAR;");
while (($data = $req->fetch()) !== false) { while (($data = $req->fetch()) !== false) {
$admin = new User(); $admin = new User();
@ -64,6 +64,21 @@ class User
return $admins; return $admins;
} }
public static function getOrphanUsers()
{
global $DB, $YEAR;
$orphans = [];
$req = $DB->query("SELECT * FROM `users` WHERE `role` != 'ADMIN' AND `team_id` IS NULL AND `year` = $YEAR ORDER BY `role`, `inscription_date`;");
while (($data = $req->fetch()) !== false) {
$orphan = new User();
$orphan->fill($data);
$orphans[] = $orphan;
}
return $orphans;
}
private function fill($data) private function fill($data)
{ {

View File

@ -32,7 +32,7 @@ class NewTeam {
$this->trigram = strtoupper($this->trigram); $this->trigram = strtoupper($this->trigram);
$this->allow_publish = $this->allow_publish == "on"; $this->allow_publish = $this->allow_publish == "on" ? 1 : 0;
} }
public function makeVerifications() { public function makeVerifications() {

View File

@ -7,10 +7,10 @@ if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::PARTICIPANT && $_
require_once "server_files/403.php"; require_once "server_files/403.php";
if (isset($_POST["upload_answer"])) { if (isset($_POST["upload_answer"])) {
$new_video = new NewAnswer($_POST); $new_answer = new NewAnswer($_POST);
try { try {
$new_video->makeVerifications(); $new_answer->makeVerifications();
$new_video->uploadVideo(); $new_answer->uploadVideo();
} catch (AssertionError $e) { } catch (AssertionError $e) {
$has_error = true; $has_error = true;
$error_message = $e->getMessage(); $error_message = $e->getMessage();

View File

@ -54,6 +54,7 @@ class UpdateVideoTeams
public function makeVerifications() public function makeVerifications()
{ {
ensure(Phase::getCurrentPhase() < Phase::PHASE2, "Il est trop tard pour réaffecter les vidéos aux équipes.");
ensure(sizeof($this->other_teams) == 2, "L'équipe doit recevoir exactement deux vidéos."); ensure(sizeof($this->other_teams) == 2, "L'équipe doit recevoir exactement deux vidéos.");
ensure(Team::fromId($this->other_teams[0]) != null, "La première équipe n'existe pas."); ensure(Team::fromId($this->other_teams[0]) != null, "La première équipe n'existe pas.");
ensure(Team::fromId($this->other_teams[1]) != null, "La seconde équipe n'existe pas."); ensure(Team::fromId($this->other_teams[1]) != null, "La seconde équipe n'existe pas.");

View File

@ -16,6 +16,77 @@ if ($user === null)
$team = Team::fromId($user->getTeamId()); $team = Team::fromId($user->getTeamId());
$has_error = false;
$error_message = null;
if (isset($_POST["kick"])) {
if ($team == null) {
$has_error = true;
$error_message = "La personne à expulser n'est dans aucune équipe.";
}
else {
quitTeam($id);
$team = null;
}
}
if (isset($_POST["attribute_team"])) {
$attribute_team = new AttributeTeam($_POST);
try {
$attribute_team->makeVerifications();
$attribute_team->attribute();
} catch (AssertionError $e) {
$has_error = true;
$error_message = $e->getMessage();
}
}
class AttributeTeam
{
private $team;
private $min_null_index;
public function __construct($data)
{
$this->team = Team::fromId($data["team"]);
}
public function makeVerifications()
{
global $user;
ensure($this->team != null, "Cette équipe n'existe pas.");
ensure($this->team->getValidationStatus() == ValidationStatus::NOT_READY, "Cette équipe est déjà validée ou en cours de validation.");
$role = $user->getRole();
for ($i = 1; $i <= $role == Role::ENCADRANT ? 1 : 5; ++$i) {
if (($role == Role::PARTICIPANT ? $this->team->getParticipants()[$i - 1] : $this->team->getEncadrantId()) == NULL)
break;
}
$this->min_null_index = $i;
ensure($role == Role::PARTICIPANT && $this->min_null_index <= 5 || $role == Role::ENCADRANT && $this->min_null_index <= 2,
"Il n'y a plus de place pour vous dans l'équipe.");
}
public function attribute()
{
global $user, $team;
$user->setTeamId($this->team->getId());
if ($user->getRole() == Role::ENCADRANT)
$this->team->setEncadrant($user->getId());
else
$this->team->setParticipant($this->min_null_index, $user->getId());
Mailer::sendJoinTeamMail($user, $this->team);
$team = $this->team;
}
}
if ($team != null) if ($team != null)
$documents = $user->getAllDocuments($team->getProblem()); $documents = $user->getAllDocuments($team->getProblem());

View File

@ -58,8 +58,6 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
$team = $_SESSION["team"]; $team = $_SESSION["team"];
$documents = $user->getAllDocuments($team->getProblem()); $documents = $user->getAllDocuments($team->getProblem());
$video = Video::getVideo(Reason::SOLUTION, $team);
$questions_received = Question::getQuestionsTo($team);
} }
else else
require_once "server_files/403.php"; require_once "server_files/403.php";

View File

@ -0,0 +1,17 @@
<?php
if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"] !== null) {
/**
* @var User $user
* @var Team $team
*/
$user = $_SESSION["user"];
$team = $_SESSION["team"];
$video = Video::getVideo(Reason::SOLUTION, $team);
$questions_received = Question::getQuestionsTo($team);
}
else
require_once "server_files/403.php";
require_once "server_files/views/mon_tournoi.php";

View File

@ -0,0 +1,8 @@
<?php
if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::ADMIN)
require_once "server_files/403.php";
$orphan_users = User::getOrphanUsers();
require_once "server_files/views/profils_orphelins.php";

View File

@ -21,15 +21,16 @@ function loadUserValues()
} }
} }
function quitTeam() function quitTeam($user_id = -1)
{ {
global $DB, $URL_BASE; global $DB, $URL_BASE;
header("Location: $URL_BASE"); if ($user_id == -1)
header("Location: $URL_BASE");
$user_id = $user_id >= 0 ? $user_id : $_SESSION["user_id"];
/** @var User $user */ /** @var User $user */
$user = $_SESSION["user"]; $user = User::fromId($user_id);
$user_id = $user->getId();
$role = $user->getRole(); $role = $user->getRole();
if ($role == Role::ADMIN) if ($role == Role::ADMIN)
@ -47,7 +48,7 @@ function quitTeam()
$DB->exec("UPDATE `teams` SET `participant_$i` = `participant_" . strval($i + 1) . "`, `participant_" . strval($i + 1) . "` = NULL WHERE `participant_$i` IS NULL;"); $DB->exec("UPDATE `teams` SET `participant_$i` = `participant_" . strval($i + 1) . "`, `participant_" . strval($i + 1) . "` = NULL WHERE `participant_$i` IS NULL;");
} }
$DB->exec("DELETE FROM `teams` WHERE `encadrant` IS NULL OR `participant_1` IS NULL;"); $DB->exec("DELETE FROM `teams` WHERE `encadrant` IS NULL AND `participant_1` IS NULL;");
$req = $DB->query("SELECT `file_id` FROM `documents` WHERE `user` = $user_id;"); $req = $DB->query("SELECT `file_id` FROM `documents` WHERE `user` = $user_id;");
while (($data = $req->fetch()) !== false) while (($data = $req->fetch()) !== false)
unlink("$URL_BASE/files/" . $data["file_id"]); unlink("$URL_BASE/files/" . $data["file_id"]);

View File

@ -45,11 +45,9 @@ require_once "header.php";
</select> </select>
</div> </div>
<div class="form-row"> <label for="allow_publish">J'accepte qu'Animath diffuse mes vidéos à la fin du tournoi (<em>facultatif</em>) :</label>
<label for="allow_publish">J'accepte qu'Animath diffuse mes vidéos à la fin du tournoi (<em>facultatif</em>) :</label> <input type="checkbox" id="allow_publish" name="allow_publish"
<input class="form-control" type="checkbox" id="allow_publish" name="allow_publish"
<?= isset($new_team) && $new_team->allow_publish ? "checked" : "" ?> /> <?= isset($new_team) && $new_team->allow_publish ? "checked" : "" ?> />
</div>
<div class="form-group row"> <div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="add_team" type="submit" value="Ajouter une équipe"/> <input class="btn btn-primary btn-lg btn-block" name="add_team" type="submit" value="Ajouter une équipe"/>

View File

@ -96,8 +96,8 @@
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE1 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE1 ? "warning" : "success") ?>"> <div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE1 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE1 ? "warning" : "success") ?>">
<?= Phase::getTranslatedName(Phase::PHASE1) ?> : <?= Phase::getTranslatedName(Phase::PHASE1) ?> :
Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au Du <strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong> <strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong>
</div> </div>
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE2 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE2 ? "warning" : "success") ?>"> <div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE2 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE2 ? "warning" : "success") ?>">

View File

@ -1,6 +1,18 @@
<?php <?php
require_once "header.php"; require_once "header.php";
?>
<div class="mt-4 mb-4">
<h1 class="display-4">Répondre aux questions</h1>
</div>
<?php if (isset($new_answer) && !$has_error) { ?>
<div class="alert alert-success">
Votre vidéo a bien été envoyée !
</div>
<?php } ?>
<?php
for ($i = 0; $i < 2; ++$i) { for ($i = 0; $i < 2; ++$i) {
/** @var Team $answer_team */ /** @var Team $answer_team */
$answer_team = $teams[$i]; $answer_team = $teams[$i];
@ -13,13 +25,15 @@ for ($i = 0; $i < 2; ++$i) {
/** @var Question[] $questions */ /** @var Question[] $questions */
$questions = Question::getQuestions($team, $answer_team); $questions = Question::getQuestions($team, $answer_team);
?> ?>
<h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2> <div class="jumbotron">
<h5>Lien de la vidéo de présentation de la solution au problème : <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a></h5> <h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2>
<?php displayVideo($sol->getLink()) ?> <div class="alert alert-info">
<strong>Lien de la vidéo de présentation de la solution au problème :</strong>
<a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a>
</div>
<?php displayVideo($sol->getLink()) ?>
<h5>Questions échangées :</h5> <h5>Questions échangées :</h5>
<table >
<tbody>
<?php <?php
for ($j = 0; $j < 6; ++$j) { for ($j = 0; $j < 6; ++$j) {
/** @var Question $question */ /** @var Question $question */
@ -27,105 +41,66 @@ for ($i = 0; $i < 2; ++$i) {
if ($question->getQuestion() === null) if ($question->getQuestion() === null)
continue; continue;
?> ?>
<tr> <div class="alert alert-info">
<td> <strong>Question <?= $question->getNumber() + 1 ?> :</strong> <?= $question->getQuestion() ?><br />
Question <?= $question->getNumber() ?> : <?php
</td> if ($question->getAttachedFile() !== null) { ?>
<td> <em>Pièce jointe attachée :</em>
<?= $question->getQuestion() ?> <a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br />
</td> <?php } ?>
</tr> <strong>Réponse :</strong> <?= $question->getAnswer() ?><br />
<?php <?php
if ($question->getAttachedFile() !== null) { ?> if ($question->getAttachedFile() !== null) { ?>
<tr> <em>Pièce jointe attachée :</em>
<td> <a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a><br />
<em>Pièce jointe attachée :</em> <?php } ?>
</td> </div>
<td>
<a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<tr>
<td>
Réponse :
</td>
<td>
<?= $question->getAnswer() ?>
</td>
</tr>
<?php
if ($question->getAttachedFileAnswer() !== null) { ?>
<tr>
<td>
<em>Pièce jointe attachée :</em>
</td>
<td>
<a href="/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<?php } ?> <?php } ?>
</tbody> <br/>
</table> <h5>Vidéo de réponse :</h5>
<br />
<h5>Vidéo de réponse :</h5>
<?php <?php
if ($answer !== null) { if ($answer !== null) {
$link = $answer->getLink(); $link = $answer->getLink();
echo "Lien de la vidéo déjà envoyée : <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")<br />\n"; echo "<div class=\"alert alert-info\"><strong>Lien de la vidéo déjà envoyée :</strong> <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")</div>\n";
displayVideo($link); displayVideo($link);
switch ($answer->getValidation()) { switch ($answer->getValidation()) {
case 0: case 0:
echo "La vidéo n'a pas encore été contrôlée.<br />"; echo "<div class=\"alert alert-warning\">La vidéo n'a pas encore été contrôlée.</div>";
break; break;
case 1: case 1:
echo "La vidéo a été acceptée.<br />"; echo "<div class=\"alert alert-success\">La vidéo a été acceptée.</div>";
break; break;
case -1: case -1:
echo "La vidéo a été rejetée.<br />"; echo "<div class=\"alert alert-danger\">La vidéo a été rejetée.</div>";
break; break;
}
} }
} if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) {
if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) { $link = $answer_validated->getLink();
$link = $answer_validated->getLink(); echo "<hr />\n<div class=\"alert alert-info\">Lien de la dernière vidéo validée : <a href=\"$link\">$link</a></div>\n";
echo "<hr />\nLien de la dernière vidéo validée : <a href=\"$link\">$link</a><br />"; displayVideo($link);
displayVideo($link); }
} ?>
?>
<form method="POST"> <form method="POST">
<input type="hidden" name="team" value="<?= $i + 1 ?>" /> <input type="hidden" name="team" value="<?= $i + 1 ?>"/>
<table > <div class="form-row">
<tbody> <div class="form-group col-md-12">
<tr> <label for="link_<?= $i ?>">Lien de la vidéo à soumettre :</label>
<td style="width: 30%;"> <input class="form-control" type="url" id="link_<?= $i ?>" name="link"/>
<label for="link">Lien de la vidéo à soumettre :</label> </div>
</td> </div>
<td style="width: 70%;">
<input type="url" id="link" name="link" /> <input type="checkbox" name="valid_link" id="valid_link_<?= $i ?>" required/> <label for="valid_link_<?= $i ?>">Je
</td> confirme que le lien est valide</label><br/>
</tr>
<tr> <input type="checkbox" name="no_change" id="no_change_<?= $i ?>" required/> <label for="no_change_<?= $i ?>">Je m'engage
<td style="text-align: center;" colspan="2"> à ne pas changer le contenu du lien et de la vidéo</label>
<input type="checkbox" name="valid_link" id="valid_link" required /> <label for="valid_link">Je confirme que le lien est valide</label>
</td> <input class="btn btn-primary btn-lg btn-block" type="submit" name="upload_answer" value="Envoyer la vidéo"/>
</tr> </form>
<tr> </div>
<td style="text-align: center;" colspan="2">
<input type="checkbox" name="no_change" id="no_change" required /> <label for="no_change">Je m'engage à ne pas changer le contenu du lien et de la vidéo</label>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="upload_answer" value="Envoyer la vidéo" />
</td>
</tr>
</tbody>
</table>
</form>
<hr />
<?php <?php
} }

View File

@ -1,63 +1,59 @@
<?php <?php
require_once "header.php"; require_once "header.php";
if (isset($new_video) && !$has_error)
echo "<h2>Votre vidéo a bien été envoyée !</h2>";
?> ?>
<div class="mt-4 mb-4">
<h1 class="display-4">Envoyer la vidéo de solution</h1>
</div>
<?php if (isset($new_video) && !$has_error) { ?>
<div class="alert alert-success">
Votre vidéo a bien été envoyée !
</div>
<?php } ?>
<?php <?php
if ($video !== null) { if ($video !== null) {
$link = $video->getLink(); $link = $video->getLink();
echo "Lien de la vidéo déjà envoyée : <a href=\"$link\">$link</a> (version " . $video->getVersion() . ")<br />\n"; echo "<div class=\"alert alert-info\"><strong>Lien de la vidéo déjà envoyée :</strong> <a href=\"$link\">$link</a> (version " . $video->getVersion() . ")</div>\n";
displayVideo($link); displayVideo($link);
switch ($video->getValidation()) { switch ($video->getValidation()) {
case 0: case 0:
echo "La vidéo n'a pas encore été contrôlée.<br />"; echo "<div class=\"alert alert-warning\">La vidéo n'a pas encore été contrôlée.</div>";
break; break;
case 1: case 1:
echo "La vidéo a été acceptée.<br />"; echo "<div class=\"alert alert-success\">La vidéo a été acceptée.</div>";
break; break;
case -1: case -1:
echo "La vidéo a été rejetée.<br />"; echo "<div class=\"alert alert-danger\">La vidéo a été rejetée.</div>";
break; break;
} }
} }
if ($video_validated != null && $video_validated->getId() != $video->getId()) { if ($video_validated != null && $video_validated->getId() != $video->getId()) {
$link = $video_validated->getLink(); $link = $video_validated->getLink();
echo "<hr />\nLien de la dernière vidéo validée : <a href=\"$link\">$link</a><br />"; echo "<hr />\n<div class=\"alert alert-info\">Lien de la dernière vidéo validée : <a href=\"$link\">$link</a></div>\n";
displayVideo($link); displayVideo($link);
} }
?> ?>
<form method="POST"> <hr/>
<table >
<tbody> <form method="POST">
<tr> <div class="form-row">
<td style="width: 30%;"> <div class="form-group col-md-12">
<label for="link">Lien de la vidéo à soumettre :</label> <label for="link">Lien de la vidéo à soumettre :</label>
</td> <input class="form-control" type="url" id="link" name="link"/>
<td style="width: 70%;"> </div>
<input type="url" id="link" name="link" /> </div>
</td>
</tr> <input type="checkbox" name="valid_link" id="valid_link" required/> <label for="valid_link">Je
<tr> confirme que le lien est valide</label><br/>
<td style="text-align: center;" colspan="2">
<input type="checkbox" name="valid_link" id="valid_link" required /> <label for="valid_link">Je confirme que le lien est valide</label> <input type="checkbox" name="no_change" id="no_change" required/> <label for="no_change">Je m'engage
</td> à ne pas changer le contenu du lien et de la vidéo</label>
</tr>
<tr> <input class="btn btn-primary btn-lg btn-block" type="submit" name="upload" value="Envoyer la vidéo"/>
<td style="text-align: center;" colspan="2"> </form>
<input type="checkbox" name="no_change" id="no_change" required /> <label for="no_change">Je m'engage à ne pas changer le contenu du lien et de la vidéo</label>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="upload" value="Envoyer la vidéo" />
</td>
</tr>
</tbody>
</table>
</form>
<?php require_once "footer.php"; <?php require_once "footer.php";

View File

@ -18,20 +18,20 @@
:</strong> <?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?> :</strong> <?= ValidationStatus::getTranslatedName($team->getValidationStatus()) ?>
</div> </div>
<div class="alert alert-info"> <div class="alert alert-info">
<?php <?php
if ($team->getEncadrantId() !== null) { if ($team->getEncadrantId() !== null) {
$encadrant = User::fromId($team->getEncadrantId()); $encadrant = User::fromId($team->getEncadrantId());
$id = $encadrant->getId(); $id = $encadrant->getId();
echo "<strong>Encadrant :</strong> <a href=\"$URL_BASE/informations/$id/" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "\">" . $encadrant->getFirstName() . " " . $encadrant->getSurname() . "</a><br />"; 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) { for ($i = 1; $i <= 5; ++$i) {
if ($team->getParticipants()[$i - 1] == NULL) if ($team->getParticipants()[$i - 1] == NULL)
continue; continue;
$participant = User::fromId($team->getParticipants()[$i - 1]); $participant = User::fromId($team->getParticipants()[$i - 1]);
$id = $participant->getId(); $id = $participant->getId();
echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />"; echo "<strong>Participant $i :</strong> <a href=\"$URL_BASE/informations/$id/" . $participant->getFirstName() . " " . $participant->getSurname() . "\">" . $participant->getFirstName() . " " . $participant->getSurname() . "</a><br />";
} }
?> ?>
</div> </div>
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Autorise Animath à diffuser les vidéos :</strong> <?= $team->allowPublish() ? "oui" : "non" ?> <strong>Autorise Animath à diffuser les vidéos :</strong> <?= $team->allowPublish() ? "oui" : "non" ?>
@ -40,32 +40,38 @@
<?php <?php
if ($_SESSION["role"] == Role::ADMIN) { ?> if ($_SESSION["role"] == Role::ADMIN) { ?>
<hr/> <hr/>
<form method="POST"> <? if ($team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
<div class="form-group row"> <!--suppress HtmlUnknownTarget -->
<div class="form-group col-md-12"> <a href="/videos-solutions#team-<?= $team->getTrigram() ?>"><button class="btn btn-primary btn-lg btn-block">
<label for="other_teams">L'équipe va recevoir les questions des équipes suivantes (merci d'en Aller aux vidéos de l'équipe</button></a><br />
sélectionner <form method="POST">
exactement 2) :</label> <div class="form-group row">
<select class="custom-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 exactement 2) :</label>
foreach ($other_teams as $other_team) { <select class="custom-select" id="other_teams" name="other_teams[]" multiple <?= Phase::getCurrentPhase() >= Phase::PHASE2 ? "disabled" : "" ?>>
if ($other_team->getId() == $team->getId()) <?php
continue; /** @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>
</div>
</div> </div>
</div> <div class="form-group row">
<div class="form-group row"> <?php if (Phase::getCurrentPhase() < Phase::PHASE2) { ?>
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="update_video_teams" <input type="submit" class="btn btn-secondary btn-lg btn-block" name="update_video_teams"
value="Mettre à jour"/> value="Mettre à jour"/>
</div> <?php } ?>
</form> </div>
</form>
<?php } ?>
<?php } ?> <?php } ?>
<hr/> <hr/>
@ -84,12 +90,13 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
<form method="POST"> <form method="POST">
<div class="form-group"> <div class="form-group">
<div class="form-group row col-mod-6"> <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-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"/> <input type="submit" class="btn btn-primary btn-lg btn-block" name="validate" value="Valider l'équipe"/>
</div> </div>
</div> </div>
</form> </form>
<?php <?php
} }
require_once "footer.php" ?> require_once "footer.php" ?>

View File

@ -1,3 +1,5 @@
<div class="mt-4 mb-4">
</div>
</div> </div>
</body> </body>
</html> </html>

View File

@ -10,14 +10,6 @@
<!-- 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>
@ -51,7 +43,9 @@
<?php } <?php }
} else { ?> } else { ?>
<li class="nav-item active"><a class="nav-link" href="/mon-equipe">Mon équipe</a></li> <li class="nav-item active"><a class="nav-link" href="/mon-equipe">Mon équipe</a></li>
<?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED) { <?php if ($_SESSION["team"]->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
<li class="nav-item active"><a class="nav-link" href="/mon-tournoi">Mon tournoi</a></li>
<?php
switch (Phase::getCurrentPhase()) { switch (Phase::getCurrentPhase()) {
case Phase::PHASE1: ?> case Phase::PHASE1: ?>
<li class="nav-item active"><a class="nav-link" href="/envoyer-video-1"> <li class="nav-item active"><a class="nav-link" href="/envoyer-video-1">
@ -77,17 +71,18 @@
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>
<?php if ($_SESSION["role"] == Role::ADMIN) { ?> <?php if ($_SESSION["role"] == Role::ADMIN) { ?>
<li> <li class="nav-item active">
Liste des problèmes <a class="nav-link">Liste des équipes</a>
<ul class="deroule"> <ul class="deroule">
<li><a href="/probleme/1">Problème 1</a></li> <li class="nav-item active"><a class="nav-link" href="/probleme/1">Problème 1</a></li>
<li><a href="/probleme/2">Problème 2</a></li> <li class="nav-item active"><a class="nav-link" href="/probleme/2">Problème 2</a></li>
<li><a href="/probleme/3">Problème 3</a></li> <li class="nav-item active"><a class="nav-link" href="/probleme/3">Problème 3</a></li>
<li><a href="/probleme/4">Problème 4</a></li> <li class="nav-item active"><a class="nav-link" href="/probleme/4">Problème 4</a></li>
<li class="nav-item active"><a class="nav-link" href="/profils-orphelins">Profils orphelins</a></li>
</ul> </ul>
</li> </li>
<li class="nav-item active"><a class="nav-link" href="/ajouter-admin"> <li class="nav-item active">
Ajouter un administrateur</a> <a class="nav-link" href="/ajouter-admin">Ajouter un administrateur</a>
</li> </li>
<li class="nav-item active"> <li class="nav-item active">
<a class="nav-link" href="/videos-solutions">Vidéos des solutions</a> <a class="nav-link" href="/videos-solutions">Vidéos des solutions</a>

View File

@ -4,11 +4,62 @@
<h1 class="display-4"><?= $user->getFirstName() . " " . $user->getSurname() ?></h1> <h1 class="display-4"><?= $user->getFirstName() . " " . $user->getSurname() ?></h1>
</div> </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) { ?> <?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
<div class="alert alert-info"> <div class="alert alert-info">
<strong>Équipe <strong>Équipe
:</strong> <?= $team === null ? "Pas d'équipe" : "<a href=\"/equipe/" . $team->getTrigram() . "\">" :</strong> <?= $team === null ? "Pas d'équipe" : "<a href=\"/equipe/" . $team->getTrigram() . "\">"
. $team->getName() . " (" . $team->getTrigram() . ")</a>" ?> . $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">
<?php
/** @var Team $t */
foreach (Team::getAllTeams(-1) as $t) {
if ($t->getValidationStatus() != ValidationStatus::NOT_READY)
continue;
$team_name = $t->getName() . " (" . $t->getTrigram() . "), problème " . $t->getProblem();
$team_id = $t->getId();
echo "<option value=\"$team_id\">$team_name</option>\n";
}
?>
</select>
</div>
</div>
<div class="form-group row">
<?php if (Phase::getCurrentPhase() < Phase::PHASE2) { ?>
<input type="submit" class="btn btn-secondary btn-lg btn-block" name="attribute_team"
value="Affecter dans une équipe"/>
<?php } ?>
</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> </div>
<?php } ?> <?php } ?>
@ -33,7 +84,7 @@
<hr/> <hr/>
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?> <?php if ($team != null && ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT)) { ?>
<div class="mt-4 mb-4"> <div class="mt-4 mb-4">
<h1 class="display-5">Autorisation de droit à l'image :</h1> <h1 class="display-5">Autorisation de droit à l'image :</h1>
</div> </div>

View File

@ -90,11 +90,9 @@ if (isset($user) && !$has_error) {
</div> </div>
<div class="form-row"> <label for="receive_animath_mails">J'accepte de recevoir des mails de la part d'Animath (<em>facultatif</em>) :</label>
<label for="receive_animath_mails">J'accepte de recevoir des mails de la part d'Animath (<em>facultatif</em>) :</label> <input type="checkbox" id="receive_animath_mails" name="receive_animath_mails"
<input class="form-control" type="checkbox" id="receive_animath_mails" name="receive_animath_mails" <?= isset($user) && $user->receive_animath_mails ? "checked" : "" ?> /><br /><br />
<?= isset($user) && $user->receive_animath_mails ? "checked" : "" ?> />
</div>
<div class="form-group row"> <div class="form-group row">
<input class="btn btn-primary btn-lg btn-block" name="register" type="submit" value="S'inscrire"/> <input class="btn btn-primary btn-lg btn-block" name="register" type="submit" value="S'inscrire"/>

View File

@ -45,11 +45,9 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
</div> </div>
</div> </div>
<div class="form-row"> <label for="receive_animath_mails">J'accepte de recevoir des mails de la part d'Animath (<em>facultatif</em>) :</label>
<label for="receive_animath_mails">J'accepte de recevoir des mails de la part d'Animath (<em>facultatif</em>) :</label> <input type="checkbox" id="receive_animath_mails" name="receive_animath_mails"
<input class="form-control" type="checkbox" id="receive_animath_mails" name="receive_animath_mails"
<?= $user->doReceiveAnimathMails() ? "checked" : "" ?> /> <?= $user->doReceiveAnimathMails() ? "checked" : "" ?> />
</div>
<?php if ($user->getRole() == Role::PARTICIPANT) { ?> <?php if ($user->getRole() == Role::PARTICIPANT) { ?>
<div class="form-row"> <div class="form-row">

View File

@ -136,7 +136,7 @@ require_once "header.php";
<hr /> <hr />
<form method="post"> <form method="post">
<label for="engage">Je m'engage à participer à l'intégralité des Correspondances</label> <label for="engage">Je m'engage à participer à l'intégralité des Correspondances</label>
<input class="form-control" type="checkbox" name="engage" id="engage"/> <input type="checkbox" name="engage" id="engage"/>
<input class="btn btn-primary btn-lg btn-block" type="submit" name="request_validation" <input class="btn btn-primary btn-lg btn-block" type="submit" name="request_validation"
value="Demander la validation"/> value="Demander la validation"/>
</form> </form>
@ -146,166 +146,7 @@ require_once "header.php";
<div class="alert alert-warning"> <div class="alert alert-warning">
Votre équipe est en attente de validation. Votre équipe est en attente de validation.
</div> </div>
<?php } elseif (Phase::getCurrentPhase() >= Phase::PHASE1) { ?> <?php } ?>
<hr/>
<h2>Déroulement du tournoi</h2>
<?php if ($video != null) { ?>
<h4>Vidéo de solution proposée :</h4>
Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a><br/>
<?php displayVideo($video->getLink()) ?>
<br/>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
<h4>Questions reçues :</h4>
<?php
for ($i = 0; $i < 2; ++$i) {
if ($questions_received[$i] == null)
continue;
$asker = Team::fromId($questions_received[$i][0]->getFrom());
$answer = Video::getVideo($asker->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $asker);
?>
<h5>Questions de l'équipe <?= $asker->getName() ?> (<?= $asker->getTrigram() ?>) :</h5>
<table>
<tbody>
<?php
for ($j = 0; $j < 6; ++$j) {
/** @var Question $question */
$question = $questions_received[$i][$j];
if ($question->getQuestion() === null)
continue;
?>
<tr>
<td>
Question <?= $question->getNumber() ?> :
</td>
<td>
<?= $question->getQuestion() ?>
</td>
</tr>
<?php
if ($question->getAttachedFile() !== null) { ?>
<tr>
<td>
<em>Pièce jointe attachée :</em>
</td>
<td>
<a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<tr>
<td>
Réponse :
</td>
<td>
<?= $question->getAnswer() ?>
</td>
</tr>
<?php
if ($question->getAttachedFileAnswer() !== null) { ?>
<tr>
<td>
<em>Pièce jointe attachée :</em>
</td>
<td>
<a href="/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<?php } ?>
</tbody>
</table>
<br/>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
<h6>Vidéo de réponse proposée par l'équipe :</h6>
Lien de la vidéo : <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a><br/>
<?php displayVideo($answer->getLink()) ?>
<br/>
<?php } ?>
<?php } ?>
<?php } ?>
<hr/>
<?php
if (Phase::getCurrentPhase() >= 2) {
for ($i = 0; $i < 2; ++$i) {
$defender = Team::fromId($team->getVideoTeamIds()[$i]);
if ($defender == null)
continue;
$sol = Video::getVideo(Reason::SOLUTION, $defender);
$answer = Video::getVideo($i == 0 ? Reason::ANSWER1 : Reason::ANSWER2, $team);
$questions = Question::getQuestions($team, $defender);
?>
<h4>Vidéo de solution proposée par l'équipe <?= $defender->getName() ?>
(<?= $defender->getTrigram() ?>) :</h4>
Lien de la vidéo : <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a><br/>
<?php displayVideo($sol->getLink()) ?>
<br/>
<h5>Vos questions :</h5>
<br/>
<table>
<tbody>
<?php
for ($j = 0; $j < 6; ++$j) {
/** @var Question $question */
$question = $questions[$j];
if ($question->getQuestion() === null)
continue;
?>
<tr>
<td>
Question <?= $question->getNumber() ?> :
</td>
<td>
<?= $question->getQuestion() ?>
</td>
</tr>
<?php
if ($question->getAttachedFile() !== null) { ?>
<tr>
<td>
<em>Pièce jointe attachée :</em>
</td>
<td>
<a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
<tr>
<td>
Réponse :
</td>
<td>
<?= $question->getAnswer() ?>
</td>
</tr>
<?php
if ($question->getAttachedFileAnswer() !== null) { ?>
<tr>
<td>
<em>Pièce jointe attachée :</em>
</td>
<td>
<a href="/file/<?= $question->getAttachedFileAnswer() ?>">Télécharger</a>
</td>
</tr>
<?php } ?>
<?php } ?>
<?php } ?>
</tbody>
</table>
<br/>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
<h5>Votre vidéo de réponse :</h5>
Lien de la vidéo : <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a><br/>
<?php displayVideo($answer->getLink()) ?>
<hr/>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?> <?php } ?>
<?php } ?> <?php } ?>

View File

@ -0,0 +1,134 @@
<?php
require_once "header.php";
?>
<?php
if (false) {
} elseif (Phase::getCurrentPhase() >= Phase::PHASE1) { ?>
<div class="mt-4 mb-4">
<h1 class="display-4">Mon tournoi</h1>
</div>
<?php if ($video != null) { ?>
<div class="jumbotron">
<h4>Vidéo de solution proposée :</h4>
<div class="alert alert-info">
<strong>Lien de la vidéo :</strong> <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a>
</div>
<?php displayVideo($video->getLink()) ?>
<br/>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE3) { ?>
<h4>Questions reçues :</h4>
<?php
for ($i = 0; $i < 2; ++$i) {
if ($questions_received[$i] == null)
continue;
$asker = Team::fromId($questions_received[$i][0]->getFrom());
$answer = Video::getVideo($asker->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2,
$asker, Video::ACCEPTED);
?>
<h5>Questions de l'équipe <?= $asker->getName() ?> (<?= $asker->getTrigram() ?>) :</h5>
<?php
for ($j = 0; $j < 6; ++$j) {
/** @var Question $question */
$question = $questions_received[$i][$j];
if ($question->getQuestion() === null)
continue;
?>
<div class="alert alert-info">
<strong>Question <?= $question->getNumber() + 1 ?>
:</strong> <?= $question->getQuestion() ?>
<br/>
<?php
if ($question->getAttachedFile() !== null) { ?>
<em>Pièce jointe attachée :</em>
<a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a>
<br/>
<?php } ?>
<strong>Réponse :</strong> <?= $question->getAnswer() ?><br/>
<?php
if ($question->getAttachedFile() !== null) { ?>
<em>Pièce jointe attachée :</em>
<a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a>
<br/>
<?php } ?>
</div>
<?php } ?>
<br/>
<?php if (Phase::getCurrentPhase() > Phase::PHASE4 && $answer != null) { ?>
<h6>Vidéo de réponse proposée par l'équipe :</h6>
<div class="alert alert-info">
<strong>Lien de la vidéo :</strong> <a
href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a>
</div>
<?php displayVideo($answer->getLink()) ?>
<?= $i == 0 ? "<hr />" : "" ?>
<?php } ?>
<?php } ?>
<?php } ?>
</div>
<?php
if (Phase::getCurrentPhase() >= 2) { ?>
<hr/>
<div class="jumbotron">
<?php
for ($i = 0; $i < 2; ++$i) {
$defender = Team::fromId($team->getVideoTeamIds()[$i]);
if ($defender == null)
continue;
$sol = Video::getVideo(Reason::SOLUTION, $defender, Video::ACCEPTED);
$answer = Video::getVideo($i == 0 ? Reason::ANSWER1 : Reason::ANSWER2, $team, Video::ACCEPTED);
$questions = Question::getQuestions($team, $defender);
?>
<h4>Vidéo de solution proposée par l'équipe <?= $defender->getName() ?>
(<?= $defender->getTrigram() ?>) :</h4>
<div class="alert alert-info">
<strong>Lien de la vidéo :</strong> <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a>
</div>
<?php displayVideo($sol->getLink()) ?>
<br/>
<h5>Vos questions :</h5>
<br/>
<?php
for ($j = 0; $j < 6; ++$j) {
/** @var Question $question */
$question = $questions[$j];
if ($question->getQuestion() === null)
continue;
?>
<div class="alert alert-info">
<strong>Question <?= $question->getNumber() + 1 ?>
:</strong> <?= $question->getQuestion() ?>
<br/>
<?php
if ($question->getAttachedFile() !== null) { ?>
<em>Pièce jointe attachée :</em>
<a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a>
<br/>
<?php } ?>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE4) { ?>
<strong>Réponse :</strong> <?= $question->getAnswer() ?><br/>
<?php
if ($question->getAttachedFile() !== null) { ?>
<em>Pièce jointe attachée :</em>
<a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a>
<br/>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<br/>
<?php if (Phase::getCurrentPhase() >= Phase::PHASE4 && $answer != null) { ?>
<h5>Votre vidéo de réponse :</h5>
<div class="alert alert-info">
<strong>Lien de la vidéo :</strong> <a href="<?= $answer->getLink() ?>"><?= $answer->getLink() ?></a>
</div>
<?php displayVideo($answer->getLink()) ?>
<?php } ?>
<?= $i == 0 ? "<hr/>" : "" ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<?php
require_once "footer.php";

View File

@ -2,66 +2,86 @@
require_once "header.php"; require_once "header.php";
?> ?>
<h1>Veuillez toujours enregistrer votre travail ailleurs que sur la plateforme !</h1> <div class="mt-4 mb-4">
<hr /> <h1 class="display-4">Poser des questions</h1>
</div>
<?php
if (isset($give_questions) && !$has_error) { ?>
<div class="alert alert-success">
Vos questions ont bien été mises à jour !
</div>
<?php } ?>
<div class="alert alert-warning">
<h1>Veuillez toujours enregistrer votre travail ailleurs que sur la plateforme !</h1>
</div>
<?php <?php
for ($i = 0; $i < 2; ++$i) { for ($i = 0; $i < 2; ++$i) {
$receiver = $receivers[$i]; $receiver = $receivers[$i];
$video = $videos[$i]; ?> $video = $videos[$i]; ?>
<h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2> <div class="jumbotron">
Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a><br/> <h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2>
<?php displayVideo($video->getLink()) ?> <div class="alert alert-info">
<br/> <strong>Lien de la vidéo :</strong> <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a>
<form method="POST" enctype="multipart/form-data"> </div>
<input type="hidden" name="to" value="<?= $receiver->getTrigram() ?>"/> <?php displayVideo($video->getLink()) ?>
<table > <br/>
<tbody> <form method="POST" enctype="multipart/form-data">
<input type="hidden" name="to" value="<?= $receiver->getTrigram() ?>"/>
<?php <?php
for ($j = 0; $j < 6; ++$j) { for ($j = 0; $j < 6; ++$j) {
$question = $questions[$i][$j]; ?> $question = $questions[$i][$j];
<tr>
<td style="width: 30%;"> if ($question->getQuestion() == null && $j) { ?>
<label for="question_<?= $j + 1 ?>">Question <?= $j + 1 ?> <?= $j >= 3 ? "(<em>facultatif</em>)" : "" ?> :</label> <a id="button_<?= $i ?>_<?= $j ?>" class="btn btn-secondary btn-lg btn-block"
</td> style="display: <?= $j == 0 || $questions[$i][$j - 1]->getQuestion() != null ? "block" : "none" ?>"
<td style="width: 70%;"> onclick="addQuestion(<?= $i ?>, <?= $j ?>)">Ajouter une question</a>
<textarea id="question_<?= $j + 1 ?>" name="question_<?= $j + 1 ?>"><?= $question->getQuestion() ?></textarea> <br/>
</td> <?php
</tr> }
<?php
if ($question->getAttachedFile() != null) { ?> ?>
<tr> <div id="block_<?= $i ?>_<?= $j ?>" style="display: <?= $question->getQuestion() == null ? "none" : "block" ?>;">
<td> <div class="form-group-row">
Pièce jointe : <label for="question_<?= $j + 1 ?>_<?= $i ?>">Question <?= $j + 1 ?> :</label>
</td> <textarea class="form-control" id="question_<?= $j + 1 ?>_<?= $i ?>"
<td> name="question_<?= $j + 1 ?>"><?= $question->getQuestion() ?></textarea>
<a href=/file/<?= $question->getAttachedFile() ?>">Télécharger</a> </div>
</td>
</tr> <?php
<?php } ?> if ($question->getAttachedFile() != null) { ?>
<tr> <br/>
<td> <div class="alert alert-info">
<label for="file_<?= $j + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label> Pièce jointe : <a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
</td> </div>
<td> <?php } ?>
<input type="file" name="file_<?= $j + 1 ?>" id="file_<?= $j + 1 ?>" />
</td> <div class="form-group-row">
</tr> <label for="file_<?= $j + 1 ?>_<?= $i ?>">Ajouter une pièce jointe (<em>facultatif</em>)
:</label>
<input type="file" name="file_<?= $j + 1 ?>" id="file_<?= $j + 1 ?>"/>
</div>
</div>
<?php } ?> <?php } ?>
<tr>
<td style="text-align: center" colspan="2"> <input type="checkbox" name="no_drawing" id="no_drawing_<?= $i ?>"/> <label for="no_drawing_<?= $i ?>">Je
<input type="checkbox" name="no_drawing" id="no_drawing" /> <label for="no_drawing">Je confirme que mes pièces jointes ne contiennent pas de texte.</label> confirme que mes pièces jointes ne contiennent pas de texte.</label>
</td> <input class="btn btn-primary btn-lg btn-block" type="submit" name="give_questions"
</tr> value="Poser les questions"/>
<tr> </form>
<td colspan="2"> </div>
<input type="submit" name="give_questions" value="Poser les questions" />
</td> <script>
</tr> function addQuestion(i, j) {
</tbody> document.getElementById("button_" + i + "_" + j).style.display = "none";
</table> document.getElementById("block_" + i + "_" + j).style.display = "block";
</form> document.getElementById("button_" + i + "_" + (j + 1)).style.display = "block";
<hr/> }
</script>
<?php } <?php }
require_once "footer.php"; require_once "footer.php";

View File

@ -0,0 +1,63 @@
<?php
require_once "header.php";
?>
<div class="mt-4 mb-4">
<h2 class="display-3">Profils orphelins</h2>
</div>
<div>
Cette page recense tous les utilisateurs inscrits mais qui n'ont pas rejoint d'équipe.
</div>
<br />
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th scope="col">
Nom
</th>
<th scope="col">
Rôle
</th>
<th scope="col">
Inscrit le
</th>
</tr>
</thead>
<tbody>
<?php
/** @var User $user */
foreach ($orphan_users as $user) {
?>
<tr>
<th scope="row">
<a href="/informations/<?= $user->getId() . "/" . $user->getFirstName() . " " . $user->getSurname() ?>">
<?= $user->getFirstName() . " " . $user->getSurname() ?>
</a>
</th>
<td><?= Role::getTranslatedName($user->getRole()) ?></td>
<td><?= formatDate($user->getInscriptionDate(), true) ?></td>
</tr>
<?php
}
?>
</tbody>
<tfoot>
<tr>
<th scope="col">
Nom
</th>
<th scope="col">
Rôle
</th>
<th scope="col">
Inscrit le
</th>
</tr>
</tfoot>
</table>
<?php
require_once "footer.php";

View File

@ -2,7 +2,20 @@
require_once "header.php"; require_once "header.php";
?> ?>
Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a> <div class="mt-4 mb-4">
<h1 class="display-4">Répondre aux questions</h1>
</div>
<?php
if (isset($answer_questions) && !$has_error) { ?>
<div class="alert alert-success">
Vos réponses ont bien été mises à jour !
</div>
<?php } ?>
<div class="alert alert-info">
<strong>Lien de la vidéo :</strong> <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a>
</div>
<?php displayVideo($video->getLink()); ?> <?php displayVideo($video->getLink()); ?>
@ -12,75 +25,46 @@ foreach ($questions as $questions_team) {
echo "<h4>Questions de l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h4>\n"; echo "<h4>Questions de l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h4>\n";
?> ?>
<form method="POST" enctype="multipart/form-data"> <form method="POST" enctype="multipart/form-data">
<input type="hidden" name="from" value="<?= $from->getTrigram() ?>" /> <input type="hidden" name="from" value="<?= $from->getTrigram() ?>"/>
<table > <?php
<tbody> for ($i = 0; $i < sizeof($questions_team); ++$i) {
<?php $question = $questions_team[$i];
for ($i = 0; $i < sizeof($questions_team); ++$i) { if ($question->getQuestion() == null)
$question = $questions_team[$i]; continue;
if ($question->getQuestion() == null) ?>
continue; <div class="alert alert-info">
?> <strong>Question <?= $i + 1 ?> :</strong> <?= $question->getQuestion() ?><br/>
<tr>
<td>
Question <?= $i + 1 ?> :
</td>
<td>
<?= $question->getQuestion() ?>
</td>
</tr>
<?php <?php
if ($question->getAttachedFile() != null) { ?> if ($question->getAttachedFile() != null) { ?>
<tr> Pièce jointe :
<td> <a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br/>
Pièce jointe :
</td>
<td>
<a href="/file<?= $question->getAttachedFile() ?>">Télécharger</a>
</td>
</tr>
<?php } ?> <?php } ?>
<tr> <div class="form-group row">
<td> <div class="form-group col-md-12">
<label for="answer_<?= $i + 1 ?>">Réponse :</label> <label for="answer_<?= $i + 1 ?>">Réponse :</label>
</td> <textarea class="form-control" id="answer_<?= $i + 1 ?>"
<td> name="answer_<?= $i + 1 ?>"><?= $question->getAnswer() ?></textarea>
<textarea id="answer_<?= $i + 1 ?>" name="answer_<?= $i + 1 ?>"><?= $question->getAnswer() ?></textarea> </div>
</td> </div>
</tr>
<?php <?php
if ($question->getAttachedFileAnswer() != null) { ?> if ($question->getAttachedFileAnswer() != null) { ?>
<tr> Pièce jointe :
<td> <a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a>
Pièce jointe :
</td>
<td>
<a href="<?= $URL_BASE . "/file/" . $question->getAttachedFileAnswer() ?>">Télécharger</a>
</td>
</tr>
<?php } ?> <?php } ?>
<tr> <div class="form-group row">
<td> <div class="form-group col-md-12">
<label for="file_<?= $i + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label> <label for="file_<?= $i + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
</td> <input type="file" name="file_<?= $i + 1 ?>" id="file_<?= $i + 1 ?>"/>
<td> </div>
<input type="file" name="file_<?= $i + 1 ?>" id="file_<?= $i + 1 ?>" /> </div>
</td> </div>
</tr> <?php } ?>
<?php } ?> <input type="checkbox" name="no_drawing" id="no_drawing_<?= $from->getTrigram() ?>"/> <label for="no_drawing_<?= $from->getTrigram() ?>">Je confirme que mes
<tr> pièces jointes ne contiennent pas de texte.</label>
<td style="text-align: center" colspan="2">
<input type="checkbox" name="no_drawing" id="no_drawing" /> <label for="no_drawing">Je confirme que mes pièces jointes ne contiennent pas de texte.</label> <input class="btn btn-primary btn-lg btn-block" type="submit" name="answer" value="Répondre aux questions posées"/>
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" name="answer" value="Répondre aux questions posées" />
</td>
</tr>
</tbody>
</table>
</form> </form>
<hr />
<?php } ?> <?php } ?>
<?php <?php

View File

@ -2,87 +2,115 @@
require_once "header.php"; require_once "header.php";
for ($problem = 1; $problem <= 4; ++$problem) { for ($problem = 1; $problem <= 4; ++$problem) { ?>
echo "<h2>Vidéos pour le problème $problem</h2>\n"; <div class="mt-4 mb-4">
<h1 class="display-4">Vidéos pour le problème <?= $problem ?></h1>
</div>
<?php
/** @var Video $video */ /** @var Video $video */
foreach ($videos[$problem - 1] as $video) { foreach ($videos[$problem - 1] as $video) {
$link = $video->getLink(); $link = $video->getLink();
$team = Team::fromId($video->getTeam()); $team = Team::fromId($video->getTeam());
$version = $video->getVersion(); $version = $video->getVersion();
echo "<h4>Vidéo de présentation de l'équipe « " . $team->getName() . " » (" . $team->getTrigram() . ") :</h4>\n"; ?>
echo "Lien de la vidéo (version $version) : <a href=\"$link\">$link</a>"; <div class="jumbotron" id="team-<?= $team->getTrigram() ?>">
displayVideo($link); <h2>
Équipe « <?= $team->getName() ?> » (<?= $team->getTrigram() ?>)
</h2>
<div class="alert alert-info">
<strong>Lien de la vidéo (version <?= $version ?>) :</strong> <a href="<?= $link ?>"><?= $link ?></a>
</div>
<?php
displayVideo($link);
if ($video->getValidation() == 0) { ?> if ($video->getValidation() == 0) { ?>
<form method="POST"> <form method="POST">
<input type="hidden" name="validate_video" value="" /> <input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $video->getId() ?>" /> <input type="hidden" name="video_id" value="<?= $video->getId() ?>"/>
<input style="width: 49%;" type="submit" name="accept" value="Accepter la vidéo" /> <input class="btn btn-primary btn-lg" style="width: 49%;" type="submit" name="accept"
<input style="width: 49%;" type="submit" name="reject" value="Refuser la vidéo" /> value="Accepter la vidéo"/>
</form> <input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
<?php } value="Refuser la vidéo"/>
else </form>
echo "<h5>La vidéo a été " . ($video->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n"; <br/>
<?php } else { ?>
<div class="alert alert-<?= $video->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
if ($video->getValidation() != Video::ACCEPTED) { if ($video->getValidation() != Video::ACCEPTED) {
$last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED); $last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED);
if ($last_validated_video !== null) { if ($last_validated_video !== null) {
$link = $last_validated_video->getLink(); $link = $last_validated_video->getLink(); ?>
echo "\n<br />\nLien de la dernière vidéo validée de cette équipe : <a href=\"$link\">$link</a><br />\n"; <div class="alert alert-info">
displayVideo($link); <strong>Lien de la vidéo validée de cette équipe (version <?= $version ?>) :</strong>
} <a href="<?= $link ?>"><?= $link ?></a>
} </div>
<?php
if (Phase::getCurrentPhase() > Phase::PHASE1) {
/** @var Question[] $from_questions */
foreach (Question::getQuestionsTo($team) as $from_questions) {
$from = Team::fromId($from_questions[0]->getFrom());
echo "<h5>Questions posées par l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h5>\n";
for ($i = 0; $i < sizeof($from_questions); ++$i) {
$question = $from_questions[$i];
if ($question->getQuestion() == null)
continue;
echo "Question " . ($i + 1) . " : " . $question->getQuestion() . "<br />\n";
if ($question->getAttachedFile() != null)
echo "<em>Pièce jointe attachée :</em> <a href=\"/file/" . $question->getAttachedFile() . "\">Télécharger</a><br />\n";
if ($question->getAnswer() != null)
echo "Réponse apportée : " . $question->getAnswer() . "<br />\n";
if ($question->getAttachedFileAnswer() != null)
echo "<em>Pièce jointe attachée pour la réponse :</em> <a href=\"/file/" . $question->getAttachedFileAnswer() . "\">Télécharger</a><br />\n";
}
echo "<br />\n";
if (Phase::getCurrentPhase() >= Phase::PHASE4) {
$answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $from);
$link = $answer->getLink();
$version = $answer->getVersion();
echo "<h5>Vidéo de réponse :</h5>\n";
echo "Lien de la vidéo (version $version) : <a href=\"$link\">$link</a>";
displayVideo($link); displayVideo($link);
}
}
if ($answer->getValidation() == 0) { ?> if (Phase::getCurrentPhase() > Phase::PHASE1) {
<form method="POST"> /** @var Question[] $from_questions */
<input type="hidden" name="validate_video" value="" /> foreach (Question::getQuestionsTo($team) as $from_questions) {
<input type="hidden" name="video_id" value="<?= $answer->getId() ?>" /> $from = Team::fromId($from_questions[0]->getFrom());
<input style="width: 49%;" type="submit" name="accept" value="Accepter la vidéo" /> echo "<h5>Questions posées par l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h5>\n";
<input style="width: 49%;" type="submit" name="reject" value="Refuser la vidéo" /> for ($i = 0; $i < sizeof($from_questions); ++$i) {
</form> $question = $from_questions[$i];
<?php } if ($question->getQuestion() == null)
else continue;
echo "<h5>La vidéo a été " . ($answer->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n";
if ($answer->getValidation() != Video::ACCEPTED) { echo "<div class=\"alert alert-info\">\n";
$last_validated_answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $team, Video::ACCEPTED); echo "<strong>Question " . ($i + 1) . " :</strong> " . $question->getQuestion() . "<br />\n";
if ($last_validated_answer !== null) { if ($question->getAttachedFile() != null)
$link = $last_validated_answer->getLink(); echo "<em>Pièce jointe attachée :</em> <a href=\"/file/" . $question->getAttachedFile() . "\"><strong>Télécharger</strong></a><br />\n";
echo "\n<br />\nLien de la dernière vidéo validée de cette équipe : <a href=\"$link\">$link</a><br />\n"; if ($question->getAnswer() != null)
displayVideo($link); echo "<strong>Réponse apportée :</strong> " . $question->getAnswer() . "<br />\n";
} if ($question->getAttachedFileAnswer() != null)
echo "<em>Pièce jointe attachée pour la réponse :</em> <a href=\"/file/" . $question->getAttachedFileAnswer() . "\"><strong>Télécharger</strong></a><br />\n";
echo "</div>\n";
} }
} echo "<br />\n";
} if (Phase::getCurrentPhase() >= Phase::PHASE4) {
} $answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $from);
} if ($answer == null)
continue;
$link = $answer->getLink();
$version = $answer->getVersion();
echo "<h5>Vidéo de réponse :</h5>\n";
echo "<strong>Lien de la vidéo (version $version) :</strong> <a href=\"$link\">$link</a>";
displayVideo($link);
if ($answer->getValidation() == 0) { ?>
<form method="POST">
<input type="hidden" name="validate_video" value=""/>
<input type="hidden" name="video_id" value="<?= $answer->getId() ?>"/>
<input class="btn btn-primary btn-lg" style="width: 49%;" type="submit" name="accept"
value="Accepter la vidéo"/>
<input class="btn btn-light btn-lg" style="width: 49%;" type="submit" name="reject"
value="Refuser la vidéo"/>
</form>
<br />
<?php } else { ?>
<div class="alert alert-<?= $answer->getValidation() == 1 ? "success" : "danger" ?>">
La vidéo a été <?= $answer->getValidation() == 1 ? "acceptée" : "refusée" ?>.
</div>
<?php }
if ($answer->getValidation() != Video::ACCEPTED) {
$last_validated_answer = Video::getVideo($from->getVideoTeamIds()[0] == $team->getId() ? Reason::ANSWER1 : Reason::ANSWER2, $team, Video::ACCEPTED);
if ($last_validated_answer !== null) {
$link = $last_validated_answer->getLink();
echo "\n<br />\n<strong>Lien de la dernière vidéo validée de cette équipe :</strong> <a href=\"$link\">$link</a><br />\n";
displayVideo($link);
}
}
}
}
} ?>
</div>
<?php }
echo "<hr />\n"; echo "<hr />\n";
} }