dffc97e0ea1bfc6fe0d6280cd81b5b51581d88d2
[L-seed.git] / web / php / SeasonScore.php
1 <?php
2
3         class SeasonScore
4         {
5             public $ID;
6                 public $UserID;
7                 public $User;
8                 public $SeasonID;
9                 public $Season;
10                 public $Score;
11                 public $DataBase;
12                 
13                 public function __construct($id, $userid, $seasonid, $score, $database) {
14                         $this->ID = $id;
15                         $this->UserID = $userid;
16                         $this->SeasonID = $seasonid;
17                         $this->Score = $score;
18                         $this->DataBase = $database;
19                 }
20
21                 public function ToJson() {
22                         $running = 'false';
23                         $username = 'unknown';
24                         if ($this->User) { $username = $this->User->Name; }
25                         if ($this->Season) { if ($this->Season->IsRunning) { $running = 'true'; } else { $running = 'false'; } }
26                         return "{ ID: " . $this->ID . ", User: '" . $username . "', IsRunning: " . $running . ", Score: " . sprintf("%f", $this->Score) . " }";
27                 }
28         }
29 ?>
30