2022-03-02 06:24:27 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Teamtable;
|
|
|
|
|
|
|
|
/**
|
2022-03-02 13:26:02 +00:00
|
|
|
* Represents a team in the teamtable database
|
2022-03-02 06:24:27 +00:00
|
|
|
*/
|
|
|
|
class Team
|
|
|
|
{
|
2022-03-02 13:26:02 +00:00
|
|
|
public string $name;
|
|
|
|
public string $company;
|
|
|
|
public string $cardnumber;
|
|
|
|
public int $phone;
|
|
|
|
public int $participants;
|
|
|
|
public int $rounds;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
string $name = 'NN',
|
|
|
|
string $company = 'NN',
|
|
|
|
string $cardnumber = 'NN',
|
|
|
|
int $phone = 0,
|
|
|
|
int $participants = 0,
|
|
|
|
int $rounds = 0
|
|
|
|
)
|
|
|
|
{
|
|
|
|
$this->name = $name;
|
|
|
|
$this->company = $company;
|
|
|
|
$this->cardnumber = $cardnumber;
|
|
|
|
$this->phone = $phone;
|
|
|
|
$this->participants = $participants;
|
|
|
|
$this->rounds = $rounds;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if all current values are valid
|
|
|
|
*/
|
|
|
|
public function validate(): bool
|
|
|
|
{
|
|
|
|
$validationError = FALSE;
|
|
|
|
$template = $model->template;
|
|
|
|
|
|
|
|
// LagNavn
|
|
|
|
if (!strlen($LagNavn)) {
|
|
|
|
$LagNavn = $template['LagNavn'];
|
|
|
|
}
|
|
|
|
if (strlen($LagNavn) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Bedrift
|
|
|
|
if (!strlen($Bedrift)) {
|
|
|
|
$Bedrift = $template['Bedrift'];
|
|
|
|
}
|
|
|
|
if (strlen($Bedrift) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Kortnummer
|
|
|
|
if (!strlen($Kortnummer)) {
|
|
|
|
$Kortnummer = $template['Kortnummer'];
|
|
|
|
}
|
|
|
|
if (strlen($Kortnummer) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lagleder
|
|
|
|
if (!strlen($Lagleder)) {
|
|
|
|
$Lagleder = $template['Lagleder'];
|
|
|
|
}
|
|
|
|
if (strlen($Lagleder) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Telefon
|
|
|
|
if (!strlen($Telefon)) {
|
|
|
|
$Telefon = $template['Telefon'];
|
|
|
|
}
|
|
|
|
if (strlen((string) $Telefon) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Deltagere
|
|
|
|
if (!strlen($Deltagere)) {
|
|
|
|
$Deltagere = $template['Deltagere'];
|
|
|
|
}
|
|
|
|
if (strlen((string) $Deltagere) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Runder
|
|
|
|
if (!strlen($Runder)) {
|
|
|
|
$Runder = $template['Runder'];
|
|
|
|
}
|
|
|
|
if (strlen((string) $Runder) > 32) {
|
|
|
|
$validationError = TRUE;
|
|
|
|
}
|
|
|
|
}
|
2022-03-02 06:24:27 +00:00
|
|
|
}
|