1
0
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:
galaxyoyo
2019-09-07 01:33:05 +02:00
parent b5d567e364
commit bffaf4b360
30 changed files with 472 additions and 440 deletions

View File

@ -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()