make add/remove starter buttons date sensitive

This commit is contained in:
marko
2023-01-29 19:55:33 +01:00
parent 4ff0659f90
commit ece0ef5025
9 changed files with 492 additions and 196 deletions

View File

@@ -57,7 +57,20 @@ class Shiai
return ($this->place != null ? $this->place : '-');
}
public static function fromArray($member)
public static function loadFromDb(int $id)
{
$query = 'SELECT * FROM `cwsvjudo`.`wettkampfkalender` WHERE `lfdeNr` = :id;';
$params = [':id' => ['value' => $id, 'data_type' => PDO::PARAM_INT]];
$response = dbConnector::query($query, $params);
// ids are considered unique. so every other count then 1 is treated as error to prevent unprivileged access
if (count($response) != 1) {
return null;
}
return self::fromDbArray($response[0]);
}
public static function fromDbArray($member)
{
return new shiai(
$member['lfdeNr'] ?? null,