Landing_Page.php 991 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. /**
  4. * Landing page model.
  5. */
  6. class Landing_Page extends Page{
  7. /**
  8. * Array of players [uid]=>[name].
  9. */
  10. public $players = [];
  11. /**
  12. * Constructor.
  13. *
  14. * Retrieves the data and initializes the variables.
  15. *
  16. * @param SQLite3 $db Connection to the database.
  17. */
  18. public function __construct($db){
  19. global $path;
  20. global $root;
  21. parent::__construct($db);
  22. $this->view = $path["view"] . "landing.php";
  23. $s = "SELECT uid, name FROM player";
  24. $q = $this->db->query($s);
  25. while ($r = $q->fetchArray(SQLITE3_ASSOC)){
  26. $this->players[$r["uid"]] = $r["name"];
  27. }
  28. $this->title = "Player - SWDB";
  29. $this->description = "Select a player";
  30. $this->canonical = $root . "landing/";
  31. }
  32. }
  33. ?>