mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-01-07 13:02:21 +00:00
Beaucoup de petites modifications
This commit is contained in:
parent
8ab6a7a3aa
commit
866d4a2744
BIN
assets/Autorisation de droit à l'image - majeur.pdf
Normal file
BIN
assets/Autorisation de droit à l'image - majeur.pdf
Normal file
Binary file not shown.
BIN
assets/Autorisation de droit à l'image - mineur.pdf
Normal file
BIN
assets/Autorisation de droit à l'image - mineur.pdf
Normal file
Binary file not shown.
@ -58,6 +58,8 @@ $ROUTES["^suivi-tournoi/?$"] = ["server_files/controllers/suivi_tournoi.php"];
|
|||||||
|
|
||||||
# Assets files
|
# Assets files
|
||||||
|
|
||||||
|
$ROUTES["^Autorisation de droit à l'image - majeur.pdf$"] = ["assets/Autorisation de droit à l'image - majeur.pdf", "application/pdf"];
|
||||||
|
$ROUTES["^Autorisation de droit à l'image - mineur.pdf$"] = ["assets/Autorisation de droit à l'image - mineur.pdf", "application/pdf"];
|
||||||
$ROUTES["^favicon\.ico$"] = ["assets/favicon.ico", "image/x-icon"];
|
$ROUTES["^favicon\.ico$"] = ["assets/favicon.ico", "image/x-icon"];
|
||||||
$ROUTES["^logo\.png"] = ["assets/logo.png", "image/png"];
|
$ROUTES["^logo\.png"] = ["assets/logo.png", "image/png"];
|
||||||
$ROUTES["^style\.css$"] = ["assets/style.css", "text/css"];
|
$ROUTES["^style\.css$"] = ["assets/style.css", "text/css"];
|
||||||
|
@ -79,7 +79,7 @@ class Document
|
|||||||
$req = $DB->query("SELECT * FROM `documents` AS `t1` "
|
$req = $DB->query("SELECT * FROM `documents` AS `t1` "
|
||||||
. "INNER JOIN (SELECT `user`, `problem`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `documents` GROUP BY `problem`, `user`) `t2` "
|
. "INNER JOIN (SELECT `user`, `problem`, MAX(`uploaded_at`) AS `last_upload`, COUNT(`team`) AS `version` FROM `documents` GROUP BY `problem`, `user`) `t2` "
|
||||||
. "ON `t1`.`user` = `t2`.`user` AND `t1`.`problem` = `t2`.`problem` "
|
. "ON `t1`.`user` = `t2`.`user` AND `t1`.`problem` = `t2`.`problem` "
|
||||||
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`problem` = $problem " . ($team_id >= 0 ? "AND `team` = $team_id" : "") . ";");
|
. "WHERE `t1`.`uploaded_at` = `t2`.`last_upload` AND `t1`.`problem` = $problem " . ($team_id >= 0 ? "AND `team` = $team_id" : "") . " ORDER BY `t1`.`user`;");
|
||||||
|
|
||||||
$docs = [];
|
$docs = [];
|
||||||
|
|
||||||
|
@ -18,6 +18,40 @@ elseif (isset($_POST["unvalidate"])) {
|
|||||||
$team->setValidationStatus(ValidationStatus::NOT_READY);
|
$team->setValidationStatus(ValidationStatus::NOT_READY);
|
||||||
Mailer::sendUnvalidateTeam($team);
|
Mailer::sendUnvalidateTeam($team);
|
||||||
}
|
}
|
||||||
|
elseif (isset($_POST["select_problem"])) {
|
||||||
|
if ($team->getValidationStatus() == ValidationStatus::NOT_READY) {
|
||||||
|
$problem = $_POST["select_problem"];
|
||||||
|
if (preg_match("#[0-4]#", $problem)) {
|
||||||
|
$team->setProblem($problem);
|
||||||
|
$DB->prepare("UPDATE `documents` SET `problem` = ? WHERE `team` = ?;")->execute([$problem, $team->getId()]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$has_error = true;
|
||||||
|
$error_message = "Le problème indiqué n'existe pas.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$has_error = true;
|
||||||
|
$error_message = "Cette équipe est déjà validée ou en cours de validation.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (isset($_POST["delete_team"])) {
|
||||||
|
if ($team->getValidationStatus() == ValidationStatus::NOT_READY) {
|
||||||
|
$documents = Document::getAllDocuments($team->getProblem(), $team->getId());
|
||||||
|
/** @var Document $doc */
|
||||||
|
foreach ($documents as $doc)
|
||||||
|
unlink($LOCAL_PATH . "/files/" . $doc->getFileId());
|
||||||
|
$DB->prepare("DELETE FROM `documents` WHERE `team` = ?;")->execute([$team->getId()]);
|
||||||
|
$DB->prepare("DELETE FROM `teams` WHERE `id` = ?;")->execute([$team->getId()]);
|
||||||
|
$DB->prepare("UPDATE `users` SET `team_id` = NULL WHERE `team_id` = ?;")->execute([$team->getId()]);
|
||||||
|
header("Location: /");
|
||||||
|
exit(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$has_error = true;
|
||||||
|
$error_message = "Cette équipe est déjà validée ou en cours de validation.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($_POST["download_zip"])) {
|
if (isset($_POST["download_zip"])) {
|
||||||
$file_name = getZipFile($team->getProblem(), $team->getId());
|
$file_name = getZipFile($team->getProblem(), $team->getId());
|
||||||
|
@ -92,6 +92,6 @@ class AttributeTeam
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($team != null)
|
if ($team != null)
|
||||||
$documents = $user->getAllDocuments($team->getProblem());
|
$documents = $user->getAllDocuments();
|
||||||
|
|
||||||
require_once "server_files/views/informations.php";
|
require_once "server_files/views/informations.php";
|
||||||
|
@ -29,8 +29,10 @@ if (isset($_POST["request_validation"])) {
|
|||||||
$has_error = true;
|
$has_error = true;
|
||||||
$error_message = "Vous devez cocher la case qui vous engage à participer à l'intégralité des Correspondances.";
|
$error_message = "Vous devez cocher la case qui vous engage à participer à l'intégralité des Correspondances.";
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
$_SESSION["team"]->setValidationStatus(ValidationStatus::WAITING);
|
$_SESSION["team"]->setValidationStatus(ValidationStatus::WAITING);
|
||||||
|
Mailer::sendRequestValidationMail($team);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @var Question[][] $questions_received */
|
/** @var Question[][] $questions_received */
|
||||||
@ -95,6 +97,7 @@ class MyTeam
|
|||||||
$this->team->setProblem($this->problem);
|
$this->team->setProblem($this->problem);
|
||||||
|
|
||||||
$DB->exec("UPDATE `teams` SET `problem` = " . $this->problem . " WHERE `id` = " . $this->team->getId() . ";");
|
$DB->exec("UPDATE `teams` SET `problem` = " . $this->problem . " WHERE `id` = " . $this->team->getId() . ";");
|
||||||
|
$DB->exec("UPDATE `documents` SET `problem` = " . $this->problem . " WHERE `team` = " . $this->team->getId() . ";");
|
||||||
|
|
||||||
header("Location: $URL_BASE/mon-equipe");
|
header("Location: $URL_BASE/mon-equipe");
|
||||||
}
|
}
|
||||||
|
@ -95,13 +95,6 @@ function canValidate(Team $team)
|
|||||||
$can_validate &= $team->getParticipants()[2] != null;
|
$can_validate &= $team->getParticipants()[2] != null;
|
||||||
$can_validate &= preg_match("#[1-4]#", $team->getProblem());
|
$can_validate &= preg_match("#[1-4]#", $team->getProblem());
|
||||||
|
|
||||||
if ($team->getEncadrantId() != null) {
|
|
||||||
$req = $DB->prepare("SELECT COUNT(*) AS `version` FROM `documents` WHERE `user` = ? AND `problem` = ?;");
|
|
||||||
$req->execute([$team->getEncadrantId(), $team->getProblem()]);
|
|
||||||
$d = $req->fetch();
|
|
||||||
$can_validate &= $d["version"] > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i = 1; $i <= 5; ++$i) {
|
for ($i = 1; $i <= 5; ++$i) {
|
||||||
if ($team->getParticipants()[$i] === NULL)
|
if ($team->getParticipants()[$i] === NULL)
|
||||||
continue;
|
continue;
|
||||||
|
@ -150,6 +150,19 @@ class Mailer
|
|||||||
self::sendMail($user->getEmail(), "Équipe rejointe – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content);
|
self::sendMail($user->getEmail(), "Équipe rejointe – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function sendRequestValidationMail(Team $team)
|
||||||
|
{
|
||||||
|
global $YEAR;
|
||||||
|
|
||||||
|
$content = self::getTemplate("request_validation");
|
||||||
|
$content = preg_replace("#{TEAM_NAME}#", $team->getName(), $content);
|
||||||
|
$content = preg_replace("#{TRIGRAM}#", $team->getTrigram(), $content);
|
||||||
|
$content = preg_replace("#{PROBLEM}#", $team->getProblem(), $content);
|
||||||
|
$content = preg_replace("#{ACCESS_CODE}#", $team->getAccessCode(), $content);
|
||||||
|
|
||||||
|
self::broadcastToAdmins("Ajout d'une équipe – Correspondances des Jeunes Mathématicien·ne·s $YEAR", $content);
|
||||||
|
}
|
||||||
|
|
||||||
public static function sendValidateTeam($team)
|
public static function sendValidateTeam($team)
|
||||||
{
|
{
|
||||||
global $YEAR;
|
global $YEAR;
|
||||||
|
19
server_files/services/mail_templates/request_validation.html
Normal file
19
server_files/services/mail_templates/request_validation.html
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<!--suppress HtmlUnknownTarget -->
|
||||||
|
<html lang="fr">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Demande de validation - Correspondances des Jeunes Mathématicien·ne·s</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
Bonjour {FIRST_NAME} {SURNAME},<br />
|
||||||
|
<br />
|
||||||
|
L'équipe « {TEAM_NAME} » ({TRIGRAM}) vient de demander à valider son équipe pour participer au problème n°{PROBLEM} des
|
||||||
|
Correspondances des Jeunes Mathématicien·ne·s. Vous pouvez décider d'accepter ou de refuser l'équipe en vous rendant sur
|
||||||
|
la page de l'équipe : <a href="{URL_BASE}/equipe/{TRIGRAM}">{URL_BASE}/equipe/{TRIGRAM}</a><br/>
|
||||||
|
<br/>
|
||||||
|
Cordialement,<br/>
|
||||||
|
<br />
|
||||||
|
L'organisation des Correspondances des Jeunes Mathématicien·ne·s
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -11,9 +11,22 @@
|
|||||||
<strong>Trigramme :</strong> <?= $team->getTrigram() ?>
|
<strong>Trigramme :</strong> <?= $team->getTrigram() ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
<strong>Problème :</strong> <a href="/probleme/<?= $team->getProblem() ?>">
|
<?php if (date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate()) { ?>
|
||||||
<?= $team->getProblem() == 0 ? "Pas de problème choisi" : $team->getProblem() ?>
|
<label for="problem">Problème :</label>
|
||||||
</a>
|
<form method="POST">
|
||||||
|
<select class="custom-select" id="problem" name="select_problem" onchange="this.form.submit()">
|
||||||
|
<option value="0">Pas de problème choisi</option>
|
||||||
|
<?php
|
||||||
|
for ($i = 1; $i <= 4; ++$i) { ?>
|
||||||
|
<option value="<?= $i ?>" <?= $team->getProblem() == $i ? "selected" : "" ?>>Problème <?= $i ?></option>
|
||||||
|
<?php } ?>
|
||||||
|
</select>
|
||||||
|
</form>
|
||||||
|
<?php } else { ?>
|
||||||
|
<strong>Problème :</strong> <a href="/probleme/<?= $team->getProblem() ?>">
|
||||||
|
<?= $team->getProblem() == 0 ? "Pas de problème choisi" : $team->getProblem() ?>
|
||||||
|
</a>
|
||||||
|
<?php } ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="alert alert-<?= $team->getValidationStatus() == ValidationStatus::VALIDATED ? "success" : ($team->getValidationStatus() == ValidationStatus::WAITING ? "warning" : "danger") ?>">
|
<div class="alert alert-<?= $team->getValidationStatus() == ValidationStatus::VALIDATED ? "success" : ($team->getValidationStatus() == ValidationStatus::WAITING ? "warning" : "danger") ?>">
|
||||||
<strong>Validation de l'équipe
|
<strong>Validation de l'équipe
|
||||||
@ -78,7 +91,7 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
|
|||||||
|
|
||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<h2>Autorisations</h2>
|
<h2>Autorisations de droit à l'image</h2>
|
||||||
|
|
||||||
<?php printDocuments($documents) ?>
|
<?php printDocuments($documents) ?>
|
||||||
|
|
||||||
@ -99,6 +112,11 @@ if ($_SESSION["role"] == Role::ADMIN) { ?>
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
}
|
} elseif ($team->getValidationStatus() == ValidationStatus::NOT_READY && $_SESSION["role"] == Role::ADMIN) { ?>
|
||||||
|
<hr/>
|
||||||
|
<form method="POST">
|
||||||
|
<input type="submit" class="btn btn-primary btn-lg btn-block" name="delete_team" value="Supprimer l'équipe" style="background-color: #ff2e34"/>
|
||||||
|
</form>
|
||||||
|
<?php }
|
||||||
|
|
||||||
require_once "footer.php" ?>
|
require_once "footer.php" ?>
|
@ -46,7 +46,7 @@
|
|||||||
|
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<strong>Attention aux dates !</strong> Si vous ne finalisez pas votre inscription dans le délai indiqué, vous
|
<strong>Attention aux dates !</strong> Si vous ne finalisez pas votre inscription dans le délai indiqué, vous
|
||||||
ne pourrez malheureusement pas participer au tournoi.
|
ne pourrez malheureusement pas participer aux Correspondances.
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="alert alert-info">
|
<div class="alert alert-info">
|
||||||
|
@ -94,6 +94,7 @@ if (!$has_error) {
|
|||||||
<h1 class="display-5">Autorisation de droit à l'image :</h1>
|
<h1 class="display-5">Autorisation de droit à l'image :</h1>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
print_r($documents);
|
||||||
printDocuments($documents);
|
printDocuments($documents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php } else { ?>
|
<?php } else if ($user->getRole() == Role::ENCADRANT) { ?>
|
||||||
|
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label id="description_label" for="description">Activité professionnelle :</label>
|
<label id="description_label" for="description">Activité professionnelle :</label>
|
||||||
@ -134,12 +134,17 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
|
|||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php if (isset($_SESSION["team"]) && $_SESSION["team"]->getValidationStatus() == ValidationStatus::NOT_READY) { ?>
|
<?php if (isset($_SESSION["team"]) && $user->getRole() == Role::PARTICIPANT && $_SESSION["team"]->getValidationStatus() == ValidationStatus::NOT_READY
|
||||||
|
&& date("Y-m-d H:i:s") < $CONFIG->getInscriptionDate()) { ?>
|
||||||
<hr/>
|
<hr/>
|
||||||
<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>
|
||||||
<em>Ce document peut être modifié tant que l'équipe n'est pas validée.</em>
|
<em>Ce document peut être modifié tant que l'équipe n'est pas validée.</em>
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<strong>Modèle d'autorisation de droit à l'image :</strong>
|
||||||
|
<a href="/Autorisation de droit à l'image - majeur.pdf">majeur</a> - <a href="/Autorisation de droit à l'image - mineur.pdf">mineur</a>
|
||||||
|
</div>
|
||||||
<?php printDocuments($documents); ?>
|
<?php printDocuments($documents); ?>
|
||||||
<form method="POST" enctype="multipart/form-data">
|
<form method="POST" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ require_once "header.php";
|
|||||||
<hr/>
|
<hr/>
|
||||||
|
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<input class="btn btn-primary btn-lg btn-block" type="submit" name="leave_team"
|
<input class="btn btn-primary btn-lg btn-block" type="submit" name="leave_team" style="background-color: #ff2e34"
|
||||||
value="Quitter l'équipe"/>
|
value="Quitter l'équipe"/>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user