Fusion_Page.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. require_once($path["page"] . "Page.php");
  3. require_once($path["entity"] . "Fusion.php");
  4. require_once($path["entity"] . "Monster_Collection.php");
  5. /**
  6. * Fusion page model.
  7. */
  8. class Fusion_Page extends Page{
  9. /**
  10. * List of fusions.
  11. */
  12. public $fusion = [];
  13. /**
  14. * {@see Monster_Collection} of owned monsters.
  15. */
  16. public $collection = [];
  17. /**
  18. * Constructor.
  19. *
  20. * Retrieves the data and initializes the variables.
  21. *
  22. * @param MySQL_connection $db Connection to the database.
  23. */
  24. public function __construct($db){
  25. global $path;
  26. global $root;
  27. parent::__construct($db);
  28. $this->view = $path["view"] . "fusion.php";
  29. $s =
  30. "SELECT DISTINCT target " .
  31. "FROM fusion " .
  32. "ORDER BY target_stars DESC; ";
  33. $q = mysqli_query($this->db, $s);
  34. while ($r = mysqli_fetch_array($q)){
  35. array_push($this->fusion, new Fusion($this->db, $r["target"]));
  36. }
  37. $s =
  38. "SELECT id " .
  39. "FROM monster_collection " .
  40. "WHERE level <> 0 " .
  41. "ORDER BY " .
  42. " stars DESC, " .
  43. " level DESC; ";
  44. $q = mysqli_query($this->db, $s);
  45. while ($r = mysqli_fetch_array($q)){
  46. array_push($this->collection, new Monster_Collection($this->db, $r["id"]));
  47. }
  48. $this->title = "";
  49. $this->name = "";
  50. $this->description = "";
  51. $this->favicon = "";
  52. $this->icon = "";
  53. $this->canonical = $root . "/fusion/";
  54. $this->author = $root . "/fusion/";
  55. }
  56. }
  57. ?>