mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-01-05 23:42:21 +00:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
e8340f2d2e
@ -6,3 +6,20 @@
|
||||
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;
|
||||
}
|
||||
|
@ -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/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
|
||||
$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["^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["^repondre-questions-3$"] = ["server_files/controllers/repondre_questions.php"];
|
||||
$ROUTES["^videos-solutions/?$"] = ["server_files/controllers/videos_solutions.php"];
|
||||
|
@ -79,9 +79,9 @@ class Question
|
||||
null,
|
||||
null,
|
||||
null];
|
||||
for ($_ = 0; $_ < 6; ++$_) {
|
||||
$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `question`) VALUES (?, ?, ?, ?);");
|
||||
$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $default_questions[$_]]);
|
||||
for ($i = 0; $i < 6; ++$i) {
|
||||
$req = $DB->prepare("INSERT INTO `questions`(`from`, `to`, `problem`, `number`, `question`) VALUES (?, ?, ?, ?, ?);");
|
||||
$req->execute([$from->getId(), $to->getId(), $from->getProblem(), $i, $default_questions[$i]]);
|
||||
}
|
||||
return self::getQuestions($from, $to);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ class Team
|
||||
public static function getAllTeams($problem)
|
||||
{
|
||||
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)]);
|
||||
|
||||
$teams = [];
|
||||
@ -96,7 +96,7 @@ class Team
|
||||
$this->encadrant = $data["encadrant"];
|
||||
$this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"]];
|
||||
$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->video_team_ids = [$data["video_team1"], $data["video_team2"]];
|
||||
$this->access_code = $data["access_code"];
|
||||
|
@ -54,7 +54,7 @@ class User
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$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) {
|
||||
$admin = new User();
|
||||
@ -64,6 +64,21 @@ class User
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ class NewTeam {
|
||||
|
||||
$this->trigram = strtoupper($this->trigram);
|
||||
|
||||
$this->allow_publish = $this->allow_publish == "on";
|
||||
$this->allow_publish = $this->allow_publish == "on" ? 1 : 0;
|
||||
}
|
||||
|
||||
public function makeVerifications() {
|
||||
|
@ -7,10 +7,10 @@ if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::PARTICIPANT && $_
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["upload_answer"])) {
|
||||
$new_video = new NewAnswer($_POST);
|
||||
$new_answer = new NewAnswer($_POST);
|
||||
try {
|
||||
$new_video->makeVerifications();
|
||||
$new_video->uploadVideo();
|
||||
$new_answer->makeVerifications();
|
||||
$new_answer->uploadVideo();
|
||||
} catch (AssertionError $e) {
|
||||
$has_error = true;
|
||||
$error_message = $e->getMessage();
|
||||
|
@ -54,6 +54,7 @@ class UpdateVideoTeams
|
||||
|
||||
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(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.");
|
||||
|
@ -16,6 +16,77 @@ if ($user === null)
|
||||
|
||||
$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)
|
||||
$documents = $user->getAllDocuments($team->getProblem());
|
||||
|
||||
|
@ -58,8 +58,6 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
|
||||
$team = $_SESSION["team"];
|
||||
|
||||
$documents = $user->getAllDocuments($team->getProblem());
|
||||
$video = Video::getVideo(Reason::SOLUTION, $team);
|
||||
$questions_received = Question::getQuestionsTo($team);
|
||||
}
|
||||
else
|
||||
require_once "server_files/403.php";
|
||||
|
17
server_files/controllers/mon_tournoi.php
Normal file
17
server_files/controllers/mon_tournoi.php
Normal 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";
|
8
server_files/controllers/profils_orphelins.php
Normal file
8
server_files/controllers/profils_orphelins.php
Normal 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";
|
@ -21,15 +21,16 @@ function loadUserValues()
|
||||
}
|
||||
}
|
||||
|
||||
function quitTeam()
|
||||
function quitTeam($user_id = -1)
|
||||
{
|
||||
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 */
|
||||
$user = $_SESSION["user"];
|
||||
$user_id = $user->getId();
|
||||
$user = User::fromId($user_id);
|
||||
$role = $user->getRole();
|
||||
|
||||
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("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;");
|
||||
while (($data = $req->fetch()) !== false)
|
||||
unlink("$URL_BASE/files/" . $data["file_id"]);
|
||||
|
@ -45,11 +45,9 @@ require_once "header.php";
|
||||
</select>
|
||||
</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>
|
||||
<input class="form-control" type="checkbox" id="allow_publish" name="allow_publish"
|
||||
<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"
|
||||
<?= isset($new_team) && $new_team->allow_publish ? "checked" : "" ?> />
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<input class="btn btn-primary btn-lg btn-block" name="add_team" type="submit" value="Ajouter une équipe"/>
|
||||
|
@ -96,8 +96,8 @@
|
||||
|
||||
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE1 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE1 ? "warning" : "success") ?>">
|
||||
<?= Phase::getTranslatedName(Phase::PHASE1) ?> :
|
||||
Du <strong><?= formatDate($CONFIG->getStartPhase2Date(), true) ?></strong> au
|
||||
<strong><?= formatDate($CONFIG->getEndPhase2Date(), true) ?></strong>
|
||||
Du <strong><?= formatDate($CONFIG->getStartPhase1Date(), true) ?></strong> au
|
||||
<strong><?= formatDate($CONFIG->getEndPhase1Date(), true) ?></strong>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-<?= Phase::getCurrentPhase() < Phase::PHASE2 ? "danger" : (Phase::getCurrentPhase() == Phase::PHASE2 ? "warning" : "success") ?>">
|
||||
|
@ -1,6 +1,18 @@
|
||||
<?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) {
|
||||
/** @var Team $answer_team */
|
||||
$answer_team = $teams[$i];
|
||||
@ -13,13 +25,15 @@ for ($i = 0; $i < 2; ++$i) {
|
||||
/** @var Question[] $questions */
|
||||
$questions = Question::getQuestions($team, $answer_team);
|
||||
?>
|
||||
<h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2>
|
||||
<h5>Lien de la vidéo de présentation de la solution au problème : <a href="<?= $sol->getLink() ?>"><?= $sol->getLink() ?></a></h5>
|
||||
<?php displayVideo($sol->getLink()) ?>
|
||||
<div class="jumbotron">
|
||||
<h2>Vidéo de l'équipe <?= $answer_team->getName() ?> (<?= $answer_team->getTrigram() ?>) :</h2>
|
||||
<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>
|
||||
<table >
|
||||
<tbody>
|
||||
<h5>Questions échangées :</h5>
|
||||
<?php
|
||||
for ($j = 0; $j < 6; ++$j) {
|
||||
/** @var Question $question */
|
||||
@ -27,105 +41,66 @@ for ($i = 0; $i < 2; ++$i) {
|
||||
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 } ?>
|
||||
<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 } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<br />
|
||||
<h5>Vidéo de réponse :</h5>
|
||||
<br/>
|
||||
<h5>Vidéo de réponse :</h5>
|
||||
|
||||
<?php
|
||||
if ($answer !== null) {
|
||||
$link = $answer->getLink();
|
||||
echo "Lien de la vidéo déjà envoyée : <a href=\"$link\">$link</a> (version " . $answer->getVersion() . ")<br />\n";
|
||||
displayVideo($link);
|
||||
switch ($answer->getValidation()) {
|
||||
case 0:
|
||||
echo "La vidéo n'a pas encore été contrôlée.<br />";
|
||||
break;
|
||||
case 1:
|
||||
echo "La vidéo a été acceptée.<br />";
|
||||
break;
|
||||
case -1:
|
||||
echo "La vidéo a été rejetée.<br />";
|
||||
break;
|
||||
<?php
|
||||
if ($answer !== null) {
|
||||
$link = $answer->getLink();
|
||||
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);
|
||||
switch ($answer->getValidation()) {
|
||||
case 0:
|
||||
echo "<div class=\"alert alert-warning\">La vidéo n'a pas encore été contrôlée.</div>";
|
||||
break;
|
||||
case 1:
|
||||
echo "<div class=\"alert alert-success\">La vidéo a été acceptée.</div>";
|
||||
break;
|
||||
case -1:
|
||||
echo "<div class=\"alert alert-danger\">La vidéo a été rejetée.</div>";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) {
|
||||
$link = $answer_validated->getLink();
|
||||
echo "<hr />\nLien de la dernière vidéo validée : <a href=\"$link\">$link</a><br />";
|
||||
displayVideo($link);
|
||||
}
|
||||
?>
|
||||
if ($answer_validated != null && $answer_validated->getId() != $answer->getId()) {
|
||||
$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";
|
||||
displayVideo($link);
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="POST">
|
||||
<input type="hidden" name="team" value="<?= $i + 1 ?>" />
|
||||
<table >
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 30%;">
|
||||
<label for="link">Lien de la vidéo à soumettre :</label>
|
||||
</td>
|
||||
<td style="width: 70%;">
|
||||
<input type="url" id="link" name="link" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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 />
|
||||
<form method="POST">
|
||||
<input type="hidden" name="team" value="<?= $i + 1 ?>"/>
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link_<?= $i ?>">Lien de la vidéo à soumettre :</label>
|
||||
<input class="form-control" type="url" id="link_<?= $i ?>" name="link"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" name="valid_link" id="valid_link_<?= $i ?>" required/> <label for="valid_link_<?= $i ?>">Je
|
||||
confirme que le lien est valide</label><br/>
|
||||
|
||||
<input type="checkbox" name="no_change" id="no_change_<?= $i ?>" required/> <label for="no_change_<?= $i ?>">Je m'engage
|
||||
à ne pas changer le contenu du lien et de la vidéo</label>
|
||||
|
||||
<input class="btn btn-primary btn-lg btn-block" type="submit" name="upload_answer" value="Envoyer la vidéo"/>
|
||||
</form>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
|
@ -1,63 +1,59 @@
|
||||
<?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
|
||||
if ($video !== null) {
|
||||
$link = $video->getLink();
|
||||
echo "Lien de la vidéo déjà envoyée : <a href=\"$link\">$link</a> (version " . $video->getVersion() . ")<br />\n";
|
||||
displayVideo($link);
|
||||
switch ($video->getValidation()) {
|
||||
$link = $video->getLink();
|
||||
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);
|
||||
switch ($video->getValidation()) {
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($video_validated != null && $video_validated->getId() != $video->getId()) {
|
||||
$link = $video_validated->getLink();
|
||||
echo "<hr />\nLien de la dernière vidéo validée : <a href=\"$link\">$link</a><br />";
|
||||
displayVideo($link);
|
||||
$link = $video_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";
|
||||
displayVideo($link);
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="POST">
|
||||
<table >
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="width: 30%;">
|
||||
<label for="link">Lien de la vidéo à soumettre :</label>
|
||||
</td>
|
||||
<td style="width: 70%;">
|
||||
<input type="url" id="link" name="link" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<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" value="Envoyer la vidéo" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<hr/>
|
||||
|
||||
<form method="POST">
|
||||
<div class="form-row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="link">Lien de la vidéo à soumettre :</label>
|
||||
<input class="form-control" type="url" id="link" name="link"/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="checkbox" name="valid_link" id="valid_link" required/> <label for="valid_link">Je
|
||||
confirme que le lien est valide</label><br/>
|
||||
|
||||
<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>
|
||||
|
||||
<input class="btn btn-primary btn-lg btn-block" type="submit" name="upload" value="Envoyer la vidéo"/>
|
||||
</form>
|
||||
|
||||
<?php require_once "footer.php";
|
@ -18,20 +18,20 @@
|
||||
:</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 />";
|
||||
}
|
||||
?>
|
||||
<?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" ?>
|
||||
@ -40,32 +40,38 @@
|
||||
<?php
|
||||
if ($_SESSION["role"] == Role::ADMIN) { ?>
|
||||
<hr/>
|
||||
<form method="POST">
|
||||
<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;
|
||||
<? if ($team->getValidationStatus() == ValidationStatus::VALIDATED) { ?>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<a href="/videos-solutions#team-<?= $team->getTrigram() ?>"><button class="btn btn-primary btn-lg btn-block">
|
||||
Aller aux vidéos de l'équipe</button></a><br />
|
||||
<form method="POST">
|
||||
<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 <?= Phase::getCurrentPhase() >= Phase::PHASE2 ? "disabled" : "" ?>>
|
||||
<?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>
|
||||
$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>
|
||||
<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>
|
||||
<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"
|
||||
value="Mettre à jour"/>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<hr/>
|
||||
@ -84,12 +90,13 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
|
||||
<form method="POST">
|
||||
<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-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
|
||||
}
|
||||
|
||||
require_once "footer.php" ?>
|
@ -1,3 +1,5 @@
|
||||
<div class="mt-4 mb-4">
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -10,14 +10,6 @@
|
||||
<!-- 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>
|
||||
@ -51,7 +43,9 @@
|
||||
<?php }
|
||||
} else { ?>
|
||||
<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()) {
|
||||
case Phase::PHASE1: ?>
|
||||
<li class="nav-item active"><a class="nav-link" href="/envoyer-video-1">
|
||||
@ -77,17 +71,18 @@
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($_SESSION["role"] == Role::ADMIN) { ?>
|
||||
<li>
|
||||
Liste des problèmes
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link">Liste des équipes</a>
|
||||
<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>
|
||||
<li class="nav-item active"><a class="nav-link" href="/probleme/1">Problème 1</a></li>
|
||||
<li class="nav-item active"><a class="nav-link" href="/probleme/2">Problème 2</a></li>
|
||||
<li class="nav-item active"><a class="nav-link" href="/probleme/3">Problème 3</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>
|
||||
</li>
|
||||
<li class="nav-item active"><a class="nav-link" href="/ajouter-admin">
|
||||
Ajouter un administrateur</a>
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/ajouter-admin">Ajouter un administrateur</a>
|
||||
</li>
|
||||
<li class="nav-item active">
|
||||
<a class="nav-link" href="/videos-solutions">Vidéos des solutions</a>
|
||||
|
@ -4,11 +4,62 @@
|
||||
<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) { ?>
|
||||
<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">
|
||||
<?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>
|
||||
<?php } ?>
|
||||
|
||||
@ -33,7 +84,7 @@
|
||||
|
||||
<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">
|
||||
<h1 class="display-5">Autorisation de droit à l'image :</h1>
|
||||
</div>
|
||||
|
@ -90,11 +90,9 @@ if (isset($user) && !$has_error) {
|
||||
|
||||
</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>
|
||||
<input class="form-control" type="checkbox" id="receive_animath_mails" name="receive_animath_mails"
|
||||
<?= isset($user) && $user->receive_animath_mails ? "checked" : "" ?> />
|
||||
</div>
|
||||
<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"
|
||||
<?= isset($user) && $user->receive_animath_mails ? "checked" : "" ?> /><br /><br />
|
||||
|
||||
<div class="form-group row">
|
||||
<input class="btn btn-primary btn-lg btn-block" name="register" type="submit" value="S'inscrire"/>
|
||||
|
@ -45,11 +45,9 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
|
||||
</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>
|
||||
<input class="form-control" type="checkbox" id="receive_animath_mails" name="receive_animath_mails"
|
||||
<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"
|
||||
<?= $user->doReceiveAnimathMails() ? "checked" : "" ?> />
|
||||
</div>
|
||||
|
||||
<?php if ($user->getRole() == Role::PARTICIPANT) { ?>
|
||||
<div class="form-row">
|
||||
|
@ -136,7 +136,7 @@ require_once "header.php";
|
||||
<hr />
|
||||
<form method="post">
|
||||
<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"
|
||||
value="Demander la validation"/>
|
||||
</form>
|
||||
@ -146,166 +146,7 @@ require_once "header.php";
|
||||
<div class="alert alert-warning">
|
||||
Votre équipe est en attente de validation.
|
||||
</div>
|
||||
<?php } elseif (Phase::getCurrentPhase() >= Phase::PHASE1) { ?>
|
||||
<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 } ?>
|
||||
|
||||
|
134
server_files/views/mon_tournoi.php
Normal file
134
server_files/views/mon_tournoi.php
Normal 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";
|
@ -2,66 +2,86 @@
|
||||
require_once "header.php";
|
||||
?>
|
||||
|
||||
<h1>Veuillez toujours enregistrer votre travail ailleurs que sur la plateforme !</h1>
|
||||
<hr />
|
||||
<div class="mt-4 mb-4">
|
||||
<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
|
||||
for ($i = 0; $i < 2; ++$i) {
|
||||
$receiver = $receivers[$i];
|
||||
$video = $videos[$i]; ?>
|
||||
<h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2>
|
||||
Lien de la vidéo : <a href="<?= $video->getLink() ?>"><?= $video->getLink() ?></a><br/>
|
||||
<?php displayVideo($video->getLink()) ?>
|
||||
<br/>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="to" value="<?= $receiver->getTrigram() ?>"/>
|
||||
<table >
|
||||
<tbody>
|
||||
<div class="jumbotron">
|
||||
<h2>Questions pour l'équipe <?= $receiver->getName() ?> (<?= $receiver->getTrigram() ?>) :</h2>
|
||||
<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/>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="to" value="<?= $receiver->getTrigram() ?>"/>
|
||||
|
||||
<?php
|
||||
for ($j = 0; $j < 6; ++$j) {
|
||||
$question = $questions[$i][$j]; ?>
|
||||
<tr>
|
||||
<td style="width: 30%;">
|
||||
<label for="question_<?= $j + 1 ?>">Question <?= $j + 1 ?> <?= $j >= 3 ? "(<em>facultatif</em>)" : "" ?> :</label>
|
||||
</td>
|
||||
<td style="width: 70%;">
|
||||
<textarea id="question_<?= $j + 1 ?>" name="question_<?= $j + 1 ?>"><?= $question->getQuestion() ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
if ($question->getAttachedFile() != null) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
Pièce jointe :
|
||||
</td>
|
||||
<td>
|
||||
<a href=/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="file_<?= $j + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" name="file_<?= $j + 1 ?>" id="file_<?= $j + 1 ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
$question = $questions[$i][$j];
|
||||
|
||||
if ($question->getQuestion() == null && $j) { ?>
|
||||
<a id="button_<?= $i ?>_<?= $j ?>" class="btn btn-secondary btn-lg btn-block"
|
||||
style="display: <?= $j == 0 || $questions[$i][$j - 1]->getQuestion() != null ? "block" : "none" ?>"
|
||||
onclick="addQuestion(<?= $i ?>, <?= $j ?>)">Ajouter une question</a>
|
||||
<br/>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
<div id="block_<?= $i ?>_<?= $j ?>" style="display: <?= $question->getQuestion() == null ? "none" : "block" ?>;">
|
||||
<div class="form-group-row">
|
||||
<label for="question_<?= $j + 1 ?>_<?= $i ?>">Question <?= $j + 1 ?> :</label>
|
||||
<textarea class="form-control" id="question_<?= $j + 1 ?>_<?= $i ?>"
|
||||
name="question_<?= $j + 1 ?>"><?= $question->getQuestion() ?></textarea>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
if ($question->getAttachedFile() != null) { ?>
|
||||
<br/>
|
||||
<div class="alert alert-info">
|
||||
Pièce jointe : <a href="/file/<?= $question->getAttachedFile() ?>">Télécharger</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<div class="form-group-row">
|
||||
<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 } ?>
|
||||
<tr>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="give_questions" value="Poser les questions" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<hr/>
|
||||
|
||||
<input type="checkbox" name="no_drawing" id="no_drawing_<?= $i ?>"/> <label for="no_drawing_<?= $i ?>">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="give_questions"
|
||||
value="Poser les questions"/>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function addQuestion(i, j) {
|
||||
document.getElementById("button_" + i + "_" + j).style.display = "none";
|
||||
document.getElementById("block_" + i + "_" + j).style.display = "block";
|
||||
document.getElementById("button_" + i + "_" + (j + 1)).style.display = "block";
|
||||
}
|
||||
</script>
|
||||
<?php }
|
||||
|
||||
require_once "footer.php";
|
63
server_files/views/profils_orphelins.php
Normal file
63
server_files/views/profils_orphelins.php
Normal 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";
|
@ -2,7 +2,20 @@
|
||||
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()); ?>
|
||||
|
||||
@ -12,75 +25,46 @@ foreach ($questions as $questions_team) {
|
||||
echo "<h4>Questions de l'équipe " . $from->getName() . " (" . $from->getTrigram() . ") :</h4>\n";
|
||||
?>
|
||||
<form method="POST" enctype="multipart/form-data">
|
||||
<input type="hidden" name="from" value="<?= $from->getTrigram() ?>" />
|
||||
<table >
|
||||
<tbody>
|
||||
<?php
|
||||
for ($i = 0; $i < sizeof($questions_team); ++$i) {
|
||||
$question = $questions_team[$i];
|
||||
if ($question->getQuestion() == null)
|
||||
continue;
|
||||
?>
|
||||
<tr>
|
||||
<td>
|
||||
Question <?= $i + 1 ?> :
|
||||
</td>
|
||||
<td>
|
||||
<?= $question->getQuestion() ?>
|
||||
</td>
|
||||
</tr>
|
||||
<input type="hidden" name="from" value="<?= $from->getTrigram() ?>"/>
|
||||
<?php
|
||||
for ($i = 0; $i < sizeof($questions_team); ++$i) {
|
||||
$question = $questions_team[$i];
|
||||
if ($question->getQuestion() == null)
|
||||
continue;
|
||||
?>
|
||||
<div class="alert alert-info">
|
||||
<strong>Question <?= $i + 1 ?> :</strong> <?= $question->getQuestion() ?><br/>
|
||||
<?php
|
||||
if ($question->getAttachedFile() != null) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
Pièce jointe :
|
||||
</td>
|
||||
<td>
|
||||
<a href="/file<?= $question->getAttachedFile() ?>">Télécharger</a>
|
||||
</td>
|
||||
</tr>
|
||||
Pièce jointe :
|
||||
<a href="/file/<?= $question->getAttachedFile() ?>"><strong>Télécharger</strong></a><br/>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="answer_<?= $i + 1 ?>">Réponse :</label>
|
||||
</td>
|
||||
<td>
|
||||
<textarea id="answer_<?= $i + 1 ?>" name="answer_<?= $i + 1 ?>"><?= $question->getAnswer() ?></textarea>
|
||||
</td>
|
||||
</tr>
|
||||
<div class="form-group row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="answer_<?= $i + 1 ?>">Réponse :</label>
|
||||
<textarea class="form-control" id="answer_<?= $i + 1 ?>"
|
||||
name="answer_<?= $i + 1 ?>"><?= $question->getAnswer() ?></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($question->getAttachedFileAnswer() != null) { ?>
|
||||
<tr>
|
||||
<td>
|
||||
Pièce jointe :
|
||||
</td>
|
||||
<td>
|
||||
<a href="<?= $URL_BASE . "/file/" . $question->getAttachedFileAnswer() ?>">Télécharger</a>
|
||||
</td>
|
||||
</tr>
|
||||
Pièce jointe :
|
||||
<a href="/file/<?= $question->getAttachedFileAnswer() ?>"><strong>Télécharger</strong></a>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<td>
|
||||
<label for="file_<?= $i + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
|
||||
</td>
|
||||
<td>
|
||||
<input type="file" name="file_<?= $i + 1 ?>" id="file_<?= $i + 1 ?>" />
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<tr>
|
||||
<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>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<input type="submit" name="answer" value="Répondre aux questions posées" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div class="form-group row">
|
||||
<div class="form-group col-md-12">
|
||||
<label for="file_<?= $i + 1 ?>">Ajouter une pièce jointe (<em>facultatif</em>) :</label>
|
||||
<input type="file" name="file_<?= $i + 1 ?>" id="file_<?= $i + 1 ?>"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<input type="checkbox" name="no_drawing" id="no_drawing_<?= $from->getTrigram() ?>"/> <label for="no_drawing_<?= $from->getTrigram() ?>">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"/>
|
||||
</form>
|
||||
<hr />
|
||||
<?php } ?>
|
||||
|
||||
<?php
|
||||
|
@ -2,87 +2,115 @@
|
||||
|
||||
require_once "header.php";
|
||||
|
||||
for ($problem = 1; $problem <= 4; ++$problem) {
|
||||
echo "<h2>Vidéos pour le problème $problem</h2>\n";
|
||||
for ($problem = 1; $problem <= 4; ++$problem) { ?>
|
||||
<div class="mt-4 mb-4">
|
||||
<h1 class="display-4">Vidéos pour le problème <?= $problem ?></h1>
|
||||
</div>
|
||||
<?php
|
||||
/** @var Video $video */
|
||||
foreach ($videos[$problem - 1] as $video) {
|
||||
$link = $video->getLink();
|
||||
$team = Team::fromId($video->getTeam());
|
||||
$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>";
|
||||
displayVideo($link);
|
||||
?>
|
||||
<div class="jumbotron" id="team-<?= $team->getTrigram() ?>">
|
||||
<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) { ?>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="validate_video" value="" />
|
||||
<input type="hidden" name="video_id" value="<?= $video->getId() ?>" />
|
||||
<input style="width: 49%;" type="submit" name="accept" value="Accepter la vidéo" />
|
||||
<input style="width: 49%;" type="submit" name="reject" value="Refuser la vidéo" />
|
||||
</form>
|
||||
<?php }
|
||||
else
|
||||
echo "<h5>La vidéo a été " . ($video->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n";
|
||||
if ($video->getValidation() == 0) { ?>
|
||||
<form method="POST">
|
||||
<input type="hidden" name="validate_video" value=""/>
|
||||
<input type="hidden" name="video_id" value="<?= $video->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-<?= $video->getValidation() == 1 ? "success" : "danger" ?>">
|
||||
La vidéo a été <?= $video->getValidation() == 1 ? "acceptée" : "refusée" ?>.
|
||||
</div>
|
||||
<?php }
|
||||
|
||||
if ($video->getValidation() != Video::ACCEPTED) {
|
||||
$last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED);
|
||||
if ($last_validated_video !== null) {
|
||||
$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";
|
||||
displayVideo($link);
|
||||
}
|
||||
}
|
||||
|
||||
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>";
|
||||
if ($video->getValidation() != Video::ACCEPTED) {
|
||||
$last_validated_video = Video::getVideo(Reason::SOLUTION, $team, Video::ACCEPTED);
|
||||
if ($last_validated_video !== null) {
|
||||
$link = $last_validated_video->getLink(); ?>
|
||||
<div class="alert alert-info">
|
||||
<strong>Lien de la vidéo validée de cette équipe (version <?= $version ?>) :</strong>
|
||||
<a href="<?= $link ?>"><?= $link ?></a>
|
||||
</div>
|
||||
<?php
|
||||
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 style="width: 49%;" type="submit" name="accept" value="Accepter la vidéo" />
|
||||
<input style="width: 49%;" type="submit" name="reject" value="Refuser la vidéo" />
|
||||
</form>
|
||||
<?php }
|
||||
else
|
||||
echo "<h5>La vidéo a été " . ($answer->getValidation() == 1 ? "acceptée" : "refusée") . ".</h5><br />\n";
|
||||
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;
|
||||
|
||||
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 />\nLien de la dernière vidéo validée de cette équipe : <a href=\"$link\">$link</a><br />\n";
|
||||
displayVideo($link);
|
||||
}
|
||||
echo "<div class=\"alert alert-info\">\n";
|
||||
echo "<strong>Question " . ($i + 1) . " :</strong> " . $question->getQuestion() . "<br />\n";
|
||||
if ($question->getAttachedFile() != null)
|
||||
echo "<em>Pièce jointe attachée :</em> <a href=\"/file/" . $question->getAttachedFile() . "\"><strong>Télécharger</strong></a><br />\n";
|
||||
if ($question->getAnswer() != null)
|
||||
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";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user