mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-06-25 17:37:25 +02:00
Utilisation des nouvelles classes, amélioration du code
This commit is contained in:
@ -26,7 +26,7 @@ class Team
|
||||
$data = $req->fetch();
|
||||
|
||||
if ($data === false)
|
||||
throw new InvalidArgumentException("L'équipe spécifiée n'existe pas.");
|
||||
return null;
|
||||
|
||||
$team = new Team();
|
||||
$team->fill($data);
|
||||
@ -41,7 +41,22 @@ class Team
|
||||
$data = $req->fetch();
|
||||
|
||||
if ($data === false)
|
||||
throw new InvalidArgumentException("L'équipe spécifiée n'existe pas.");
|
||||
return null;
|
||||
|
||||
$team = new Team();
|
||||
$team->fill($data);
|
||||
return $team;
|
||||
}
|
||||
|
||||
public static function fromAccessCode($access_code)
|
||||
{
|
||||
global $DB, $YEAR;
|
||||
$req = $DB->prepare("SELECT * FROM `teams` WHERE `access_code` = ? AND `year` = $YEAR;");
|
||||
$req->execute([htmlspecialchars($access_code)]);
|
||||
$data = $req->fetch();
|
||||
|
||||
if ($data === false)
|
||||
return null;
|
||||
|
||||
$team = new Team();
|
||||
$team->fill($data);
|
||||
@ -145,7 +160,7 @@ class Team
|
||||
global $DB;
|
||||
$this->validation_status = $status;
|
||||
/** @noinspection PhpUndefinedMethodInspection */
|
||||
$DB->prepare("UPDATE `teams` SET `validation_status` = ? WHERE `id` = ?;")->execute([$status->getName(), $this->id]);
|
||||
$DB->prepare("UPDATE `teams` SET `validation_status` = ? WHERE `id` = ?;")->execute([ValidationStatus::getName($status), $this->id]);
|
||||
}
|
||||
|
||||
public function isSelectedForFinal()
|
||||
|
Reference in New Issue
Block a user