1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-03 06:42:46 +02:00

Divserses corrections, phase 0 terminée

This commit is contained in:
galaxyoyo
2019-09-12 16:01:40 +02:00
parent 416264b53c
commit 61bec11bdb
7 changed files with 17 additions and 16 deletions

View File

@ -60,6 +60,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;");
$req = $DB->query("SELECT `file_id` FROM `documents` WHERE `user` = $user_id;");
while (($data = $req->fetch()) !== false)
unlink("$URL_BASE/files/" . $data["file_id"]);
@ -151,13 +152,10 @@ function getZipFile($problem, $team_id = -1)
die("Impossible de créer le fichier zip.");
}
// TODO Replace DB query
$resp = $DB->query("SELECT * FROM `documents` WHERE `problem` = $problem" . ($team_id >= 0 ? " AND `team` = $team_id" : "") . ";");
$data = Document::getAllDocuments($problem, $team_id);
/** @var Document $file */
//foreach ($data as $file) {
while (($data = $resp->fetch()) != false) {
$file = Document::fromData($data);
foreach ($data as $file) {
$file_id = $file->getFileId();
$user = User::fromId($file->getUserId());
$name = "Autorisation de droit à l'image de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf";