1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-06-24 09:08:47 +02:00

Attribution des vidéos aux équipes (manuelle)

This commit is contained in:
galaxyoyo
2019-09-20 00:02:01 +02:00
parent c48b97cc6d
commit c3aa0386f2
14 changed files with 171 additions and 320 deletions

View File

@ -10,6 +10,7 @@ class Team
private $participants;
private $inscription_date;
private $validation_status;
private $video_team_ids;
private $access_code;
private $year;
@ -60,6 +61,23 @@ class Team
return $team;
}
public static function getAllTeams($problem)
{
global $DB, $YEAR;
$req = $DB->prepare("SELECT * FROM `teams` WHERE `problem` = ? AND `year` = $YEAR;");
$req->execute([htmlspecialchars($problem)]);
$teams = [];
while (($data = $req->fetch()) != false) {
$team = new Team();
$team->fill($data);
$teams[] = $team;
}
return $teams;
}
private function fill($data)
{
$this->id = $data["id"];
@ -70,6 +88,7 @@ class Team
$this->participants = [$data["participant_1"], $data["participant_2"], $data["participant_3"], $data["participant_4"], $data["participant_5"]];
$this->inscription_date = $data["inscription_date"];
$this->validation_status = ValidationStatus::fromName($data["validation_status"]);
$this->video_team_ids = [$data["video_team1"], $data["video_team2"]];
$this->access_code = $data["access_code"];
$this->year = $data["year"];
}
@ -155,10 +174,22 @@ class Team
{
global $DB;
$this->validation_status = $status;
/** @noinspection PhpUndefinedMethodInspection */
$DB->prepare("UPDATE `teams` SET `validation_status` = ? WHERE `id` = ?;")->execute([ValidationStatus::getName($status), $this->id]);
}
public function getVideoTeamIds()
{
return $this->video_team_ids;
}
public function setVideoTeamIds($video_team_ids)
{
global $DB;
ensure(sizeof($video_team_ids) == 2, "Une équipe doit recevoir exactement deux vidéos.");
$this->video_team_ids = $video_team_ids;
$DB->prepare("UPDATE `teams` SET `video_team1` = ?, `video_team2` = ? WHERE `id` = ?;")->execute([$video_team_ids[0], $video_team_ids[1], $this->id]);
}
public function getAccessCode()
{
return $this->access_code;