1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-07-01 17:21:16 +02:00

First week fixes

This commit is contained in:
Yohann D'ANELLO
2020-05-05 01:06:57 +02:00
parent a064cc1817
commit 132481fda0
22 changed files with 541 additions and 59 deletions

View File

@ -37,7 +37,7 @@ elseif (isset($_POST["unvalidate"])) {
if (isset($_POST["select"])) {
$team->selectForFinal(true);
$team->setValidationStatus(ValidationStatus::NOT_READY);
# $team->setValidationStatus(ValidationStatus::NOT_READY);
$sols = $tournament->getAllSolutions($team->getId());
/** @var Solution $sol */
foreach ($sols as $sol) {
@ -49,7 +49,7 @@ if (isset($_POST["select"])) {
copy("$LOCAL_PATH/files/$old_id", "$LOCAL_PATH/files/$id");
$req = $DB->prepare("INSERT INTO `solutions`(`file_id`, `team`, `tournament`, `problem`) VALUES (?, ?, ?, ?);");
$req->execute([$id, $team->getId(), $FINAL->getId(), $sol->getFileId()]);
$req->execute([$id, $team->getId(), $FINAL->getId(), $sol->getProblem()]);
}
}
@ -86,6 +86,19 @@ if (isset($_POST["select_tournament"])) {
$tournament = $new_tournament;
}
if (isset($_POST["delete_team"])) {
foreach ($team->getEncadrants() as $encadrant_id) {
quitTeam($encadrant_id);
}
foreach ($team->getParticipants() as $participant_id) {
quitTeam($participant_id);
}
header("Location: /");
return;
}
class EditTeam
{
public $name;
@ -136,4 +149,25 @@ $documents_final = null;
if ($team->isSelectedForFinal())
$documents_final = $FINAL->getAllDocuments($team->getId());
$emails = [];
if ($_SESSION["role"] == Role::ORGANIZER || $_SESSION["role"] == Role::ADMIN) {
foreach ($team->getEncadrants() as $encadrant_id) {
$encadrant = User::fromId($encadrant_id);
if ($encadrant != null) {
$emails[] = $encadrant->getEmail();
}
}
foreach ($team->getParticipants() as $participant_id) {
$participant = User::fromId($participant_id);
if ($participant != null) {
$emails[] = $participant->getEmail();
if ($participant->getResponsibleEmail() != null) {
$emails[] = $participant->getResponsibleEmail();
}
}
}
}
require_once "server_files/views/equipe.php";