98 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			98 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Teamtable;
 | |
| 
 | |
| /**
 | |
|  * Represents a team in the teamtable database
 | |
|  */
 | |
| class Team
 | |
| {
 | |
|     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;
 | |
|         }
 | |
|     }
 | |
| } |