Merge remote-tracking branch 'origin/master'

This commit is contained in:
Yohann 2019-11-27 12:16:05 +01:00
commit 8fa1183f9f
3 changed files with 6 additions and 4 deletions

View File

@ -70,10 +70,10 @@ class Team
return $team;
}
public static function getAllTeams($problem)
public static function getAllTeams($problem, $only_validated = false)
{
global $DB, $YEAR;
$req = $DB->prepare("SELECT * FROM `teams` WHERE " . ($problem < 0 ? "" : "`problem` = ? AND ") . "`year` = $YEAR;");
$req = $DB->prepare("SELECT * FROM `teams` WHERE " . ($problem < 0 ? "" : "`problem` = ? AND ") . ($only_validated ? "`validation_status` = 'VALIDATED' AND " : "") . "`year` = $YEAR;");
$req->execute([htmlspecialchars($problem)]);
$teams = [];

View File

@ -102,7 +102,7 @@ class UpdateVideoTeams
}
}
$other_teams = Team::getAllTeams($team->getProblem());
$other_teams = Team::getAllTeams($team->getProblem(), true);
$documents = Document::getAllDocuments($team->getProblem(), $team->getId());
require_once "server_files/views/equipe.php";

View File

@ -155,7 +155,9 @@ function getZipFile($problem, $team_id = -1)
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";
$mime_type = finfo_file(finfo_open(FILEINFO_MIME_TYPE), "$LOCAL_PATH/files/$file_id");
$ext = $mime_type == "application/pdf" ? "pdf" : ($mime_type == "image/png" ? "png" : "jpg");
$name = "Autorisation de droit à l'image de " . $user->getFirstName() . " " . $user->getSurname() . "." . $ext;
$zip->addFile("$LOCAL_PATH/files/$file_id", $name);
}