mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-25 19:37:26 +02:00
Ajout d'une classe pour les fichiers à télécharger, meilleur support des organisateurs d'un tournoi
This commit is contained in:
@ -13,6 +13,7 @@ class Tournament
|
||||
private $date_solutions;
|
||||
private $date_syntheses;
|
||||
private $final;
|
||||
private $organizers = [];
|
||||
private $year;
|
||||
|
||||
private function __construct() {}
|
||||
@ -76,6 +77,13 @@ class Tournament
|
||||
$this->date_syntheses = $data["date_syntheses"];
|
||||
$this->final = $data["final"] == true;
|
||||
$this->year = $data["year"];
|
||||
|
||||
global $DB;
|
||||
$req = $DB->prepare("SELECT `organizer` FROM `organizers` WHERE `tournament` = ?;");
|
||||
$req->execute([$this->id]);
|
||||
|
||||
while (($data = $req->fetch()) !== false)
|
||||
$this->organizers[] = User::fromId($data["organizer"]);
|
||||
}
|
||||
|
||||
public function getId()
|
||||
@ -215,6 +223,21 @@ class Tournament
|
||||
$DB->prepare("UPDATE `tournaments` SET `final` = ? WHERE `id` = ?;")->execute([$final, $this->id]);
|
||||
}
|
||||
|
||||
public function getOrganizers()
|
||||
{
|
||||
return $this->organizers;
|
||||
}
|
||||
|
||||
public function organize($user_id)
|
||||
{
|
||||
foreach ($this->organizers as $organizer) {
|
||||
if ($organizer->getId() == $user_id)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public function getYear()
|
||||
{
|
||||
return $this->year;
|
||||
|
Reference in New Issue
Block a user