1. <?
  2.  
  3. class Match {
  4.  
  5. public $id; //unique match ID in database
  6. public $tourney_id; //tourney's ID in database
  7. public $p1_id; //player1's ID in database
  8. public $p2_id; //player2's ID in database
  9. public $status; //array with keywords: "open", "closed" and "conflict"
  10. public $type; //1 = bo1, 3 = b03 etc.
  11. public $score; //array with keywords: "p1" and "p2"
  12. public $maps; //array filled with the maps
  13.  
  14. public function __construct($p1_id, $p2_id, $tourney_id, $maps, $type = 3) {
  15.  
  16. $last_id = ""; //database query which checks for the last match ID
  17. $this->id = $last_id + 1;
  18. $this->p1_id = $p1_id;
  19. $this->p2_id = $p2_id;
  20. $this->tourney_id = $tourney_id;
  21. $this->type = $type;
  22.  
  23. for ($i = 0; $i <= $type - 1; $i++) {
  24.  
  25. if(isset($maps[0]))
  26. $this->maps[0] = $maps[0];
  27. else
  28. $this->maps[0] = ""; //hier een random map kiezen uit de mappool van de tourney
  29.  
  30. }
  31.  
  32. $this->status["open"] = true;
  33. $this->score[0] = 0;
  34. $this->score[1] = 0;
  35.  
  36. }
  37.  
  38. }
  39.  
  40. ?>